I have made a log in system which asks for email activation. It all works fine. However, there is no real 'spam' protection. When the user creates an account, it inserts a row with the column 'activated' = 'NO'.
I want to make it so that if the user hasn't activated their account with, let's say, 3 hours, it will delete the row from the MySQL database. I have made a cron job which runs the following every 30 mins.
<?php
ob_start();
include 'global.php';
ob_end_clean();
$check_times = (time() - ('-3 hours'));
$query = "SELECT * FROM users WHERE time<=$check_times and activated='NO'";
$result = mysql_query($query) or trigger_error(mysql_error().$query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$inactive_user = $row['username'];
echo $inactive_user;
echo "<br>";
echo $check_times;
?>
The 'global.php' is connecting to the database. The above code works but only for one row (IT ONLY RETURNS THE VALUE OF THE FIRST INSTANCE IT COMES ACROSS)
I have looked into 'Do While' and 'Loop Until' and whatever but don't know what to put in the brackets...Do While (//what do I put in here?)
At the moment, the code only echos out the instances but I will change that to delete