<html lang="pt">
<head>
<meta name="description" content="Lucas Thompson" />
<title>Mu Site - WEB</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<? session_start();
include 'cnn.php';
include 'estilo.css';
include 'configs/conf_extras.php';
include 'configs/conf_reset.php';
include 'configs/conf_opcoes.php';
@$login = $_SESSION['login'];
@$senha = $_SESSION['senha'];
if(!isset($_SESSION['login'])) { echo "Para acessar essa pagina é preciso esta logado!"; }
else{

 if($desbugarpontos == 0)
 {
	  $vip=mssql_fetch_row(mssql_query("select vip from memb_info where memb___id='".$login."'")); 
 }
 else 
 { 
		$vip[0] = 1; 
 }

if($vip[0] == 0 ) { echo "Para acessar essa pagina é preciso ser Vip Normal"; }
else{
?>
</head>

<body>
<table width="510" border="2" background="imagens/bg2.jpg">
  <tr>
    <th scope="col"><table width="510" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="30"><img src="imagens/mu.gif" alt="" width="30" height="30"></td>
        <td width="480" background="imagens/mu_back.png">&nbsp;&nbsp;&nbsp;<strong>Desbugar Pontos</strong></td>
      </tr>
    </table>
      <br>
      <br>
      <form name="form1" method="post" action="">
        <table width="95%" border="0" cellspacing="2" cellpadding="0">
          <tr>
            <td width="20%">Personagem:</td>
            <td width="80%"><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>
            </label></td>
          </tr>
          <tr>
            <td><label></label></td>
            <td><input name="prossegue" type="submit" class="submit" id="prossegue" value="DESBUGAR"></td>
          </tr>
        </table>
      </form>
      <br>
      <a href="javascript:history.back(-1);"><p align="left">&lt;&lt; voltar </a> </th>
  </tr>
</table>
</body>
</html>
<? 
if($_POST['prossegue']) {
$char=$_POST['char'];
$qbug  = mssql_query("select strength, dexterity, vitality, energy from character where name='".$char."' and accountid='".$login."'");
$rbug  = mssql_fetch_row($qbug);
$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('Char incorreto'); 
location='javascript:history.back()'</script>"; 
}
elseif($VerificaStatus[0] >= 1){
echo "<script>alert('Saia da conta'); 
location='javascript:history.back()'</script>";
}
else{
	$str=$rbug[0];
	$agi=$rbug[1];
	$vid=$rbug[2];
	$eng=$rbug[3];
	if($rbug[0] <= 0){$str='32000'; }
	if($rbug[1] <= 0){$agi='32000'; }
	if($rbug[2] <= 0){$vid='32000'; }
	if($rbug[3] <= 0){$eng='32000'; }
	if(($rbug[0] >= 1) && ($rbug[1] >= 1) && ($rbug[2] >= 1) && ($rbug[3] >= 1)){
	echo "<script>alert('Não tem nada de errado com $char'); 
	location='javascript:history.back()'</script>"; 
	}
	else{
		mssql_query("update character set strength='$str', 
		dexterity='".$agi."', 
		vitality='".$vid."', 
		energy='".$eng."' 
		where name='".$char."' 
		and accountid='".$login."'");  	
	die("<script>alert('Pontos concertados/desbugados com sucesso'); 
	location='javascript:history.back()'</script>");
		} }
}
} } ?>