Welcome! Log In Create A New Profile

Advanced

portfolio codes

Posted by Rufus Satekge 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
portfolio codes
September 26, 2012 09:59AM
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'winking smiley;//connection details to the database in a connect.php page

$username = "";
$password = "";
$errorMessage = "";
$num_rows = 0;

if($_SERVER['REQUEST_METHOD'] == 'POST'winking smiley{
$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"winking smiley;
}
else {
$errorMessage = "Invalid Login";
session_start();
$_SESSION['login'] = '';
}
}
?>

<?php
?>
avatar
Mac
Re: portfolio codes
September 27, 2012 07:51AM
Firstly, use the formatted code button to post code as explained in the tut letter. Secondly, do not post all code.

quote_smart function is called but not defined
The error message is called before is is defined
Sorry, only registered users may post in this forum.

Click here to login