|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-25 18:57 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Feb 04 06:00:01 2026 UTC |
Description: ------------ Session will not start without manual manipulation. I use session to ensure only authorized people are loged in to do back end processing. When anyone attems to logon it just kicks them back to the logon page even though there info is correct. So I point them to a different page with no redirection. Which should display there session info session_start(); echo $_SESSION['user']; echo $_SESSION['pass']; But nothing is displaied. If you click on the back button reinput the same logon credentials You go back to the page again and it will then work?????? So at this point I change the redirection of the logon page to point to were it should and it works fine until the next time I login and I have to repeat this again. Any idea? Reproduce code: --------------- session_start(); if (!$_SESSION['user'] || !$_SESSION['pass']) { header('Location: logon.php'); die(); } else { $db = mysql_connect('localhost', 'xxxxx', 'xxxx') or die("Couldn't connect to the database."); mysql_select_db('addissalsa') or die("Couldn't select the database"); $result = mysql_query("SELECT count FROM users WHERE password='$_SESSION[pass]' AND username='$_SESSION[user]'") or die("Couldn't query the user-database."); $num = mysql_result($result, 0); if (!$num) { header('Location: login.php'); die(); } } Expected result: ---------------- I expect that the session would start and that the rest of the code on the page would run but it is being redirect back to the logon.php from the if (!$_SESSION['user'] || !$_SESSION['pass']) { header('Location: logon.php'); die(); Actual result: -------------- redirected to logon.php