Every once in a while you get an error that is good at hiding from you. Was wondering if you guys could lend me a set of eyes to find it.
Im getting this error upon logging in:
<b>Warning: Cannot send session cache limiter - headers already sent (output started at e:\webfiles\www\demo\user_auth_fns.php:97) in e:\webfiles\www\demo\main_menu.php on line 3</b>
Line 3 on the main_menu.php is the standard session_start() function.
Here is the user_auth_fns.php file that the error is comming from, but I cant find it.:
<?php
function register($firstname, $lastname, $username, $password, $email, $ssn, $rights)
{
$password = md5($password);
$date = date("n.j.Y");
$conn = db_conn();
if(!$conn)
return "Could not connect to the database - please try again later.";
$result = mysql_query("select * from users where username='$username'");
if(!$result)
return "Could not contact database.";
if(mysql_num_rows($result)>0)
return "That username has been taken - please go back and choose and alternate username.";
$result = mysql_query("insert into users
(userid, firstname, lastname, username, password, email, ssn, rights)values
('0', '$firstname', '$lastname', '$username', '$password', '$email', '$ssn', '$rights')");
if (!$result)
return "Could not register your account - please try again later.";
return true;
}
function register_contact($firstname, $lastname, $company, $email, $homephone, $workphone, $cellphone, $address, $city, $state, $zip, $comments)
{
$date = date("n.j.Y");
$conn = db_conn();
if(!$conn)
return "Could not connect to the database, please try again later.";
$sql = "insert into contacts
(contactid, firstname, lastname, company, email, homephone, workphone, cellphone, address, city, state, zip, comments)
values
('0', '$firstname', '$lastname', '$company', '$email', '$homephone', '$workphone', '$cellphone', '$address', '$city', '$state', '$zip', '$comments')";
$result = mysql_query($sql, $conn);
if (!$result)
return "Could not register this contact with the database, please try again later.";
return true;
}
function login($username, $password)
{
$conn = db_conn();
$password = md5($password);
if (!$conn)
return 0;
$result = mysql_query("select * from users where username='$username' and password='$password'");
if (!$result)
return 0;
if (mysql_num_rows($result)>0)
return 1;
else
return 0;
}
function check_valid_user()
{
global $valid_user;
if (session_is_registered("valid_user"))
{
echo "Welcome to the Database <b><font color=\"red\">$valid_user</font></b>.<br>";
echo date("(D) M, j Y");
echo "<hr><br>";
}
else
{
do_html_heading("ERROR:");
echo "You are not logged in.<br>";
do_html_url("index.php", "Login");
do_html_footer();
exit;
}
}
function get_rights($valid_user)
{
$conn = db_conn();
$result = mysql_query("select rights from users where username='$valid_user'");
$rights = mysql_result($result, 0, 0);
{
if($rights)
return "$rights";
}
}
function change_password($username, $old_password, $new_password, $ssn)
{
if (login($username, $old_password))
{
if (!($conn = db_conn()))
return false;
$sql = "update users set password = '$new_password' where username = '$username' and ssn = '$ssn'";
$result = mysql_query($sql, $conn);
if (!result)
return false;
else
return true;
}
else
return false;
}
?>
Anybody see anything amiss with it?
Thanks guys.