Hello i am creating an authentification for using php and mysql. But unfortunatly, i can't able to get the result successfull i expected. here is the source code.
<?php
ob_start();
$host = "localhost";
$user = "dddddd";
$password = "";
$database = "dddddd";
$tbl_name="uuuuuu";
if(mysql_connect("$host", "$user", "$password")){
echo"fine";
}
else {
echo"cannot connect";
}
mysql_select_db("$database")or die("cannot select DB");
$utilisateur=$_POST['utilisateur'];
$pass=$_POST['pass'];
$utilisateur = stripslashes($utilisateur);
$pass = stripslashes($pass);
$utilisateur = mysql_real_escape_string($utilisateur);
$pass = mysql_real_escape_string($pass);
$query=mysql_query("SELECT * FROM $tbl_name WHERE utilisateur='$utilisateur' and pass='$pass'");
if($query){
$count=mysql_num_rows($query);
session_register("utilisateur");
session_register("pass");
header("location:login_success.php");
}
else {
echo "wrong username and password";
}
?>
login_success.php :
<?php
session_start();
if(!session_is_registered(utilisateur)){
header("location:portail.php");
}
else{
echo"Connexion failed";
}
?>
The error meesage: it displays the error message as below:
wrong username and password
from the if statement. normally i need to get login