<?
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="conta">
      <option>Selecione Login</option>
	  <?
	$q = mssql_query("Select * From MEMB_INFO WHERE bloc_code='1'");
	for($i=0;$i<mssql_num_rows($q);$i++){
	$a=mssql_fetch_array($q);
print("<option value=\"" .$a['memb___id']. "\">" .$a['memb___id']. "</option>"); }?>
      </select>  
  <br />
  <br />
  <input type="submit" name="Submit" value="Desbanir" OnClick="Carregar('desbanacc.php?passo=2&' +
      'conta=' + document.getElementById('conta').value ,'result_desban');"/>
<? } ?>
<?
if($_GET['passo']==2){
$conta	=	$_GET['conta'];
$ero="";
if(empty($_GET['conta'])){ $ero.="Determine a conta que ira ser desbloqueada!<br>"; $era=1; }
$check=mssql_fetch_array(mssql_query("select * From MEMB_INFO where memb___id='" .$conta. "'"));
if($check['bloc_code']==0) { $ero.="Esta conta nao esta bloqueada!"; $era=1; }
if($era==1){ die("<center>".$ero."</center>"); }else{
mssql_query("Update MEMB_INFO set bloc_code=0, diasdesbloc=0, databloc=NULL, motivobloc=NULL, blocpor=NULL WHERE memb___id='" .$conta. "'");
						die("A conta $conta foi Desbanida Com Sucesso!");
						}}
?>
	  <div align="center" id="result_desban"></div>
</div>
</body>
</html>