 <? session_start();
if(!isset($_SESSION['login'])) { echo "<div class=falsos>Para acessar essa pgina  preciso esta logado!</div>"; }
else{
$Gms = mssql_fetch_row(mssql_query("select painelgm from memb_info where memb___id='".$login."'"));
if($Gms[0] <= 0) { echo "<div class=falsos>Voce noa faz parte da administrao</div>"; }
else{ ?>
<html>

<head>
<link rel="stylesheet" type="text/css" href="ajax/exemplo.css" />
<link rel="stylesheet" type="text/css" href="ajax/m2br.dialog.css" />
<script type="text/javascript" src="ajax/jquery.js"></script>
<script type="text/javascript" src="ajax/jquery-ui.js" ></script>
<script type="text/javascript" src="ajax/m2br.dialog.js" ></script>
<script type="text/javascript" src="ajax/m2br.dialog.pack.js" ></script>
<script type="text/javascript">
    var alertaPadrao = function(titulo, msg, tipo, altura, largura) {
          $('body').append('<a href="#" id="alerta-padrao"></a>');
           $('#alerta-padrao').m2brDialog({
                draggable: true,
                texto: msg,
                tipo: tipo,
                titulo: titulo,
                altura: altura,
                largura: largura,
            botoes: {
                   1: {
                      label: 'Ok',
                      tipo: 'link',
          endereco: 'index.php?go=medalhas'         

                   }
                }                             
          });
          $('#alerta-padrao')
             .click()
             .remove();
         
    };

    </script>
<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>

<div id="nome_pagina">Premiar</div>
    <br>
          Para dar Medalha troque o "0" pelo n&uacute;mero de medalhas que voc&ecirc; vai dar,<BR>
          obs: os outro campos deixe como 0.

<?   	$VerificaChar = mssql_num_rows(mssql_query("select * from character where name='".$char."'"));
		 $Query = mssql_query("SELECT ourotop,pratatop,bronzetop,ouroduelo,prataduelo,bronzeduelo,ouroevento,prataevento,bronzeevento from Character Where Name = '$char'");
  for($i=0;$i<mssql_num_rows($Query);$i++) {
  $medalha = mssql_fetch_row($Query); } ?>
<br>
<br>
<br>
  
  
  
<form name="banchar" method="post" action="">
  <table width="100%" border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td class="pontos" style="border-top:1px dashed #CFCFCF;" width="63">CHAR:</td>
      <td style="border-bottom:1px dashed #CFCFCF; border-top:1px dashed #CFCFCF;" width="1039">
        <input type="text" name="char">
    </td>
    </tr>
    <tr>
         <td class="pontos" width="63">&nbsp;</td>
         <td style="border-bottom:1px dashed #CFCFCF;" width="1039">MEDALHAS TOP M.T</td>
      </tr>
    <tr bgcolor="#F9F9F9">
      <td class="pontos"><div align="center"><img src="imagens/ouro.gif" ></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="ourotop" type="text" class="forms"
                                            id="ourotop" size="2" maxlength="2" value="00"></td>
    </tr>
       
       <tr>
      <td class="pontos"><div align="center"><img src="imagens/prata.gif"></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="pratatop" type="text" class="forms"
                                            id="pratatop" size="2" maxlength="2" value="00"></td>
    </tr>
       
       <tr bgcolor="#F9F9F9">
      <td class="pontos"><div align="center"><img src="imagens/bronze.gif"></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="bronzetop" type="text" class="forms"
                                            id="bronzetop" size="2" maxlength="2" value="00"></td>
    </tr>
       
       
       
           <tr>
      <td class="pontos" width="63">&nbsp;</td>
       <td style="border-bottom:1px dashed #CFCFCF;" width="1039">MEDALHAS DUELO</td>
    </tr>
    <tr bgcolor="#F9F9F9">
      <td class="pontos"><div align="center"><img src="imagens/ouro.gif" ></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="ouroduelo" type="text" class="forms"
                                            id="ouroduelo" size="2" maxlength="2" value="00"></td>
    </tr>

       <tr>
      <td class="pontos"><div align="center"><img src="imagens/prata.gif"></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="prataduelo" type="text" class="forms"
                                            id="prataduelo" size="2" maxlength="2" value="00"></td>
    </tr>

       <tr bgcolor="#F9F9F9">
      <td class="pontos"><div align="center"><img src="imagens/bronze.gif"></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="bronzeduelo" type="text" class="forms"
                                            id="bronzeduelo" size="2" maxlength="2" value="00"></td>
    </tr>
       
       
       
             <tr>
      <td class="pontos" width="63">&nbsp;</td>
       <td style="border-bottom:1px dashed #CFCFCF;" width="1039">MEDALHAS EVENTO</td>
    </tr>
    <tr>
      <td class="pontos"><div align="center"><img src="imagens/ouro.gif" ></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="ouroevento" type="text" class="forms"
                                            id="ouroevento" size="2" maxlength="2" value="00"></td>
    </tr>

       <tr bgcolor="#F9F9F9">
      <td class="pontos"><div align="center"><img src="imagens/prata.gif"></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="prataevento" type="text" class="forms"
                                            id="prataevento" size="2" maxlength="2" value="00"></td>
    </tr>

       <tr>
      <td class="pontos"><div align="center"><img src="imagens/bronze.gif"></div></td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="bronzeevento" type="text" class="forms"
                                            id="bronzeevento" size="2" maxlength="2" value="00"></td>
    </tr>
       
       
       
       
        <tr bgcolor="#F9F9F9">
      <td class="pontos">&nbsp;</td>
      <td style="border-bottom:1px dashed #CFCFCF;"><input name="acao" type="radio" value="2" checked>
        Premiar</td>
      
    </tr>

    <tr>
      <td>&nbsp;</td>
      <td><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">
        <input type="submit" name="prossegue" id="prossegue" class="btn" value="Premiar">
      </font></td>
     
    </tr>
  </table>
  <? } }?>
  <?PHP
if($_POST['prossegue']) {
$char     = stripslashes($_POST['char']);

$ourotop     = stripslashes($_POST['ourotop']);
$pratatop     = stripslashes($_POST['pratatop']);
$bronzetop     = stripslashes($_POST['bronzetop']);
$ouroduelo     = stripslashes($_POST['ouroduelo']);
$prataduelo     = stripslashes($_POST['prataduelo']);
$bronzeduelo     = stripslashes($_POST['bronzeduelo']);
$ouroevento    = stripslashes($_POST['ouroevento']);
$prataevento     = stripslashes($_POST['prataevento']);
$bronzeevento     = stripslashes($_POST['bronzeevento']);

$acao     = stripslashes($_POST['acao']);


if (empty($ourotop) || empty($pratatop) || empty($bronzetop) || empty($ouroduelo) || empty($prataduelo) || empty($bronzeduelo) || empty($ouroevento) || empty($prataevento) || empty($bronzeevento) || empty($acao) || empty($char) )
{
  echo "<script type='text/javascript'>
         $(function(){
           alertaPadrao('erro:', 'Preencha todos os campos mesmo que for com 0', 'erro', 110, 250);
           });
       
       </script>";
}
else
{
    $sql_name_check = mssql_query("SELECT Name FROM Character WHERE Name='$char'");
    $name_check = mssql_num_rows($sql_name_check);
            if ($name_check <= 0)
            {
  echo "<script type='text/javascript'>
         $(function(){
           alertaPadrao('erro:', 'Char Invalido', 'erro', 110, 250);
           });
       
       </script>";
                }
                else
                {
                    if ($acao == 2)
                    {
                     mssql_query("UPDATE Character SET
                     
							     ourotop=$medalha[0]+$ourotop,
							     pratatop=$medalha[1]+$pratatop,
							     bronzetop=$medalha[2]+$bronzetop,
							     
							     ouroduelo=$medalha[3]+$ouroduelo,
							     prataduelo=$medalha[4]+$prataduelo,
							     bronzeduelo=$medalha[5]+$bronzeduelo,
							     
							     ouroevento=$medalha[6]+$ouroevento,
							     prataevento=$medalha[7]+$prataevento,
							     bronzeevento=$medalha[8]+$bronzeevento
							     
                                    WHERE Name='$char'");
	echo "<script>alert('$char premiado com sucesso');
	location='javascript:history.back()'</script>";	

                        ?>
  <?PHP
              }
         }
    }
}
?>
</form>
</blockquote>

</body> 
</html>
