
    <? 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"></head>

<body>
<table width="510" border="0">
  <tr>
    <th height="241" scope="col">
<form name="banchar" method="post" action='ir.php?pagina=banir&act=e948553d7a9'>
    <table width="510" border="0" cellpadding="0" cellspacing="0" background="imagens/bg2.jpg">
      <tr>
        <td width="30"><img src="imagens/mu.gif" width="30" height="30"></td>
        <td width="480" background="imagens/mu_back.gif">&nbsp;&nbsp;&nbsp;<strong>BLOQUEAR CHAR</strong></td>
      </tr>
    </table>
    <table width="73%" border="0" align="left" cellpadding="0"
                                cellspacing="4" background="imagens/bg2.jpg">
      <tr>
        <td width="13%" align="right">Personagem</td>
        <td align="right" width="2%">&nbsp;</td>
        <td align="left" width="85%">
        <label>
        <select name="char" id="char">
          <?
		$Chars = mssql_query("select Name from Character WHERE CtlCode = '0'");
		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 width="13%" height="22" align="right">GM Char:&nbsp;</td>
<td align="right" width="2%">&nbsp;</td>
                                    <td align="left" width="85%">
                                        <input name="admchar" type="text" class="forms"
                                            id="admchar" size="15" maxlength="15">                                    </td>
                                </tr>
      <tr>
        <td height="22"><div align="right">Motivo:</div></td>
        <td height="22">&nbsp;</td>
        <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#008080">
          <input name="reason" type="text" id="reason" maxlength="20">
        </font></td>
      </tr><tr>
<td height="22"><div align="right">Dias:</div></td>
<td height="22">&nbsp;</td>
        <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#008080">
          <input name="tempo" type="text" id="tempo" maxlength="10" size="10">
        </font></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td height="22">&nbsp;</td>
        <td align="left" width="85%">
        <input name="acao" type="radio" value="2">
          Banir</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td width="13%">&nbsp;</td>
        <td width="2%">&nbsp;</td>
        <td width="85%"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">
          <input type="submit" name="admconfirma" value="Bloquear">
          <input type="reset" name="admlimpa"  value="Limpa">
        </font>       </td>
      </tr>
  </table>
</form><? } }?>
<?PHP
if ($act == 'e948553d7a9') {
$char     = stripslashes($_POST['char']);
$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($char) || empty($acao))
{
    ?>
    <script>
    window.alert("ERRO: campos em branco.");
    window.location='ir.php?pagina=banir';
    </script>
    <?PHP
}
else
{
    $sql_name_check = mssql_query("SELECT Name FROM Character WHERE Name='$char'");
    $name_check = mssql_num_rows($sql_name_check);
    $bloc_by  = $admchar;
            if ($name_check <= 0)
            {
                ?>
                <script>
                    window.alert("ERRO: CHAR não existe.");
                    window.location='ir.php?pagina=banir';
                </script>
                    <?PHP
                }
                else
                {
                    if ($acao == 2)
                    {
                     mssql_query("UPDATE Character SET
								 CtlCode = '1',
								 blocpor='$admchar',
								 databloc=getdate(),
								 motivobloc='$reason',
								 diasdesbloc='$diasbloc'
                                    WHERE Name='$char'");
	echo "<script>alert('$char bloquiado com sucesso'); 
	location='javascript:history.back()'</script>";	

                        ?>
                        
                        <?PHP
              }
         }
    }
}
?>
<br>
      <p align="left">&nbsp;</p>
      <p align="left">&nbsp;</p>
      <p align="left">&nbsp;</p>
      <p align="left">&nbsp;</p>
      <p align="left">&nbsp;</p>
      <a href="javascript:history.back(-1);"><p align="left">&lt;&lt; voltar </p>
      </a></th>
  </tr>
</table>
</body> 
</html>