In rightcolumn.inc, I have a form to let users log in to the site. In
config.inc I have session code, and site wide variables (such as
$mysql_host, and $mysql_user). Here's the relavent part of rightcolumn.inc:
print "<table width=98% align=center border=0 cellpadding=1 cellspacing=0>
<tr><td align=center> </td></tr>
<tr><td align=center> </td></tr>
<tr><td align=center bgcolor=#eeeeee><font face=Arial
size=2><b>Login</b></font></td></tr>
<Tr><td align=center><form action=$PHP_SELF?login=yes method=POST><font
face=Arial size=2>Username:</font></td></tr>
<tr><td align=center><input type=text name=username size=10></td></tr>
<tr><td align=center><font face=Arial size=2>Password:</font></td></tr>
<tr><td align=center><input type=password name=password size=10></td></tr>
<tr><td align=center><input type=submit value=Login></form></td></tr>
<tr><td align=center>";
if (($login_error) && ($login == "yes")) {
print "$login_error";
}
print "</td></tr><tr><td align=center>";
if (!($HTTP_SESSION_VARS["username"])) {
print " ";
}
else {
print "<A href=$PHP_SELF?login=no><font face=Arial size=2
color=#000000>Logout</font></a>";
}
print "</td></tr></table>";
This for is submitted to $PHP_SELF. config.inc is included on EVERY page on
the site. Here's the relavent part of config.inc:
mysql_connect("$mysql_host","$mysql_user","$mysql_pass");
mysql_select_db("$mysql_db");
$sql = mysql_query("SELECT * FROM $mysql_user_table WHERE username =
'$username' AND password = '$password'");
$num = mysql_num_rows($sql);
if ($num < "1") {
$login_error = "<font face=Arial size=2>Wrong
username/password<br></font>";
}
else {
session_start();
session_register('username');
session_register('password');
print "<font face=Arial size=2 color=#ffffff>Level 5</font><br>";
print "$username";
}
Now, when I log in, $HTTP_SESSION_VARS["username"] and
$HTTP_SESSION_VARS["password"] are NOT accessable on $PHP_SELF, but they are
after I refresh $PHP_SELF...But then when I move to another page on the site
(with config.inc included @ the very top, before anything is sent to the
browser), the $HTTP_SESSION_VARS["username"] ($username) and
$HTTP_SESSION_VARS["password"] ($password) are lost.
Can anybody offer me any help? I've been trying to get this to work for 48
hours now. I've re written this thing sooo many times. I almost had it
once, but changed something and it stopped.
Thanks,
Tyler Longren
--
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]