I have a form that submits to abc.php which then calls db.php and db.php
then redirects to a new URL. I have session_start(); on all these files and
I'm registering the variables I need. It seems that the session dies or
gets lost on it's way through all the included files. I then tried to pass
the SID in the URL that the db.php file creates, but the SID is empty once
it gets here...though, there is a SID befoer then. Can sessions not be used
with multple include files? What could I be doing wrong? This is my first
forray into sessions...be gentle!
thanks!
Some code below, it's prettry straight forward. I still have cookies
enabled, as well. Do I need to disable cookies for the SID in URL method to
work?
index.php where they log in from
<?
session_start(); //first line of file
?>
<form method="POST" action="main.php">
<input type="hidden" value="lrlogin" name="form_action">
Username <input type="text" name="username" class="color"><br />
Password <input class="color" type="password" name="password"><br
/>
<input type="reset"> <input type="submit" value="Login">
code from main.php
<?
session_register();
require ("db.php");
if $form_action == "lrlogin"
{
get_user($username,$password);
}
?>
code from db.php
<?
session_start();
SQL to select user info from db
$access = $row[access_level]; //etc getting vars from db
session_register("username");
session_register("password");
session_register("access");
session_register("active");
header("Location:http://www.blah.com/index2.php?=".SID);
exit;
?>
index2.php code
<?
session_start();
print "Welcome $username";
?>
it only prints Welcome ...no username :(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]