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 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2010
    Location
    God's Own Country
    Posts
    87
    Thanks
    6
    Thanked 0 Times in 0 Posts

    getting the time at which the user clicks on a hyperlink

    Hello Friends....Wat should I do inorder to get the time at which the clicks on an hyperlink.I'll tell u wat I actually needs...I am making an exam site.When user clicks on the link"Attend exam" the xam gets started.His start time gets added up to the total duration of xam.When the server time exceeds the time allowed for exam(i.e his start time+exam duration) the exam paper disappears.But I don't knw how can I get the time at which user clicks on the link "attend test".
    The code that I tried is,
    Code:
    if(isset($_GET['scd']))
    {
        $ctime=date("H:i");
        $inviselmt=$_GET['scd'];
        $_SESSION['xmstart']=$ctime;
        $st_time=$_SESSION['xmstart'];
        echo $st_time;
    }
    here 'scd' is a variable that is passed when the user clicks on the link "attend test"..st_time denotes the start time.
    With this code, even if I'm using the session whenever the page gets refreshed the time also changes .
    Last edited by sradha; 03-14-2010 at 07:48 PM. Reason: incomplete

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    With this code, even if I'm using the session whenever the page gets refreshed the time also changes .
    Something like
    PHP Code:
    if(!isset($_SESSION['xmstart']) && isset($_GET['scd']))
    {
        
    $ctime=date("H:i");
        
    $inviselmt=$_GET['scd'];
        
    $_SESSION['xmstart']=$ctime;
        
    //$st_time=$_SESSION['xmstart'];
        
    }
    if(isset(
    $_SESSION['xmstart']))
      echo 
    $_SESSION['xmstart']; 
    ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    sradha (03-14-2010)

  • #3
    New Coder
    Join Date
    Feb 2010
    Location
    God's Own Country
    Posts
    87
    Thanks
    6
    Thanked 0 Times in 0 Posts
    ya it's working...thanks alottttt..


  •  

    Posting Permissions

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