I am writing a simple login script for my web based database. I want to use sessions to track the type of permissions the user has.
But i get errors...
Here is my code for the login page.
<?php
require("resources/inc/config.inc");
require("resources/inc/gen_functions.inc");
session_start();
if ($userName && $password)
{
db_connect(training2);
$sql = "SELECT * FROM login WHERE userName = '$userName' AND password = '$password'";
$results = @($sql);
if (mysql_num_rows($results) > 0)
{
$valid_user = $userName;
session_register("valid_user");
}
}
head("Training Database", "resources/style/default.css");
if (session_is_registered("valid_user"))
{
print("You are logged in as $valid_user <br/>\n
<a href=\"logout.php\">logout</a>\n
");
}
else
{
if (isset($userName))
{
print("Could not log you in.");
}
else
{
print("You are not logged in.");
}
print("
<div id=\"loginbox\">\n
<form name=\"loginForm\" method=\"post\" action=\"login.php\">\n
User Name:<br/>\n
<input type=\"text\" name=\"userName\" size=\"50\"><br/>\n\n
Password:<br/>\n
<input ltype=\"password\" name=\"password\" size=\"50\"><br/>\n\n
<input type=\"submit\" name=\"sub\" value=\"Login!\" class=\"submit\">\n
</form>\n
</div>\n
");
}
footer();
?>
I get the following errors:
Warning: open(d:\temp\sess_6570d3615e6f1ff6e5a98de7bed6165e, O_RDWR) failed: m (13) in D:\intranet\training2\login.php on line 6
Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (d:\temp) in Unknown on line 0
I have already changed my session.save_path and gave the IUSR read, write, execute, and delete permissions to the directory.
Umm... help!
Any ideas?
Thanks!
chadT