I have a button that needs to be only clickable once every 24 hours by the user, how would I do this using the PHP time function? I reallllly don't want to have to do this by storing it in the database if I don't have to, if you can provide javascript or PHP code +1 to you buddy!
Results 1 to 4 of 4
Thread: Fucking with php time function
- 07 Dec. 2010 03:24am #1
Fucking with php time function
Last edited by HTML; 07 Dec. 2010 at 03:28am.
- 07 Dec. 2010 04:35am #2
You can use sessions or cookies. If the user clears cookies and session then that wont work. A database would be better. Make it store the users IP and a time stamp of when they clicked the button. Then when they go back to the page it checks the database and the users ip and see if the time has increased 24 hours or greater.
- 07 Dec. 2010 05:28am #3
Yup just fixed it using:
session_set_cookie_params()
Though I better go with the database :/
I loves my some php.net
- 07 Dec. 2010 11:21pm #4
You might want to use both of those methods. The first thing people usually try is clearing cookies. Most people give up after that, if it doesn't work to their advantage...