am i just a session tracking idiot?
| From: | dan radom | Date: | Thu, 06 Jun 2002 17:31:00 +0000 |
| Subject: | am i just a session tracking idiot? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100968@lists.php.net to get a copy of this message | ||
I can't seem to get session tracking to work to save my life. The end result I'm after is
to store the value of the single column returned from this query .. SELECT user_id from users WHERE
user_name = '$user_name' AND user_password = '$user_password' .. for use
throughout the site. The current error I'm getting is "Warning: Failed to write session
data (files). Please verify that the current setting of session.save_path is correct (/tmp) in
Unknown on line 0" which is very strange, as session.save_path is set to /tmp, and tmp is
"drwxrwxrwt 2 root root". The code is listed below. Any suggestions are greatly
appreciated.
dan
<?
// if ($user_name) {
// class 'new uid' { var $row->user_id; };
// start_session();
// $abqSession = new abqnl;
// $abqSession->user_id = $uid;
// session_register("abqSession");
// }
if ($user_name) {
session_id($_GET['user_id']);
session_start();
$foo="$row->user_id";
$_SESSION["uid"] = $foo;
echo "$foo";
}
include '/storage/apache/htdocs/test.radom.org/.siteconf.php';
echo "<br><br>";
if (!$user_name) {
echo "<center>";
echo "<table cellspacing=10>";
echo "<tr>";
echo "<form method=post action=\"login.php\">";
echo "<td align=left>";
echo "user name";
echo "</td>";
echo "<td align=left>";
echo "<input size=12 name=\"user_name\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=left>";
echo "password";
echo "</td>";
echo "<td align=left>";
echo "<input type=\"password\" size=12
name=\"user_password\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "</td>";
echo "<td align=left>";
echo "<center>";
echo "<input type = \"submit\" value=\"submit\">";
echo "</center>";
echo "</td>";
echo "</form>";
echo "</tr>";
echo "</table>";
echo "</center>";
exit;
} else
$result = pg_exec ($database, "SELECT user_id from users WHERE user_name =
'$user_name' AND user_password = '$user_password'");
if (!$result) {
echo "query died\n";
exit;
}
if (pg_num_rows($result) == 0) {
echo "<center>you have entered an invalid user name and password combination. please
try again. new users may create an account from the sign up link above.</center>";
exit;
}
for ($i = pg_num_rows($result) - 1; $i >= 0; $i--) {
if(!($row = pg_fetch_object($result)))
continue;
}
echo "your user_id is ";
pg_close($database);
?>
</body>
</html>