<? session_start();
include 'cnn.php';
@$login = $_SESSION['login'];
@$senha = $_SESSION['senha'];
if(!isset($_SESSION['login'])) { echo "<strong>Para acessar essa pagina é preciso esta logado</strong>"; }
else{
$vip=mssql_fetch_row(mssql_query("select vip from memb_info where memb___id='".$login."'"));
?>
<h1>Mudar Senha</h1>
<form name="form1" method="post" action="">
<div class="quadros">
<label>Nova Senha:</label>
<input name="nova" type="password" id="nova" class="submit" maxlength="10">
<br />
<br />
<input name="prossegue" type="submit" class="submit" id="prossegue" value="Mudar">
</div>
</form>
<? 
if($_POST['prossegue']) {
$nova = $_POST['nova'];
$VerificaStatus = mssql_fetch_row(mssql_query("select connectstat from memb_stat where memb___id='".$login."'"));
if($VerificaStatus[0] >= 1){
echo "<script>alert('Desconecte a conta'); 
location='javascript:history.back()'</script>";
}
else{
if(empty($nova)) {
echo "<script>alert('Digite uma nova senha'); 
	location='javascript:history.back()'</script>";	
}
else {
mssql_query("update memb_info set memb__pwd='".$nova."' where memb___id='".$login."'");
echo "<script>alert('Senha alterada para $nova'); 
	location='javascript:history.back()'</script>";	
} } }
} 

?>