This question already has an answer here:
I was trying to create a login page but my code does not work.How do I fix this? no error shown in the browser.Don't know where is the problem. Help me with this plz? I attached my code below.
I was trying to create a login page but my code does not work.How do I fix this? no error shown in the browser.Don't know where is the problem. Help me with this plz? I attached my code below.
<?
php include("connect.php");
session_start();
if(isset($_POST['login-button'])){
$username=$_POST['user_login'];
$password=$_POST['password_login'];
$result=mysqli_query( $mysqli, "SELECT * FROM user WHERE username='".$username."' and password='".$password."'");
if(mysqli_num_rows($result)==1){
while ($row=mysqli_fetch_assoc($result)) {
$dbusername=$row['user_login'];
$dbpassword=$row['password_login'];
}
if($username==$dbusername&&md5($password)==$dbpassword)
{
echo "you are logged in"
$_SESSION['user_login'] = $username;
}
else
die( "error1");
}
else
die ("errrrrrrrrrrror");}?>
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>login page</title>
<link rel="shortcut icon" href="themes/assets/ico/icon.ico">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<img src="back.jpg" height="619px" width="1366px">
<div class="wrapper">
<div class="container">
<h1>Welcome</h1>
<form class="form" method="POST" >
<input type= "text" name="user_login" placeholder="Username">
<input type="password" name="password_login" placeholder="Password">
<button type="submit" id="login-button">Start The Tour!
<!--<a href="home.html"-->
</button>
</form>
</div>
<ul class="bg-bubbles">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<script src='http://ift.tt/19puDaP'></script>
<script src="js/index.js"></script>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire