I figured it out using strtotime.
Code: Select all
$query = "SELECT date, ip FROM A_Database_Name";
$result = mysql_query($query);
while(list($date, $postedIP) = mysql_fetch_array($result))
{
//If the IP addresses match
if($postedIP == $ip)
{
$posted = strtotime($date);
$now = strtotime(date("Y-m-d H:i:s"));
$seconds = $now - $posted;
$hours = $seconds / 3600;
if($hours < 1)
{
$error .= "You must wait 1 hour before re posting.";
$continue = false;
break;
}
}
}