<?
session_start();
include 'cnn.php';
$login = $_SESSION['login'];
$senha = $_SESSION['senha'];
if(!isset($_SESSION['login'])) { echo "Para acessar essa pagina é preciso esta logado!"; }
else{
$vip=mssql_fetch_row(mssql_query("select vip from memb_info where memb___id='".$login."'"));
if($vip[0] == 0) { echo "<strong>Para acessar essa pagina é preciso ser Silver Vip</strong>"; }
else{
?>
<h1>Resetar Invent&oacute;rio</h1>
<form name="form1" method="post" action="">
<div class="quadros">
<label>Personagem:</label>
<select name="char" id="char">
<?
$Chars = mssql_query("select name from character where accountid='".$login."'");
for($p=0;$p<mssql_num_rows($Chars);$p++) {
$Char=mssql_fetch_row($Chars);
echo '<option value='.$Char[0].'>'.$Char[0].'</option>';
}
?>
</select>
<br />
<br />
<input name="prossegue" type="submit" class="submit" id="prossegue" value="Resetar">
</div>
</form>
<? 
if($_POST['prossegue']) {
$char = $_POST['char'];
$vip=mssql_fetch_row(mssql_query("select vip from MEMB_INFO where memb___id='".$login."'"));
$VerificaStatus = mssql_fetch_row(mssql_query("select ConnectStat from MEMB_STAT where memb___id='".$login."'"));
$VerificaChar = mssql_num_rows(mssql_query("select Name from Character where Name='".$char."' and AccountID='".$login."'"));
if($VerificaChar <= 0) { 
echo "<script>alert('Personagem incorreto'); 
location='javascript:history.back()'</script>"; 
}
elseif($VerificaStatus['0'] >= 1){
echo "<script>alert('Desconecte a conta'); 
location='javascript:history.back()'</script>";
}
else{
	if($vip['0'] <= 1) {
	echo "<script>alert('Você não é Silver Vip'); 
	location='javascript:history.back()'</script>";
	}
	else{
	mssql_query("UPDATE Character SET 
												Inventory=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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