Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/12/2016, 21:11
silviosinger
 
Fecha de Ingreso: abril-2015
Mensajes: 7
Antigüedad: 9 años, 1 mes
Puntos: 0
Respuesta: sistema login no pasa a la sesion luego de ingresar datos

Ahora solo tengo otro problema despues de colocar el login entro a la sesion y luego al darle logout me desloduea pero no me vuelve a aparecer el login como podria hacer para q al darle el logout me regrese a la parte del login tengo el script asi

Cita:
<?
session_start();
global $maxstat;
$acc=secure($_SESSION['user']);
if(isset($_GET['logout'])){
unset($_SESSION['user']);
echo "<script>location.reload();</script>";
}
if(isset($_POST['login'])){
$account=secure($_POST['username']);
$password=secure($_POST['password']);
$login_check=mssql_num_rows(mssql_query("SELECT * FROM MEMB_INFO WHERE memb___id='$account' and memb__pwd='$password'"));
if($login_check != 1){
echo "<font color='red'><b>Invalid username or password</b></font><br>";
}
else{
$_SESSION['user'] = $account;
}
}
if(!isset($_SESSION['user'])){
?>
<form name="login" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%">&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>Login name:</td>
<td colspan="2"><input name="username" type="text" id="username" maxlength="10"><font color="#fff">This is your Login ID.</font></td>
</tr>
<tr>
<td>Password:</td>
<td colspan="2"><input name="password" type="password" id="password" maxlength="12"><font color="#fff">This is your password</font></td>
</tr>
<tr>
<td width="15%">&nbsp;</td>
<td width="15%"><input type="submit" class="submit" name="login" value="Login" /></td>
<td width="70%"><input type="reset" class="reset" name="reset" value="Reset" /></td>
</tr>
</table>
</form>
</br>
<?
}
else{
if(isset($_GET['user'])){
$account = secure($_SESSION['user']);
session_start();
if(isset($_GET['logout']));
unset($_SESSION['user']);

}


?>
<form method="post" action="">
You are logged as: <b><?=$account ?></b><br />
<input type="submit" name="logout" value="Logout" />
</form>
<form name="form1" method="post" action="">
<table align="center" width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td><font color="white">Name :</font></td>
<td><select name="character"></select> <font color="white">This is your Character's name.</font></td>
</tr>
<tr>
<td><font color="white">Strength :</td>
<td><input name="strength" type="text" id="strength" maxlength="5" size="8"><font color="white">Amount of points added to Strength</font></td>
</tr>
<tr>
<td><font color="white">Agility :</font></td>
<td><input name="dexterity" type="text" id="dexterity" maxlength="5" size="8"><font color="white">Amount of points added to Agility</font></td>
</tr>
<tr>
<td><font color="white">Vitality :</font></td>
<td><input name="vitality" type="text" id="vitality" maxlength="5" size="8"><font color="white">Amount of points added to Vitality</font></td>
</tr>
<tr>
<td><font color="white">Energy :</font></td>
<td><input name="energy" type="text" id="energy" maxlength="5" size="8"><font color="white">Amount of points added to Energy</font></td>
</tr>
<tr>
<td colspan="2" align="center">
<input class=button type="submit" name="add" value="Add stats"><input class=button type="reset" name="reset" value="Reset">
</td>
</tr>
</table>
</form></br>
<?php
}
?>