$time_diff = time() - $sent;

$time_diff = intval($time_diff / 60);

if($sent_mail < 30) {

// in here is a page built will php which contains its own if statements

}elseif ($time_dif >= 1) {

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

i want the code to check if the messages sent is greater than 30 if it is not it displays the code from the page. this part works fine.

the elseif statement should check if the time passed is greater than 1 minute since last message sent then it should truncate the tables and display the page stated which is the page that the code is on.

if the messages sent is less than 30 and i wait 5 minutes it still sends me to the limit.php page how can i get it to load the page the code is held on if the time passed is greater than 1 minute.

if you need to look at anymore of my code please ask and i will upload it.

Where is $sent_mail assigned a value?

$sent_mail is assigned a value from a mysql db here is the code

$query = "SELECT sent_messages FROM email_count"or die(mysql_error());
$results = mysql_query($query);
$arr = mysql_fetch_array($results);
$sent_mail = $arr[0];