<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';
@$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."'"));
?>
</head>

<body>
<div align="left"><strong>Votar No Hall Da Fama  
  <font color="#990000"><?=$nonemu?></font>
</strong></div>
<br>
<br>
<form name="form1" method="post" action="">
  <table width="95%" border="0" cellspacing="2" cellpadding="0">
    <tr>
      <td width="26%">Selecione o Personagem Para Voce Votar Nele: </td>
      <td width="74%"><label>
        <select name="char" id="char">
		<?
		$Chars = mssql_query("select name from character ");
		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="votar"></td>
    </tr>
  </table>
</form>
<br>
<a href="javascript:history.back(-1);">&lt;&lt; voltar
</a>
</body>
</html>
<? 
if($_POST['prossegue']) {
$char = $_POST['char'];
$pegadados = mssql_fetch_row(mssql_query("select clevel,money from character where name='".$char."'"));
$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{
// -- FREE
if($vip[0] == 0) {
	if($pegadados[0] < $levelfree) {
	echo "<script>alert('Você precisa esta no level $levelfree para resetar'); 
	location='javascript:history.back()'</script>";
	}
	elseif($pegadados[1] < $moneyfree) {
	echo "<script>alert('Você precisa ter $moneyfree de dinheiro para resetar'); 
	location='javascript:history.back()'</script>";
	}
	else{
	mssql_query("update character set
				voto=voto+1
				where name='".$char."'");
	echo "<script>alert('Voce Votou No $char Com Sucesso'); 
	location='javascript:history.back()'</script>";	
	}
}
// - VIP
if($vip[0] == 1) {
	if($pegadados[0] < $levelvip) {
	echo "<script>alert('Você precisa esta no level $levelvip para resetar'); 
	location='javascript:history.back()'</script>";
	}
	elseif($pegadados[1] < $moneyvip) {
	echo "<script>alert('Você precisa ter $moneyvip de dinheiro para resetar'); 
	location='javascript:history.back()'</script>";
	}
	else{
	mssql_query("update character set
				voto=voto+1
				where name='".$char."'");
	echo "<script>alert('Voce Votou No $char Com Sucesso'); 
	location='javascript:history.back()'</script>";	
	}
} }
} }
?>