error_reporting(E_ERROR | E_WARNING | E_PARSE);
$name=$_POST['name'];
$password=$_POST['password'];
if((!isset($name)||(!isset($password)))){
?>
Please log in
This page is secret.
username:
password:
}else{
$mysql=mysqli_connect('localhost','root','1234567');
if(!$mysql){
echo "Cannot connect to database.";
exit;
}
$selected=mysqli_select_db($mysql,'test');
if(!$selected){
echo"Cannot select database .";
exit;
}
$query="select count(*) from namepass where name='".$name."' and password='".$password."'";
$result=mysqli_query($mysql,$query);
if(!$result){
echo "cannot run query";
exit;
}
$row=mysqli_fetch_row($result);
print_r($row);echo"
";
$count=$row[0];
if($count>0){
echo "
Here it is !
";echo "
You are not authorized to use this resource.
";}else
{
echo "
Go away !
";echo "
You are not authorized to use this resource.
";}
}
?>