I have a members area script were people can register login and all that but i can't get them to logout becoz i cann't delete the session
the login code it
and the logout code that don't work is
Can any one help me make this able to logout please
Thanks
the login code it
| Code: |
| <?php
include("config.php"); echo "<br>"; echo "<form method='post' action='?do=check'><table>"; echo "<tr><td>username:</td><td><input type='text' name='username'></td></tr>"; echo "<tr><td>password:</td><td><input type='password' name='password'></td></tr>"; echo "<tr><td></td><td><input type='submit' value='submit'></td></tr>"; echo "</table></form><br>"; if($_GET['do'] == 'check') { $_user_name = $_POST['username']; $_password = $_POST['password']; //check the login mysql_connect($host, $user_name, $password) or die('Could not connect: ' . mysql_error()); //select database mysql_select_db($database_name) or die('Could not select database'); $result = mysql_query("SELECT * FROM users WHERE username='$_user_name'") or die(mysql_error()); $row = mysql_fetch_array( $result ); if($row['username'] == '') { echo "<b>username or password is incorrect</b><br>"; } else { if($row['password'] == $_password) { $_SESSION['logged'] = "agk8gjf38834j2"; $_SESSION['user'] = $_user_name; header("location:" . $redirect_url); } else { echo "<b>username or password is incorrect</b><br>"; } } } ?> |
and the logout code that don't work is
| Code: |
| <?php
include("config.php"); $_SESSION['logged'] = ''; header("location:" . $_login_file); ?> |
Can any one help me make this able to logout please
