<?php
session_start();
include "../includes/config.php";
include "../includes/secure.php";
$character = secure($_POST['character']);
$account = secure($_SESSION['user']);
check_inject();
global $resetlevel;
global $resettype;
global $resetpoints;
global $resetmoney;
global $maxresets;
$charq = mssql_query("Select clevel,resets,money,leveluppoint from Character where name='$character'");
$char = mssql_fetch_row($charq) or die(mssql_get_last_message());
$statusaq = mssql_query("select * from MEMB_STAT where memb___id='$account' and connectstat='1'");
$statusa = mssql_num_rows($statusaq);
if ($statusa != 0) {
$statusq = mssql_query("select GameIDC From AccountCharacter where Id='$account'");
$statusr = mssql_fetch_row($statusq);
}
$newresets = $char[1] + 1;
$newmoney = $char[2] - $resetmoney;
$newpoints = $newresets * $resetpoints;
if ($character == NULL) {
echo "Error: Please select Character !";
$error = 1;
} else {
if ($statusr[0] == $character) {
echo "Error: Character $character Is Online ! Please Log Off !";
$error = 1;
}
if ($char[0] < $resetlevel) {
echo "Error: Character $character haven't got $resetlevel to reset !";
$error = 1;
}
if ($newresets > $maxresets) {
echo "Error: Character $character have reached the maximum resets !";
$error = 1;
}
if ($error != 1) {
echo "<span class='online'>Character $character successfuly restarted !</span>";
$a = mssql_query("Update Character Set LevelUpPoint = '$newpoints', Money='$newmoney',clevel='1',Experience='0',Resets='$newresets', Strength='25', Dexterity='25', Vitality='25', Energy='25', LeaderShip='25' where name='$character'");
}
}
?>