So i made cron job, which takes users registration time and if x time have passed cron job then sends him a reminder.
All parts are working reminder are send each time the cron job run, and is sent once.
But code never adds extra seconds to the registration time, and is sent even that time haven't passed yet. So if i set to check if 10minutes has passed but i run cron job 1min each, all users gets messages after 1 second
Code is here:
$filter = $staticMessage->filter.' AND join_date_time+1800 >= "'.$time.'"';
Any ideas?
From coments
'$mysqli->query("INSERT INTO chat (s_id,r_id,time,reminder_time,message,fake,online_day,auto) VALUES ('".$randomSender->id."','".$userId."','".$time."','".$time."','".$message."',0,0,2)");
if($userLastaccess+3900 <= time()){
$mysqli->query("INSERT INTO staticmessages_sent (static_id,fake_id,r_id,answer,send_date,email_out) VALUES ('".$staticMessage->id."','".$randomSender->id."','".$userId."','0','".$time."',1)");
chatMailNotification($userId,$message,$randomSender->id);
} else {
$mysqli->query("INSERT INTO staticmessages_sent (static_id,fake_id,r_id,answer,send_date) VALUES ('".$staticMessage->id."','".$randomSender->id."','".$userId."','0','".$time."')");
}
if($userLastaccess+3600 <= time()){
$push['time'] = date("H:i", time());
$event = 'chat'.$userId.$randomSender->id;
$noti= 'notification'.$userId;
$push['id'] = $randomSender->id;
$push['type'] = 1;
$push['icon'] = profilePhoto($randomSender->id);
$push['name'] = $randomSender->username;
$push['photo'] = 0;
$push['action'] = 'message';
if(is_numeric($sm['plugins']['pusher']['id'])){
$sm['push']->trigger($sm['plugins']['pusher']['key'], $event, $push);
}'