
    <? session_start();
include 'cnn.php';
include 'estilo.css';
@$login = $_SESSION['login'];
@$senha = $_SESSION['senha'];
if(!isset($_SESSION['login'])) { echo "Para acessar essa pagina é preciso esta logado!"; }
else{
$Gms = mssql_fetch_row(mssql_query("select contagm from memb_info where memb___id='".$login."'"));
if($Gms[0] <= 0) { echo "Você não faz parte da Administração"; }
else{ ?>
<html>

<head>
<SCRIPT language=JavaScript>
var message="";
function clickIE()
{
    if (document.all)
    {
        (message);
        return false;
    }
}
function clickNS(e)
{
    if(document.layers||(document.getElementById&&!document.all))
    {
        if (e.which==2||e.which==3)
        {
            (message);
            return false;
        }
    }
}
if (document.layers)
{
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
}
else
{
    document.onmouseup=clickNS;
    document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function("return false")
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
body {
	background-color: #B4B6C9;
}
-->
</style></head>

<body>
<table width="500" border="2" background="imagens/bg2.jpg">
  <tr>
    <th scope="col"><form name="banchar" method="post" action='ir.php?pagina=desbaniracc&action=desbanir'>
      <table width="520" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="30"><img src="imagens/mu.gif" alt="" width="30" height="30"></td>
          <td width="584" background="imagens/mu_back.png">&nbsp;&nbsp;&nbsp;<strong>DESBLOQUEAR CONTA</strong></td>
        </tr>
      </table>
      <br>
      <br>
      <table width="90%" border="0" align="left" cellpadding="0"
                                cellspacing="4" bordercolor="#0000FF">
        <tr>
          <td align="right" width="15%">Login</td>
          <td align="right" width="2%">:</td>
          <td align="left" width="83%"><label>
            <select name="acc" id="acc">
              <?
		$Accs = mssql_query("select Memb___id from MEMB_INFO WHERE bloc_code = '1'");
		for($p=0;$p<mssql_num_rows($Accs);$p++) {
		$Acc=mssql_fetch_row($Accs);
		echo '<option value='.$Acc[0].'>'.$Acc[0].'</option>';
		}
		?>
            </select>
            </label>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td align="left" width="83%"><input name="acao" type="radio" value="2">
            Desbloquear</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td width="15%" height="24">&nbsp;</td>
          <td width="2%">&nbsp;</td>
          <td width="83%"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">
            <input type="submit" name="admconfirma" value="Desbloquear">
            <input type="reset" name="admlimpa"  value="Limpa">
          </font> </td>
        </tr>
      </table>
    </form>
      <? } }?>
      <?PHP
if ($action == 'desbanir') {
$acc     = stripslashes($_POST['acc']);
$acao     = stripslashes($_POST['acao']);

if (empty($acc) || empty($acao))
{
    ?>
      <script>
    window.alert("ERRO: campos em branco.");
    window.location='ir.php?pagina=desbaniracc';
      </script>
      <?PHP
}
else
{
    $sql_acc_check = mssql_query("SELECT MEMB___ID FROM MEMB_INFO WHERE MEMB___ID='$acc'");
    $acc_check = mssql_num_rows($sql_acc_check);
    $bloc_by  = $admchar;
            if ($acc_check <= 0)
            {
                ?>
      <script>
                    window.alert("ERRO: Conta n&atilde;o existe.");
                    window.location='ir.php?pagina=desbaniracc';
                </script>
      <?PHP
                }
                else
                {
                    if ($acao == 2)
                    {
                     mssql_query("UPDATE MEMB_INFO SET 
							bloc_code=0,
							databloc='',
							diasdesbloc=0,
							motivobloc='',
							blocpor=''
							WHERE memb___id='$acc'");
	echo "<script>alert('Conta $acc desbloquiada com sucesso'); 
	location='javascript:history.back()'</script>";	

                        ?>
      <script>
                            window.alert("CHAR liberado com sucesso.");
                            window.location='ir.php?pagina=desbanir';
                        </script>
      <?PHP
                    }
                }
			}
        }
?></th>
  </tr>
</table>
</body>
</html>