mlowery
March 21st, 2004, 03:18
I am making a very simple password page which uses the user_name and password that a member who registered submitted to the mysql database.
<?
header("Cache-control: private");
$user_name = $POST_['user_name'];
$password = $POST_['password'];
$encpassword = md5($password);
$dbh=mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
$login = $dbs->select("SELECT * FROM $dbtbl[roster] WHERE screen_name = '$user_name' && password = '$encpassword'");
if(isset($login)) //login was succcesful
{
header("Location: http://mlowery.net/AC/");
}
else // login was not succesful
{
echo('Wrong User Name or Password');
};
?>
I get this error:
Fatal error: Call to a member function on a non-object in /home/mlowery/public_html/AC/login_processor.php on line 12
Really what I'm doing is making sure the user_name and password submitted on the form are equal to the ones in the data base. If they are, then it reloads to a new page. If not, an error page comes up. Can you please tell me what I am missing?
For some reason, the forum is inserting link tags into my php script on the header() tag. Disregard this. The problem is in this line:
$login = $dbs->select("SELECT * FROM $dbtbl[roster] WHERE screen_name = '$user_name' && password = '$encpassword'");
<?
header("Cache-control: private");
$user_name = $POST_['user_name'];
$password = $POST_['password'];
$encpassword = md5($password);
$dbh=mysql_connect ("localhost", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
$login = $dbs->select("SELECT * FROM $dbtbl[roster] WHERE screen_name = '$user_name' && password = '$encpassword'");
if(isset($login)) //login was succcesful
{
header("Location: http://mlowery.net/AC/");
}
else // login was not succesful
{
echo('Wrong User Name or Password');
};
?>
I get this error:
Fatal error: Call to a member function on a non-object in /home/mlowery/public_html/AC/login_processor.php on line 12
Really what I'm doing is making sure the user_name and password submitted on the form are equal to the ones in the data base. If they are, then it reloads to a new page. If not, an error page comes up. Can you please tell me what I am missing?
For some reason, the forum is inserting link tags into my php script on the header() tag. Disregard this. The problem is in this line:
$login = $dbs->select("SELECT * FROM $dbtbl[roster] WHERE screen_name = '$user_name' && password = '$encpassword'");