<?php
ob_start();
session_start();
$username = $_SESSION['member_username'];
$password = $_SESSION['member_password'];
$character = $_SESSION['character'];
include("./config.php");
include("../inc/sqlcfg.php");
secure($_POST['username']);
secure($_POST['password']);
secure($_POST['character']);
$md5 = mssql_query("SELECT * FROM misc WHERE id=4");
$md5 = mssql_fetch_array($md5);
$md5 = $md5['misc'];
if($md5 == 1)
{
$check = mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id='$username' AND memb__pwd=[dbo].[fn_md5]('$password','$username')");
}
else
{
$check = mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id='$username' AND memb__pwd='$password'");
}
function level_reset() {
{
$char = secure($_POST['chars']);
$char = str_replace("'" , "", $char);
$char = str_replace(";" , "", $char);
$xa = mssql_query("SELECT * FROM Character WHERE Name='$char'");
$res = mssql_fetch_array($xa);
$resmoney = '10000000'*($res['Resets']+1); // ako neiskate zena da e zena po broq resets iztriite prosto "*($res['Resets']+1)" i ste gotovi :)
$reslevel = '350';
$maxres = '50';
if($res['Class']==0){$respoints = '500';} //Dark Wizard
elseif($res['Class']==1){$respoints = '500';} //Soul Master
elseif($res['Class']==16){$respoints = '400';} //Dark Knigh
elseif($res['Class']==17){$respoints = '400';} //Blade Knight
elseif($res['Class']==32){$respoints = '450';} //Elf
elseif($res['Class']==33){$respoints = '450';} //Muse Elf
elseif($res['Class']==48){$respoints = '520';} //Magic Gladiator
global $web;
$username_check = mssql_query("SELECT Name FROM Character WHERE Name='$char' and AccountID = '$username'");
$username_checked = mssql_num_rows($username_check);
$online_check = mssql_query("SELECT * FROM MEMB_STAT WHERE memb___id='$username'");
$online_checked = mssql_fetch_array($online_check);
$hero = mssql_query("SELECT * FROM Character WHERE Name='$char'");
$row = mssql_fetch_array($hero);
if (empty($char)) { echo "<td><br><font size=2>Please select Character!</font><br><br></td>"; $error=1; }
elseif ($online_checked['ConnectStat'] != 0){ echo "<td><br><font size=2>Account is online, must be logged off!</font><br><br></td>"; $error=1; }
elseif ($row['Money'] < $resmoney) { echo "<td><br><font size=2><b>$char</b> need [<b>$resmoney</b>] zen to Reset!</font><br><br></td>"; $error=1; }
elseif ($row['cLevel'] < $reslevel){ echo "<td><br><font size=2><b>$char</b> need level [<b>$reslevel</b>] to Reset!</font><br><br></td>"; $error=1; }
elseif ($row['Resets'] >= $maxres) { echo "<td><br><font size=2>You have reach maximum resets! Cannot reset this hero!</font><br><br></td>"; $error=1; }
if($error !=1) {
$newstats = ($row['Resets']*$respoints) + $respoints;
$resetup = $row['Resets'] + (1);
$money = $row['Money'] - $resmoney;
$reset_points = "UPDATE character SET [LevelUpPoint]='$newstats',[Money]='$money',cLevel='1',[Strength]='25',[Dexterity]='25',[Vitality]='25',[Energy]='25',Experience='0',[MapNumber]='0',[MapPosX]='125',[MapPosY]='128',[Resets]='$resetup',[inventory]=CONVERT(varbinary(1080), null),[magiclist]= CONVERT(varbinary(180), null) WHERE Name='$char'";
$reset_results = mssql_query($reset_points);
echo "<td><br><font size=2><b>$char</b> have [<b>$newstats</b>] level up points!</font><br><br></td>";
}
}
}
?>