kev wood Posted June 4, 2008 Share Posted June 4, 2008 how can i get this code to check if only one minute has passed. $time_diff = time() - $sent; $time_diff = intval($time_diff / 60); $time_dif >= 1440 Link to comment https://forums.phpfreaks.com/topic/108689-need-help/ Share on other sites More sharing options...
kev wood Posted June 4, 2008 Author Share Posted June 4, 2008 at the moment this code when it is all together checks to see if 24 hours as passed and that is what the 1400 is. this is how many minutes are in a day. would it be as simple as just putting in a 1 for it to check if 1 minute as passed. Link to comment https://forums.phpfreaks.com/topic/108689-need-help/#findComment-557367 Share on other sites More sharing options...
craygo Posted June 4, 2008 Share Posted June 4, 2008 try this <?php $time_diff = time() - $sent; $check = $time_diff >= 60 ? TRUE : FALSE; if($check){ echo "one minute has passed"; } else { echo "One minutes has not passed"; } ?> Ray Link to comment https://forums.phpfreaks.com/topic/108689-need-help/#findComment-557375 Share on other sites More sharing options...
kev wood Posted June 4, 2008 Author Share Posted June 4, 2008 the part of the code that you have changed needs to remain the same as i think that section is working all i need to know is how to make it evaluate if a minute has passed at the minute all the code when it is together looks like this $query = "SELECT sent_messages FROM email_count"or die(mysql_error()); $results = mysql_query($query); $arr = mysql_fetch_array($results); $sent_mail = $arr[0]; $query = "SELECT last_sent FROM time"or die(mysql_error()); $results = mysql_query($query); $arr = mysql_fetch_array($results); $sent = $arr[0]; $time_diff = time() - $sent; $time_diff = intval($time_diff / 60); if($sent_mail < 30) { // the page i want the user to go to if the count is less than 200 and specified time has passed }elseif ($time_dif >= 1400) // this is the line of code i want to change to a minute. it evaluates if 24 hours has passed with this number { 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. } the code works if the count is less than 200 it sends the user to the page i want and if it over it sends them to the page i want. i now need to test the code so i can see if works if the time stated has passed. but i cannot get this to work as of yet Link to comment https://forums.phpfreaks.com/topic/108689-need-help/#findComment-557387 Share on other sites More sharing options...
kev wood Posted June 4, 2008 Author Share Posted June 4, 2008 i am using this code to keep the user on the page that the code is held on. will this just load this page up if the allocated time has passed. echo '<META HTTP-EQUIV="Refresh" Content="0; URL=maillists.php">'; Link to comment https://forums.phpfreaks.com/topic/108689-need-help/#findComment-557411 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.