Hi Everyone.
Can some please assist me. I'm trying to create a login script. This is what I've done so far. This works if user's input is correct. But when the user input is incorrect I get a blank screen. I think my problem lies in the $SQLPASS statments.
Any help is greatly appreciated.
Code is below.
Regards
<?php
$dbhost="localhost";
$dbuser="****";
$dbpass="****";
$dbstore="****";
?>
<?php
//Retrieve Data from POST
$username = $_POST['username'];
$pass = $_POST['password'];
$username = stripslashes($username);
$password = stripslashes($pass);
?>
<?php
mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
mysql_select_db($dbstore)or die(mysql_error());
?>
<?php
$SQLPASS="SELECT * FROM logins where login_username='$username' and login_password='$password'";
$SQLRESULT=mysql_query($SQLPASS)or die(mysql_error());
$SQLROW=mysql_num_rows($SQLRESULT)or die(mysql_error());
?>
<?php
for($a=0; $a<$SQLROW; $a++){
$login_user=mysql_result($SQLRESULT, $a, 'login_username');
$login_pass=mysql_result($SQLRESULT, $a, 'login_password');
echo "".$login_user."<br>";
echo "".$login_pass."<br>";
}
?>
<?php
if(($username = $login_user) && ($password = $login_pass)){
//Continue to dashbaord
}else{
//Return to login screen
}
?>