Skip to content

Commit

Permalink
Fixed login error
Browse files Browse the repository at this point in the history
-due to md5 strange behaviour
  • Loading branch information
hiimdoublej committed May 29, 2016
1 parent e46b90b commit 9066a6c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@
}
if(isset($_POST['btn-login']))
{
var_dump($_POST);
$email = $conn->quote($_POST['email']);
$upass = $conn->quote($_POST['pass']);
$upass = md5($_POST['pass']);
$sql = "SELECT * FROM users WHERE email=$email";
$res=$conn->query($sql);
$row=$res->fetch(PDO::FETCH_BOTH);
if($row['password']==md5($upass))
var_dump($row);
var_dump($upass);
if($row['password']==$upass)
{
$_SESSION['user'] = $row['user_id'];
?>
<script>alert('Login successful');</script>
<?php
header("Location:home.php");
}
else
Expand Down

0 comments on commit 9066a6c

Please sign in to comment.