Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookie Use

Status
Not open for further replies.

bopritchard

Programmer
Jan 27, 2003
199
US
i want to do x once everytime sometimes comes to my site...

for instance...when someone comes to index.php i will pop up another window saying blah, blah, blah...i figured i could then write a cookie to expire an hour (some amount time) later...and i would check this cookie before launching this popup so the user wouldn't continually get it

question is...how can i do this

thanks
 
to do the popup youll need to use some javascript...and to write a cookie use the setcookie() function in php


Code:
setcookie ("TestCookie", $value,time()+3600);  /* expire in 1 hour */

thats the syntax youll want to use to expire in an hour (code is from the php manual link i posted above) i should probably note here you may want to look at sessions. your problem is fairly simple atm but you could easily set up an hour long session which would also give you an easy way to pass vars between pages. personally i dont know how id write a script without them. heres a link to session stuff case your interested.

what we see depends mainly on what we're looking for.
--John Lubbock
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top