<? session_start();
include 'cnn.php';
@$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 painelgm from memb_info where memb___id='".$login."'"));
if($Gms[0] <= 0) { echo "Voce nao faz parte da Administrao"; }
else{ ?>
<h1>Banir conta</h1>
<form name="banchar" method="post" action="">
<div class="quadros">
<label>Conta:</label>
<input name="acc" type="text" id="acc" class="forms" size="15" maxlength="15">
<label>Administrador:</label>
<input name="admchar" type="text" id="admchar" size="15" maxlength="15" class="submit">
<label>Motivo:</label>
<input name="reason" type="text" id="reason" maxlength="60" class="submit">
<label>Dias:</label>
<input name="tempo" type="text" id="tempo" maxlength="10" size="10" class="submit">
<label><input name="acao" type="radio" value="2"> Banir</label>
<br />
<br />
<input type="submit" name="prossegue" id="pressegue" value="Bloquear" class="submit">
</div>
</form>
    <? } }?>
    <?PHP
if($_POST['prossegue']) {
$acc     = stripslashes($_POST['acc']);
$acao     = stripslashes($_POST['acao']);
$reason = stripslashes($_POST['reason']);
$bloc_by = stripslashes($_POST['admchar']);
$diasbloc = stripslashes($_POST['tempo']);

if (empty($admchar) || empty($reason) || empty($diasbloc) || empty($acc) || empty($acao))
{
    ?>
    <script>
    window.alert("ERRO: campos em branco.");
    window.location='index.php?go=baniracc';
    </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: ACC no existe.");
                    window.location='?go=painel/baniracc';
                </script>
    <?PHP
                }
                else
                {
                    if ($acao == 2)
                    {
                     mssql_query("UPDATE MEMB_INFO SET 
							bloc_code=1,
							databloc=getdate(),
							diasdesbloc=$diasbloc,
							motivobloc='$reason',
							blocpor='$admchar'
							WHERE memb___id='$acc'
						");
	echo "<script>alert('Conta $acc bloquiada com sucesso'); 
	location='javascript:history.back()'</script>";	

                        ?>
    <?PHP
                    }
              }
         }
    }
?>
<input type="hidden" name="data" id="data">
</form>