<?
include("config.php");
	header("Content-Type: text/html;  charset=iso-8859-1",true);
if(!$_SESSION['paineladm']){ include("logar.php"); die(); } ?>
<html>
<head>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<? if(empty($_GET['conta']) && empty($_GET[passo])){ ?><body>
<div align="center">Conta:	
    <select id="nome">
      <option>Selecione Char</option>
	  <?
	$q = mssql_query("Select * From Character WHERE CtlCode='1'");
	for($i=0;$i<mssql_num_rows($q);$i++){
	$a=mssql_fetch_array($q);
print("<option value=\"" .$a['Name']. "\">" .$a['Name']. "</option>"); }?>
      </select>  
  <br />
  <br />
  <input type="submit" name="Submit" value="Desbanir" OnClick="Carregar('desbanchar.php?passo=2&' +
      'nome=' + document.getElementById('nome').value ,'result_desban');"/>
<? } ?>
<?
if($_GET['passo']==2){
$nome	=	$_GET['nome'];
$ero="";
if(empty($_GET['nome'])){ $ero.="Determine o personagem que ira ser desbloqueado!<br>"; $era=1; }
$check=mssql_fetch_array(mssql_query("select * From Character where Name='" .$nome. "'"));
if($check['CtlCode']==0) { $ero.="Este personagem nao esta bloqueado!"; $era=1; }
if($era==1){ die("<center>".$ero."</center>"); }else{
mssql_query("Update Character set CtlCode=0, diasdesbloc=0, databloc=NULL, motivobloc=NULL, blocpor=NULL WHERE Name='" .$nome. "'");
						die("O Personagem $nome foi Desbanido Com Sucesso!");
						}}
?>
	  <div align="center" id="result_desban"></div>
</div>
</body>
</html>