this code snippet is used to autheticate a user's id. however, it generates
errors pertaining to the script not being able to send headers with the
session data.
// function authenticate()
// {
// import variables to be read from form
import_request_variables("p", "s_");
// set variables to connect to database
$db_host = "localhost";
$db_user = "login_1";
$db_pass = "addUser";
$db_name = "jamison_id";
// connect to database
$connection = mysql_connect($db_host, $db_user, $db_pass) or
die ("Unable to connect!");
mysql_select_db($db_name);
$query = "SELECT id_num from login WHERE user = '$s_user_id'
AND passwd = '$s_passwd'";
$result = mysql_query($query, $connection) or die ("Error in
query: '$query' ." . mysql_error());
// if row exists -> user/pass combination is correct
if (mysql_num_rows($result) == 1)
{
$valid = 1;
}
else
{
print($s_user_id);
print($s_passwd);
}
// }
// $valid = authenticate($s_user_id, $s_passwd);
print($valid);
if ($valid == 1)
{
// initiate a session
session_start();
// register some session variables
// session_register("SESSION");
// including the username
// session_register("SESSION_UNAME");
// $SESSION_UNAME = $f_user;
}
?>
any help would be appreciated.
chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php