function checkLogin($mail, $password) { parent::check(); $result = parent::$link->query("SELECT password from players where email like '" . $mail . "'"); if ($result != null) { $hash = Security::hash($password); if (strcmp($result->fetch_row()[0], $hash) == 0) { return true; } else { return false; } } else { return false; } }
function skillUp($skill, $id) { parent::check(); if (self::$allowed) { if (strcmp($skill, "health")) { $sql = "update fighters set skill_" . $skill . " = skill_" . $skill . "+ 3 where id = " . $id . ";"; if (parent::$link->query($sql) == FALSE) { echo "Error: " . parent::$link->error; return false; } } else { if (strcmp($skill, "strenght")) { $sql = "update fighters set skill_" . $skill . " = skill_" . $skill . "+1 where id = " . $id . ";"; if (parent::$link->query($sql) == FALSE) { echo "Error: " . parent::$link->error; return false; } } else { if (strcmp($skill, "sight")) { $sql = "update fighters set skill_" . $skill . " = skill_" . $skill . "+1 where id = " . $id . ";"; if (parent::$link->query($sql) == FALSE) { echo "Error: " . parent::$link->error; return false; } } } } self::$allowed = false; return true; } return false; }