0){ $timesincelastvisit = (time()-$lastcheck); $timesincelastvisitinhours = ($timesincelastvisit/60/60); $quantitytosubtract=($quantity*1000)-($timesincelastvisitinhours*$needsinahourtotal); $quantitytosubtract=$quantitytosubtract/1000; mysql_query('UPDATE wp_food_storage SET last_check='.time().', quantity='.$quantitytosubtract.' WHERE owner_id="'.$row3['ID'].'"') or die(mysql_error()); } $needsinaweek = ($needsinahourtotal*24*7)/1000; if($needsinaweek>$quantity && $mailsent==0){ echo 'SIIN SAADAN KASUTAJALE '.$row3['display_name'].' MEILI ('.$row3['user_email'].') KUNA NÄDALAS ON VAJA '.$needsinaweek.' kg, kuid kasutajal hetkel on '.$quantity.' kg
'; /*if($row3['user_email']!=''){ $mailTo = $row3['user_email']; $mailTo = str_replace(":", ",", $mailTo); $mailTo = str_replace(";", ",", $mailTo); $mailTo = str_replace("-", ",", $mailTo); $subject = 'Teie koera/koerte toiduvarud hakkavad lõppema!'; $message = 'Teie koera/koerte 7 päeva toiduvajadus on '.$needsinaweek.' kg, teie varudes on '.$quantity.' kg!'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From: info@remedium.ee' . "\r\n"; mail($mailTo, $subject, $message, $headers); }*/ $mailsent=1; } else { echo 'SIIN EI SAADA KASUTAJALE '.$row3['display_name'].' MEILI ('.$row3['user_email'].')
'; $mailsent=0; } } ?>