<?
include("config.php");
	header("Content-Type: text/html;  charset=iso-8859-1",true);
if(!$_SESSION['paineladm']){ include("logar.php"); die(); }
   if(!isset($_GET['login'])){
 print ('<label>Login: </label><input name="login" type="text" id="login" size="25" maxlength="10" />
  <br />
  <br />
  <label>Tipo de Vip: </label><select id="vip">
    <option>Tipo Vip</option>
    <option value="1">Gold</option>
    <option value="2">Plus</option>
  </select>
  <br />
  <label>Dias: </label><input name="creditos" type="text" id="creditos" size="25" maxlength="5" />
  <br />
  <input type="submit" name="Submit" value="Executar" OnClick="Carregar(\'addvip.php?\' +
      \'login=\' + document.getElementById(\'login\').value +
      \'&vip=\' + document.getElementById(\'vip\').value +
      \'&creditos=\' + document.getElementById(\'creditos\').value,\'result_add\');"/>
  <br /><br><br><div align="Center" id="result_add"></div>'); }
	$login		=	$_GET['login'];
	$tpvip		=	$_GET['vip'];
	$creditos		=	$_GET['creditos'];
  if(isset($_GET['login'])){
  $er=0;
  if(empty($login)){ $ero="Digite um Login!<br>"; $er=1; }
  if(empty($creditos)){ $ero.="Digite quantos dias de vip ele vai ser!<br>"; $er=1; }
  if(empty($tpvip)){ $ero.="Digite o tipo de vip!<br>"; $er=1; }
  $check=mssql_num_rows(mssql_query("select memb___id from MEMB_INFO where memb___id='" .$login . "'"));
  if($check<=0){ $ero.="Login Invlido<br>"; $er=1; }
  if($er==1){ die("<center>" .$ero. "</center>"); }
  if($er!=1){
  			mssql_query("UPDATE MEMB_INFO SET 
							vip = '$tpvip',
							creditos=getdate(),
							creditos = '$creditos',
							creditos = getdate()+$creditos
							WHERE memb___id = '$login'");
							print("<center>$login adicionado como ".vip($login)." por $creditos dias com sucesso!</center>");
							 }
  }	
  
   ?>
</div>

</body>
</html>
