<?
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 />
  </select>
  <br />
  <label>Total de golds: </label><input name="golds" type="text" id="golds" size="25" maxlength="5" />
  <br />
  <input type="submit" name="Submit" value="Executar" OnClick="Carregar(\'addgold.php?\' +
      \'login=\' + document.getElementById(\'login\').value +
      \'&golds=\' + document.getElementById(\'golds\').value,\'result_add\');"/>
  <br /><br><br><div align="Center" id="result_add"></div>'); }
	$login		=	$_GET['login'];
	$golds		=	$_GET['golds'];
  if(isset($_GET['login'])){
  $er=0;
  if(empty($login)){ $ero="Digite um Login!<br>"; $er=1; }
  if(empty($golds)){ $ero.="Digite quantos golds ele vai receber!<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 
							golds = '$golds',
							vencimento = getdate()+$golds
							WHERE memb___id = '$login'");
							print("<center>$login adicionado $golds golds com sucesso!</center>");
							 }
  }	
  
   ?>
</div>

</body>
</html>
