<? if ($_GET['akcja'] == 'edytuj'){ $newexp = $USER['exp'] + 3; checkNewLevel($newexp); $query = "UPDATE `users` SET `exp` = '$newexp' WHERE `UsID`='{$USER['UsID']}' "; } ?>
A to fragment functions.php
function level($exp) { if (($exp) < 6) {$poziom = 1;} elseif (($exp) < 21 && ($exp) >= 6) {$poziom = 2;} elseif (($exp) < 47 && ($exp) >= 21) {$poziom = 3;} elseif (($exp) < 82 && ($exp) >= 47) {$poziom = 4;} elseif (($exp) < 128 && ($exp) >= 82) {$poziom = 5;} elseif (($exp) < 183 && ($exp) >= 128) {$poziom = 6;} elseif (($exp) < 249 && ($exp) >= 183) {$poziom = 7;} elseif (($exp) < 324 && ($exp) >= 249) {$poziom = 8;} elseif (($exp) < 410 && ($exp) >= 324) {$poziom = 9;} elseif (($exp) < 505 && ($exp) >= 410) {$poziom = 10;} elseif (($exp) < 611 && ($exp) >= 505) {$poziom = 11;} elseif (($exp) < 726 && ($exp) >= 611) {$poziom = 12;} elseif (($exp) < 852 && ($exp) >= 726) {$poziom = 13;} elseif (($exp) < 987 && ($exp) >= 852) {$poziom = 14;} elseif (($exp) < 1133 && ($exp) >= 987) {$poziom = 15;} elseif (($exp) < 1288 && ($exp) >= 1133) {$poziom = 16;} elseif (($exp) < 1454 && ($exp) >= 1288) {$poziom = 17;} elseif (($exp) < 1629 && ($exp) >= 1454) {$poziom = 18;} elseif (($exp) < 1815 && ($exp) >= 1629) {$poziom = 19;} elseif (($exp) < 2010 && ($exp) >= 1815) {$poziom = 20;} elseif (($exp) < 2216 && ($exp) >= 2010) {$poziom = 21;} elseif (($exp) < 2431 && ($exp) >= 2216) {$poziom = 22;} elseif (($exp) < 2657 && ($exp) >= 2431) {$poziom = 23;} elseif (($exp) < 2892 && ($exp) >= 2657) {$poziom = 24;} elseif (($exp) < 3138 && ($exp) >= 2892) {$poziom = 25;} elseif (($exp) < 3393 && ($exp) >= 3138) {$poziom = 26;} elseif (($exp) < 3659 && ($exp) >= 3393) {$poziom = 27;} elseif (($exp) < 3934 && ($exp) >= 3659) {$poziom = 28;} elseif (($exp) < 4220 && ($exp) >= 3934) {$poziom = 29;} elseif (($exp) < 4515 && ($exp) >= 4220) {$poziom = 30;} elseif (($exp) < 4821 && ($exp) >= 4515) {$poziom = 31;} elseif (($exp) < 5136 && ($exp) >= 4821) {$poziom = 32;} elseif (($exp) < 5462 && ($exp) >= 5136) {$poziom = 33;} elseif (($exp) < 5797 && ($exp) >= 5462) {$poziom = 34;} elseif (($exp) < 6143 && ($exp) >= 5797) {$poziom = 35;} elseif (($exp) < 6498 && ($exp) >= 6143) {$poziom = 36;} elseif (($exp) < 6864 && ($exp) >= 6498) {$poziom = 37;} elseif (($exp) < 7239 && ($exp) >= 6864) {$poziom = 38;} elseif (($exp) < 7625 && ($exp) >= 7239) {$poziom = 39;} elseif (($exp) < 8020 && ($exp) >= 7625) {$poziom = 40;} elseif (($exp) < 8426 && ($exp) >= 8020) {$poziom = 41;} elseif (($exp) < 8841 && ($exp) >= 8426) {$poziom = 42;} elseif (($exp) < 9267 && ($exp) >= 8841) {$poziom = 43;} elseif (($exp) < 9702 && ($exp) >= 9267) {$poziom = 44;} elseif (($exp) < 10148 && ($exp) >= 9702) {$poziom = 45;} elseif (($exp) < 10603 && ($exp) >= 10148) {$poziom = 46;} elseif (($exp) < 11069 && ($exp) >= 10603) {$poziom = 47;} elseif (($exp) < 11544 && ($exp) >= 11069) {$poziom = 48;} elseif (($exp) < 12030 && ($exp) >= 11544) {$poziom = 49;} elseif (($exp) < 12525 && ($exp) >= 12030) {$poziom = 50;} elseif (($exp) < 13031 && ($exp) >= 12525) {$poziom = 51;} elseif (($exp) < 9999999999 && ($exp) >= 13031) {$poziom = 52;} return $poziom; } function checkNewLevel($exp) { $newLvl = level($exp); $oldLvL = $USER['level']; $um_point = $USER['Um_point']; if(($newLvl) > ($oldLvl)) { $um_point = $um_point +5; $query = "UPDATE `users` SET `level` = '$newLvl', `Um_point` = '$um_point' WHERE `UsID`='{$USER['UsID']}' "; return true; } else return false; }
I nie wiem czemu, aczkolwiek if w CheckNewLevel nie wiadomo czemu jest zawsze spełniania, co za tym idzie, um_point jest co klik o 5 wiecej,a ma być co wbicie lvl :/ Widzi ktoś w tym jakiś błąd?