Jump to content

timestamp


ghqwerty

Recommended Posts

as you might no i am setting up a limit on how many times a user can extort someone in a given time.

 

i have added the column 'last_extortion' however whenever i try and update it to the current timestamp it wont change.

 

could someone please show me how to update it ? whether using time() or date()

Link to comment
https://forums.phpfreaks.com/topic/130179-timestamp/
Share on other sites

i have another problem now

 

when drawing on that information in the table how to i put it in date() format ?

 

so i could do

if((date('y-m-d H:I:S') - $last_time) > $seconds_gap)

 

if yes then do extortion if no then show an error message like - "You can only extort once every x minutes. You have to wait y more minutes/seconds"

Link to comment
https://forums.phpfreaks.com/topic/130179-timestamp/#findComment-675127
Share on other sites

now that the servers are back up i now have a 3rd problem lol

 

im getting this error whenever i 'extort' someone

 

Warning: strtotime() expects parameter 1 to be string, resource given in /home/a2350935/public_html/extortion.php on line 95

 

 

this is how im using it

 

$last_time = mysql_query("select last_extortion from members where id = '".$_SESSION['id']."'") or die(mysql_error());
												$last_time = strtotime($last_time);													
												$length = 10;
												$seconds_gap = $length * 60;

Link to comment
https://forums.phpfreaks.com/topic/130179-timestamp/#findComment-675500
Share on other sites

changed to

 

$last_time = mysql_query("select last_extortion from members where id = '".$_SESSION['id']."'") or die(mysql_error());
												$last_time1 = mysql_fetch_array($last_time);
												$last_time2 = $last_time1['last_extortion'];
												$last_time = strtotime($last_time2);													
												$length = 10;
												$seconds_gap = $length * 60;													
												if((time() - $last_time) > $seconds_gap){

 

 

but now whenever i try and extort someone i get

 

'You can only extort once every 10 minutes. You have to wait 1225107713 seconds.'

Link to comment
https://forums.phpfreaks.com/topic/130179-timestamp/#findComment-675507
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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