Jump to content

is my code correct


kev wood

Recommended Posts

i want this code to by:-

 

it checks to see if $sent_mail is less than 200.  if it is then it continues along with the normal code.  if it is not then it checks to see if 24 hr has passed.  if 24 hr has passed since last message sent then it truncates the table and stays on the same page.  if 24 hr has not passed then it takes them to the limit page.  here is the code.

if($sent_mail < 200) {

// page code runs as normal if less than

}elseif ($time_dif >= 1440) {

mysql_query("Truncate table time");
mysql_query("Truncate table email_count");
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=maillists.php">'; //redierct user when they can't send any more emails.
}
else{
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=limit.php">'; //redierct user when they can't send any more emails.
}

 

i am not asking for someone else to test this just to tell me if it looks like it would do as i need it to.

Link to comment
https://forums.phpfreaks.com/topic/108678-is-my-code-correct/
Share on other sites

the code is working for if the limit is less than 200 it stays on the page, if the limit is over 200 it goes to the limit page i now need to check if the time part is working how i want.

 

at the moment it is checking if 24 hours as passed i need to change a piece of code so that it checks if the time passed is 1 minute or as small as possible.  the code i have at the minute is this

 

$time_diff = time() - $sent;

$time_diff = intval($time_diff / 60);

$time_dif >= 1440

 

i know this code is getting the difference in time in minutes and is checking if the difference is more than or equal to 1440.

 

make it check for a smaller time difference would it just simply be putting a smaller number instead of the 1440.  i know this is an easy question but my mind has gone blank

Link to comment
https://forums.phpfreaks.com/topic/108678-is-my-code-correct/#findComment-557308
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.