I have a code where the user sends data to the database, this data include time. Im trying to set the script to prevent the user to send data only once every 30 minutes. Here is the code that I try but it doesnt work.
if($_SERVER['REQUEST_METHOD']=='POST'){
$username = $_POST['username'];
$points= $_POST['points'];
$date= $_POST['date'];
$data = "SELECT date FROM tracker WHERE (username ='$username' ORDER BY date DESC LIMIT 1)";
$data_result = $connect->query($data);
$re = $data_result->fetch_assoc();
if($re["date"] <= strtotime('-30 minute')){
echo '0';
}}