So I am trying to use POST to login to my site, the login part works, but the POST part does not, any ideas?
here is Index.php:
<div id="SignIn" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Sign in to your account</h4>
</div>
<div class="modal-body">
<form action="login.php" method="post">
<input style="margin-bottom:10px" name="usename" type="text" placeholder="Username"><br>
<input type="password" name="password" placeholder="Password"><br>
<input style="margin-top:10px" type="submit" class="btn btn-default" value="Sign In"></input>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
and here is Login.php:
<?php
/*lorte køter*/
session_start();
require 'connect.inc.php';
if (isset($_POST['username'])&&isset($_POST['password'])) {
$Username = $_POST['username'];
$Password = $_POST['password'];
//$password_hash = md5($password);
if (!empty($username)&&!empty($password)){
$query = "SELECT `password`, `username` FROM `user` WHERE `username`='$uusername' AND `password`='$ppassword'";
if ($result = mysqli_query($con, $query)); {
$query_num_row = mysqli_num_rows($result);
if ($query_num_row==0){
echo 'k';
//header ('Location: Index.php');
} else if ($query_num_row==1) {
while($row = mysqli_fetch_assoc($result)) {
sleep(5);
echo 'NO!';
$_SESSION["username"] = $row['username'];
header ('Location: profile.php');
}
}
}
} else {
echo 'no';
header("Location: Index.php");
}
}
It looks like it should work, but it does not for some reason D: