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 to the CF scene
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question about session time

    I found this code online and was wondering what it does and how it works.

    Code:
    $_SESSION['token'] = md5(session_id() . time());
    Mainly wondering what the time thing. We're using this to prevent someone from reposting the same comment/review on a review thing when the click refresh. Wanted to make sure it was going to be messing up if the user came back by the site at the same time the next day, didn't really know about what it did. Would the number ever duplicate it self.

  • #2
    New Coder
    Join Date
    Jul 2011
    Location
    Kediri - Indonesia
    Posts
    61
    Thanks
    2
    Thanked 19 Times in 19 Posts
    that command create a uniq token. the token made from combination of session_id() and time(). session_id is uniq by each browser. and time() uniq by time. and it is hashed with md5.

    then include the token into any link or action. then compare session[token] with included token. if not equal, action canceled.
    I am sorry my english is very bad. But I am very interest to discusse here :-)

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question about session time

    Session is a single user object and One person can login at the one time and one session. It have some limited time after that session gets time out. Multiple user cant access one account at the same time.


  •  

    Tags for this Thread

    Posting Permissions

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