Jump to content
MakeWebGames

Recommended Posts

Posted

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"}
Posted

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

Posted

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!

Posted

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

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.   Paste as plain text instead

  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...