Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. // I always put the DB connection at the top of the page, and often put it in a seperate file and include it
  3. $con = mysql_connect("localhost","bam_Admin","[pass]");
  4. mysql_select_db("bam_example");
  5. if (!$con) {
  6. die(' Error: ' . mysql_error());
  7. }
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11. if($username || $password || $_POST['submit']) {
  12.  
  13. $es_username = mysql_real_escape_string($username);
  14. $es_password = mysql_real_escape_string($password);
  15.  
  16. $check_login = mysql_query("SELECT * FROM `Log` WHERE `username` = '".$es_username."' AND `password` = '".$es_password."'");
  17. if(mysql_num_rows($check_login) == 0){
  18. echo "Fail x.X";
  19. }else{
  20. echo "Win";
  21. }
  22. }
  23.  
  24. ?>
  25.  
  26. <form method="post" action="login.php?F=login">
  27. <input type='text' name='username' value='User' />
  28. <input type='password' name='password' value='Password' />
  29. <input type='submit' name='submit' value='Login' />
  30. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement