<?
function tree_quest()
{
$character = secure($_POST['character']);
$account = secure($_SESSION['user']);
$charq = mssql_query("Select class from Character where name='$character'");
$char = mssql_fetch_row($charq);
$request = mssql_query("Select cLevel,Resets from Character where name='$character'");
$qqq = mssql_fetch_row($request);
if($char[0] == 1) {$newclass = 3; }
elseif ($char[0] == 17) {$newclass = 19; }
elseif ($char[0] == 33) {$newclass = 35; }
elseif ($char[0] == 48) {$newclass = 50; }
elseif ($char[0] == 64) {$newclass = 66; }
elseif ($char[0] == 96) {$newclass = 98; }
$resets = '5';
$levels = '400';
$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); }
if(empty($character)) { echo"<tr><td align='center' class='modules'><b>Error:</b> Please select Character !</td></tr>"; $error=1; }
else{
if($qqq[0] < $levels) { echo"<tr><td align='center' class='modules'><b>Error:</b>Before you complete 3rd quest, you need <b>$levels Level</b></td></tr>"; $error=1; }
if($qqq[1] < $resets) { echo"<tr><td align='center' class='modules'><b>Error:</b>Before you complete 3rd quest, you need <b>$resets Resets</b></td></tr>"; $error=1; }
if($statusr[0] == $character) { echo"<tr><td align='center' class='modules'><b>Error:</b> Character $character Is Online ! Please Log Off !</td></tr>"; $error=1; }
if($char[0] == 0 or $char[0] == 16 or $char[0] == 32 or $char[0] == 80) { echo"<tr><td align='center' class='modules'><b>Error:</b> Before you complete 3rd quest, you need to complete 2nd quest !</td></tr>"; $error=1; }
if($char[0] == 3 or $char[0] == 19 or $char[0] == 35 or $char[0] == 50 or $char[0] == 66 or $char[0] == 83 or $char[0] == 98) { echo"<tr><td align='center' class='modules'><b>Error:</b> You are completed 3rd quest !</td></tr>"; $error=1; }
if($error != 1)
{
echo"<tr><td align='center' class='modules'><span class='online'>3rd Quest is completed on character $character !</span></td></tr>";
$a = mssql_query("Update Character set class='$newclass' where name='$character'");
}}}
?>