SESSION variables
Posted: Tue Oct 15, 2002 9:05 am
Ok, Im still trying to larn how to work with sessions and I have run into a few problems.
First off, I have session.autostart turned on and IM using HTTP_SESSION_VARS, but I dont think Im using them right, apparently.
I am trying to write a log-on script for my website, where users can register and log-on to use some of the features.
I have two different scripts, the first is the actual page where they register/log-on, the other has the log-on form.
This is the one with the log-on form.
The input(...)'s are functions that output input elements with set variables, but that is neither here nor there.
This is where it actually sets the user to being logged in after the various tests in users.php...
Now, up where it had the inputs to log-in, it should replace the inputs with just yoru user_name is your logged in. It doesnt. Am i not using HTTP_SESSION_VARS correctly? I dont get any errors, it gives me the Thank you for logging in message, but nothing on the other script.
Its probably just something very minor that I overlooked, but I read through the manual quite a few times and don't really see anything wrong.
Any help is greatly appreciated.
-TwinkiE
First off, I have session.autostart turned on and IM using HTTP_SESSION_VARS, but I dont think Im using them right, apparently.
I am trying to write a log-on script for my website, where users can register and log-on to use some of the features.
I have two different scripts, the first is the actual page where they register/log-on, the other has the log-on form.
This is the one with the log-on form.
Code: Select all
<?php
global $HTTP_SESSION_VARS;
if ($HTTP_SESSION_VARSї'logged_in'] == true)
{
echo "<b>".$HTTP_SESSION_VARSї'user_name']."</b>";
echo "<form action='users.php?logout=lo' method='post'>";
input("submit","submit", "Logout");
echo "</form>";
}
else
{
?>
<form action="users.php?ver_login=vl" method="post">
<?php input("text","user_name", "Username", 20, 20); ?>
<br>
<?php input("password","user_pass", "", 20, 20); ?>
<br>
<?php
input("submit","submit", "Login");
input("reset","reset", "Reset");
}
?>
?>This is where it actually sets the user to being logged in after the various tests in users.php...
Code: Select all
{
$query = "SELECT user_name, user_id from users where LCASE(user_name)='";
$query .= strtolower($user_name)."'";
$result = mysql_query($query);
if ($result)
{
global $HTTP_SESSION_VARS;
$row = mysql_fetch_assoc($result);
$HTTP_SESSION_VARSї'user_name'] = $rowї'user_name'];
$HTTP_SESSION_VARSї'user_id'] = $rowї'user_id'];
$HTTP_SESSION_VARSї'logged_in'] = true;
echo "<div class='title'>Logged In</div>\n";
echo "Thank You for Logging In.\n";
}
}Its probably just something very minor that I overlooked, but I read through the manual quite a few times and don't really see anything wrong.
Any help is greatly appreciated.
-TwinkiE