Guest User

Untitled

a guest
Oct 16th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1.  
  2. <?
  3. error_reporting(E_ALL);
  4. //Informatie database
  5. $host = "localhost";
  6. $username = "";
  7. $password = "";
  8. $db_name = "linh7219_shit";
  9. $tbl_name = "members";
  10. die('Debug 2')
  11.  
  12. //connect to database
  13. mysql_connect($host, $username, $password) or die("Can't connect");
  14. mysql_select_db($db_name) or die("Can't select database");
  15.  
  16. //login
  17. $myusername = mysql_real_escape_string($_POST['myusername']);
  18. $mypassword = mysql_real_escape_string($_POST['mypassword']);
  19.  
  20. $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword' LIMIT 1";
  21. $result = mysql_query($sql);
  22. die('Debug 1')
  23. $count = mysql_num_rows($result);
  24.  
  25. if($count==1) {
  26.   session_start();
  27.   $_SESSION['myusername'] = $myusername;
  28.   $_SESSION['mypassword'] = $mypassword;
  29.   header("Location: login_succes.php"); // Should this be success not succes?
  30.  
  31.   }
  32.   else {
  33.   echo "Wrong Username or Password";
  34.   }
  35.   ?>
Add Comment
Please, Sign In to add comment