jamiee Posted April 14, 2007 Posted April 14, 2007 is there a code that up can put on your page and the user can only use that page say once over 10 min's ?? Quote
hamster01 Posted April 14, 2007 Posted April 14, 2007 Re: time code Yes. Use Unix_timestamp() for this. Example: $last_on_page = mysql_query("SELECT * FROM users WHERE laston=UNIX_TIMESTAMP()+36000 AND userid=$userid"); // simple maths 60*60*10 if (!$last_on_page){ echo "Last on at: Less Than ten minutes."} else{ echo "Last on at: $last_on_page"} Quote
UCC Posted April 14, 2007 Posted April 14, 2007 Re: time code You would need to track their usage somehow. Either in a new table or in the User table. The field would track when they used the thing last. When you update the field via SQL use unix_timestamp() When you run your If statement do a compare using the PHP function time() Edit; I guess I got distracted and got beaten to the punch on this post. lol Quote
hamster01 Posted April 14, 2007 Posted April 14, 2007 Re: time code Edit; I guess I got distracted and got beaten to the punch on this post. lol :lol: Quote
jamiee Posted April 14, 2007 Author Posted April 14, 2007 Re: time code so i just put that cobe at the top of my page and it will work Quote
hamster01 Posted April 14, 2007 Posted April 14, 2007 Re: time code No. Do this: Query to db ALTER TABLE `users` ADD `thepage_lasttime`; And on the page: $lasttime=mysql_query("SELECT thepage_lasttime FROM users WHERE userid=$userid"); if ($lasttime < $lasttime+3600) { die("Not enough time"); } that should work! Quote
jamiee Posted April 14, 2007 Author Posted April 14, 2007 Re: time code ty, and how long is the time set there all ready +3600 how did you get that so if i ask to much im new to this Quote
Decepti0n Posted April 14, 2007 Posted April 14, 2007 Re: time code That won't do anything :s You'll end up with if Resource id #6 < Resource id #6 + 3500 Quote
jamiee Posted April 14, 2007 Author Posted April 14, 2007 Re: time code so how do i do it then??? Quote
hamster01 Posted April 14, 2007 Posted April 14, 2007 Re: time code No problem. 1=1second so 60*60*10=36000 Decryption, that would output nothing or Recourceid#14 use this: UPDATE `users` SET `thepage_lasttime`=UNIX_TIMESTAMP() WHER userid=$userdi Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.