<? 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{ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$titulosite?></title>
<style type="text/css">
<!--
.style1 {
	color: #CCCCCC;
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style3 {font-family: Georgia, "Times New Roman", Times, serif}
.style6 {color: #FFCC33; font-weight: bold; }
.style10 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #FFFFCC;
}
.style11 {color: #FFCC00}
.style17 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style18 {font-size: 12px}
-->
</style>
</head>

<body>
<table width="510" border="1" background="imagens/bg2.jpg">
  <tr>
    <th scope="col"><table width="510" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="30"><img src="imagens/mu.gif" alt="" width="30" height="30" /></td>
        <td width="480" background="imagens/mu_back.png">&nbsp;&nbsp;&nbsp;<strong>ALTERAR TEMPO</strong></td>
      </tr>
    </table>
      <br />
      <br />
      <form action='ir.php?pagina=alteratemp&amp;act=alterar' method='post' name='form1' id="form1">
        <br />
        <center>
        </center>
        <table width="90%" border="0" align="left" cellpadding="0"
                                cellspacing="4" bordercolor="#0000FF">
          <tr>
            <td align="right">Login</td>
            <td align="right">:</td>
            <td align="left"><select name="acc" id="acc">
                <?
		$Accs = mssql_query("select Memb___id from MEMB_INFO WHERE vip > '0'");
		for($p=0;$p<mssql_num_rows($Accs);$p++) {
		$Acc=mssql_fetch_row($Accs);
		echo '<option value='.$Acc[0].'>'.$Acc[0].'</option>';
		}
		?>
            </select></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" value="Alterar" name="admconfirma"  class="submit" />
              <input type="reset" name="admlimpa"  value="Limpa"  class="submit"/>
            </font></td>
          </tr>
        </table>
        <br />
        <div align='center'></div>
      </form>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p align="left"><br />
        <a href="ir.php?pagina=painel">&lt;&lt; voltar </a></p></th>
  </tr>
</table>
</body>
</html><? }}?>
<? if($_POST['admconfirma']) {
		$acc = $_POST['acc'];
		
		$dados_login_vip_q = mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id = '$acc'");
		$dados_login_vip = mssql_fetch_array($dados_login_vip_q);
		
		if ($dados_login_vip['vip'] > 0) {
			echo "<script>alert('Esta Account não é Vip.')</script>";
			echo "<script>window.location='ir.php?pagina=alteratemp'</script>";
		} if (empty($login)) {
			echo "<script>alert('Você Esqueceu Algum Campo em Branco.')</script>";
			echo "<script>window.location='ir.php?pagina=alteratemp'</script>";
		} if (mssql_num_rows($dados_login_vip_q) <= 0) {
			echo "<script>alert('Esta Account não Existe.')</script>";
			echo "<script>window.location='ir.php?pagina=alteratemp'</script>";
		}  else {
			echo "<form name='form1' method='post' action='ir.php?pagina=alteratemp&act=alterar1&acc=$acc&ta=$dados_login_vip[diasdevip]'>
			  <br><table width='63%' border='0' align='left' cellpadding='0'
                                cellspacing='4' bordercolor='#0000FF'>
				<tr>
				  <td width='22%' align=right>Login</td>
<td width='3%' align=right >:</td>
				  <td><input name='dias' class='input' type='text' id='dias' size='10' maxlength='6' value='$dados_login_vip[memb___id]' disabled  style='background:#444'></td>
			    </tr>
				<tr>
				  <td align=right>Data</td>
<td width='3%' align=right >:</td>
				  <td width='76%'>$dados_login_vip[datavip]</td>
				</tr>
				<tr>
				  <td align=right>Tempo</td>
<td width='3%' align=right >:</td>
				  <td width='76%'><input name='dias' class='input' type='text' id='dias' size='6' maxlength='6'  value='$dados_login_vip[diasdevip]'></td>
				</tr>
				<tr>
				  <td align=right>Vencimento</td>
<td width='3%' align=right >:</td>
				  <td width='76%'>$dados_login_vip[vencimento]</td>
				</tr>
				<tr>
				  <td align=left>&nbsp;</td>
<td width='3%'>&nbsp;</td>
  <td align=left>
    <input type='submit' value='Selecionar' name='admconfirma1'  class='submit' />
  </td>
			    </tr>
				</table>
			  <br><div align='center'></div>
</form>";
	}
}
	if ($act == 'alterar1') {
		$dias = $_POST["dias"];
		
		mssql_query("UPDATE MEMB_INFO SET 
						diasdevip = '$dias',
						vencimento=vencimento-$ta+$dias
						WHERE memb___id = '$acc'");
		echo "<div align='center'>Operação concluída.<br><br></div>
		<center>Os Vip $acc foi alterado com Sucesso.</center>";
}    ?>