Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2. include("db.php");
  3. session_start();
  4. if(isSet($_POST['username_log']) && isSet($_POST['password_log']))
  5. {
  6. // username and password sent from Form
  7.  
  8. $nick=(mysqli_real_escape_string($conn,$_POST['username_log']));
  9. $username=sha1(mysqli_real_escape_string($conn,$_POST['username_log']));
  10. $password=sha1(mysqli_real_escape_string($conn,$_POST['password_log']));
  11.  
  12. $result=mysqli_query($conn,"SELECT * FROM login_user WHERE username='$username' and password='$password'");
  13. $count=mysqli_num_rows($result);
  14.  
  15. $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
  16. // If result matched $myusername and $mypassword, table row must be 1 row
  17. if($count==1)
  18. {
  19. $_SESSION['login_user']=$row['username'];
  20. echo $row['username'];
  21. $_SESSION['nick_user']=$row['nick'];
  22. echo $row['username'];
  23.  
  24. }
  25.  
  26. }
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement