Jump to content

Cookies omg i dont understand the math?<time()


scheols

Recommended Posts

like can someone tell me how 2 set cookies with the specified time and understanding how what time is what. like example

[code=php:0]
setcookie("id", $user[id],time()+(60*60*24*5), "/", "");
[/code]

the 60*60*24*5

how does it work?

*as u looked i seen time() so ill look that up plz post thanks.
Link to comment
Share on other sites

the [code=php:0]time()[/code] function returns
[quote]the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).[/quote]

so if you wanted to go 60 seconds from now
you'd say

[code]time() + 60;[/code]

lets' say you wanted to go and hour later
well, an hour is 60 minutes...and you know one minute is 60 seconds
so,
[code=php:0]time() + (60*60)[/code]

so in your case you're going

[code=php:0]time() + 60 //One minute
time() + (60*60) //One Hour
time() + (60*60*24) //One Day
time() + (60*60*24*5) //Five Days[/code]
hope that helps
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.