<?php
include_once "../../site.class.php";
include_once $PATH_TO_CODE."/script/connect.php";
include_once $PATH_TO_CODE."/script/disconnect.php";
include_once $PATH_TO_CODE."/script/fonction.php";
$locStr = getGetPost("unlock", "");
$locPlayerId = getGetPost("playerId", "0");
$row = mysql_fetch_array(executer("SELECT unlockStr, isLock FROM player WHERE playerId=$locPlayerId"));
if($row) {
if($row[1] == 0) {
openSessionFailed("Account is already unlocked");
} else {
if($row[0] == $locStr) {
executer("UPDATE player SET isLock=0 WHERE playerId=$locPlayerId");
openSessionFailed("Account is now unlocked");
} else {
echo "unlock string is not correct, contact site administrator: ".Site::$SITE_ADMIN."<br/>";
}
}
} else {
echo "Account $locPlayerId didn't exist, contact site administrator: ".Site::$SITE_ADMIN."<br/>";
}
executer("COMMIT");
?>