Good day phpfreaks people! i'm a newbie in web programming and I encountered this problem.. I don't know how to fix it.. please help me.. this error prompts everytime i try logging in.. The registration for works but the login doesn't.. please help me.. this is my code where the error is..
$db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
mysql_select_db($mysql_database, $db);
$sql = "SELECT password, fullname, active FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysql_query($sql, $db);
if ($data = mysql_fetch_array($result))
{
if ($crypt_pass == $data['password'] && $data['active'] != 0)
{
$found = true;
$fullname = $data['fullname'];
}
}
mysql_close($db);
if($found == false)
{
header('Location: '.$error_page);
exit;
}
else
{
session_start();
$_SESSION['username'] = $_POST['username'];
$_SESSION['fullname'] = $fullname;
$rememberme = isset($_POST['rememberme']) ? true : false;
if ($rememberme)
{
setcookie('username', $_POST['username'], time() + 3600*24*30);
setcookie('password', $_POST['password'], time() + 3600*24*30);
}
header('Location: '.$success_page);
exit;
}
}
Thanks in advance for your help..
Gelo