|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-05-30 12:00 UTC] kalowsky@php.net
[2001-06-18 09:50 UTC] kalowsky@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 15:00:01 2025 UTC |
Basic script. The script uses sessions for login data. When you login, the password and login are stored as session variables. When you try anything else (without passing the login variables as arguments) the session variables are empty (completely) but the session ID still exists. The sessions work fine in Netscape Navigator. I did all the suggested things (turning off the cache, turning off AUTOCOMPLETE) to no avail. Here's the code: <? session_start(); error_reporting(E_ALL); while (list ($key, $val) = each ($HTTP_POST_VARS)) { echo "$key => $val<br>"; } # this is empty the second time... while (list ($key, $val) = each ($HTTP_SESSION_VARS)) { echo "$key => $val<br>"; } echo session_id(); include("config.php3"); if (!isset($login_message)) {$login_message="";} echo $logged_in."X".$action.$password; session_register("logged_in"); session_register("action"); if (isset($password)) $spassword=$password; if (isset($email)) $semail=$email; session_register("semail"); session_register("spassword"); if (!isset($logged_in)) { $logged_in=0;}; if (!isset($action)) {$action=1;}; echo "<HTML>"; $logged_in=checkInfo($spassword,$semail); if ($logged_in==0) $action=0; if ($action==3) $logged_in=0; if ($logged_in==1) { if ($action==1||!isset($action)||$action==0) include("mainmenu.php3"); else if ($action==2) include("mod.php3"); } else include("login.php3"); #page_close(); function connectDB() { global $dbname,$dbpass,$dbhost,$dblogin; $db=mysql_pconnect($dbhost,$dblogin,$dbpass); return $db; } function checkInfo($password,$email) { global $login_message; global $dbname; global $password,$email; $db=connectDB(); mysql_select_db($dbname,$db); $logged_in=0; $sql="SELECT * FROM Alumni where Email='$email' and Password='$password'"; $res=mysql_query($sql); echo $sql; if (!$res||mysql_num_rows($res)==0) { print mysql_error(); $login_message="Please check your password and login again."; } else { while ($myrow=mysql_fetch_array($res)) { if ($myrow["Approved"]==1) $logged_in=1; if ($myrow["Approved"]==0) { $login_message="Sorry, your account has not been approved yet."; $logged_in=2; } }