note 57829 added to function.session-register

From: Date: Sat, 15 Oct 2005 09:27:26 +0000
Subject: note 57829 added to function.session-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-97064@lists.php.net to get a copy of this message
//main.php <? session_start(); include("dbconnect.php"); if (isset($_POST['submitadmin'])) { $username=$_POST['aduser']; $pass=$_POST['adpass']; $query="select * from admin where username= '$username' and passwrd= '$pass' "; $res=mysql_query($query) or die (mysql_error()); $num = mysql_fetch_row($res); if ($num >= 1) { $_SESSION["namesess"]=$username; header("Location: feedbacklists.php"); } else { $msg="Invalid Username/Password"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> ...... // main.php ends //feedbacklists.php <? session_start(); include("dbconnect.php"); if (!isset($_SESSION["namesess"])) { header("Location: main.php"); } ?> <html> <head> .......... after verifying my username and password the browser is redirected to feedbacklists.php. but it is not happening as if the session is not set and the browser returning to main.php. what could be wrong in my code.pls help. ---- Manual Page -- http://www.php.net/manual/en/function.session-register.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57829 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57829&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57829&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97064) next »