Advertisement
Guest User

Untitled

a guest
Jun 13th, 2016
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if (isset($_POST['username'])) {
  5.  
  6. // Include the databas connection script
  7. include_once("dbconnect.php");
  8.  
  9. // Set the posted data from the form into local variables
  10. $usname = strip_tags($_POST['username']);
  11. $paswd = strip_tags($_POST['password']);
  12.  
  13. $usname = mysqli_real_escape_string($dbCon, $usname);
  14. $paswd = mysqli_real_escape_string($dbCon, $paswd);
  15.  
  16. $paswd = md5($paswd); // using md5 just for testing purposes
  17.  
  18. $row = $dbCon->query("SELECT username, password FROM users WHERE username = '".$usname."' AND password = '".$paswd."'LIMIT 1")->fetch_array(MYSQLI_BOTH);
  19. if(!isset($row)) {
  20. echo "<h2><center>הפרטים שהזנת הנם שגויים, אנא נסה שנית.
  21. <br />
  22. </center></h2>";
  23. header("Location: /");
  24. }else {
  25. $uid = $row[0];
  26. $dbUsname = $row[1];
  27. $dbPassword = $row[2];
  28. header("Location: site.php");
  29. }
  30.  
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement