Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.