Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting the users time and not the servers

    So, I wrote this script
    PHP Code:
    <?php
        
        
    // Define some constants
        
    DEFINE('HEIGHT','25');
        
    DEFINE('WIDTH','250');

            
    // Create the image
            
    $img_handle ImageCreate(WIDTH,HEIGHT) or die("Image could not be created.");
            
            
    // Define the background color
            
    $background ImageColorAllocate($img_handle255255255); // 255 255 255 is white
            
            // Define the text color        
            
    $text ImageColorAllocate($img_handle000); // 0 0 0 is white
            
            // Set the date to a variable
            
    $date date("l, F j, Y - g:i.s a");
            
            
    // Lets write the text
            
    ImageString($img_handle255$date$text);
            
            
    // Send the header and create the image
            
    header ("Content-type: image/png");    
            
    ImagePng ($img_handle);
    ?>
    and everything works as expected, except for the fact that it shows the servers time, which is Central Standard and I am Eastern/GMT -5. So my question is, how can I make my script show the user who is viewing time instead of the servers? Thanks a lot,

    Stevie
    Last edited by SDP2006; 04-25-2004 at 02:15 PM.
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As far as i know, you need to use clientside scriptingto get the clients date-time. Or, like in this forum, you need to store the timezone that the client is ininside a cookie or db, after the entered that (on registration or whatever).
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I thought about the Javascript idea, but my problem was "How do I get JavaScript to interact with PHP?"

    Thanks as always, raf!

    Stevie
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, you just compose the time-value and then store it inside a hidden formfield and then post the form to the server.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •