Hello...Mac
I am experiencing a problem with the login page. Everytime I run the code I get the following errors:
php print $errorMessage variable undefined and Fetal error: Call to function quote_smart undefined
<?PHP print $errorMessage;?>
<?php
include('connect.php'
;//connection details to the database in a connect.php page
$username = "";
$password = "";
$errorMessage = "";
$num_rows = 0;
if($_SERVER['REQUEST_METHOD'] == 'POST'
{
$username = $_POST['username'];
$password = $_POST['password'];
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
if ($db) {
$username = quote_smart($username,$connection);
$password = quote_Smart($password,$connection);
}
else {
$errorMessage = "Error logging on";
}
$SQL = "SELECT * FROM user WHERE username = $username AND password = $password";
$result = mysql_query($SQL);
if($result){
}
else{
$errorMessage = "Error logging on";
}
$num_rows = mysql_num_rows($result);
if ($num_rows > 0) {
session_start();
$_SESSION['login'] = "1";
header ("Location: login.php"
;
}
else {
$errorMessage = "Invalid Login";
session_start();
$_SESSION['login'] = '';
}
}
?>
<?php
?>