Jump to content
php.lv forumi

Problema ar PHP kodu


Re_Boot

Recommended Posts

Es nez, bet manliekas ka shi problema ir nopietna un es nevaru izshtukot kapec mans skripts nedarbojas pareizi

<?php
if ($infos["form"] > '1') { 

$multiplierr = 1 / 5;
$frequencyy = 40 * $multiplierr;
$incrementt = 5 * $multiplierr;

$current_timee = time();  // get the current server time in second
$last_update_timee = mysql_result(mysql_query("SELECT ttime FROM users"), 0);
$time_differencee = $current_timee - $last_update_timee;
$hours_passedd = $time_differencee / $frequencyy;
$full_hours_passedd = floor($hours_passedd);
$remaining_secondss = $time_differencee % $frequencyy;
if($full_hours_passedd > 0){
 $new_update_timee = $current_timee + $remaining_secondss;
 $hp_increasee = $full_hours_passedd * $incrementt;

mysql_query("UPDATE `users` SET `energy` = CASE WHEN `energy` + $hp_increasee <= `energymax` THEN `energy` - $hp_increasee ELSE `energymax` END WHERE `energymax` < `energy`");

mysql_query("UPDATE `users` SET form`='1' END WHERE `energy` > `10`");



mysql_query("UPDATE users SET ttime = $new_update_timee");
}
}
?>

Sheit ir problema! Karo4 shim skriptam ir janjem visiem useriem kam ir FORM lielaks par 1, ir janjem energjija nost, un tik talu viss butu pareizi vinjs njem energjiju nost liidz apstajas pie 10, a pie 10 vinjam butu japarliek form atpakal uz 1, bet vinjsh ta vienkarshi iestregst! Ludzu palidzat!

Link to comment
Share on other sites

×
×
  • Create New...