Guest User

Untitled

a guest
Jan 20th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. <form action="index.php" method="post" id="myform">
  2. <tr>
  3. <td>User Name </td>
  4. <td><input type="text" name="text_username" placeholder="your username here" class="validate[required]"/></td>
  5. </tr>
  6. <tr>
  7. <td>Pass Word </td>
  8. <td><input type="password" name="text_password" placeholder="your password here" class="validate[required]" /></td>
  9. </tr>
  10. <?php
  11. $userPass = array();
  12. $userName = array();
  13. $userID = array();
  14. include ('include/connectdb.php');
  15. if(isset($_POST['tbn_submit'])){
  16. $query = mysql_query("SELECT * FROM tblusers");
  17. $username = $_POST['text_username'];
  18. $password = $_POST['text_password'];
  19.  
  20. while($value= mysql_fetch_array($query)){
  21. $userPass = $value['user_password'];
  22. $userName = $value['user_username'];
  23. $userID = $value['user_id'];
  24. if($username == $userName && $password == $userPass){
  25. header("location:DataInfo.php?uid=".$userID);
  26. }
  27. else if($username != $userName && $password == $userPass) {
  28. echo'<tr><td colspan="2"><center><b style="color:red;">Invalide username or password, please check again! </b></center></td></tr>';
  29. }
  30. }
  31. }
  32. ?>
  33. <tr>
  34. <td></td>
  35. <td><input type="submit" name="tbn_submit" class="btn btn-success" value="Login"/><input type="reset" class="btn btn-warning" value="Cancel"/></td>
  36. </tr>
  37. </form>
  38.  
  39. include ('include/connectdb.php');
  40. if(isset($_POST['tbn_submit'])){
  41. $username = $_POST['text_username'];
  42. $password = $_POST['text_password'];
  43. $query = mysql_query("SELECT * FROM tblusers WHERE username = $userName AND password = $userPass");
  44.  
  45. if(mysql_num_rows($query)){
  46. $user = mysql_fetch_assoc($query)
  47. header("location:DataInfo.php?uid=".$user['user_id']);
  48. } else {
  49. echo '<tr><td colspan="2"><center><b style="color:red;">Invalide username or password, please check again! </b></center></td></tr>';
  50. }
  51. }
  52.  
  53. SELECT * FROM tblusers WHERE username = *username* AND password = *password*
  54.  
  55. mysql_query("SELECT * FROM tblusers");
  56.  
  57. mysql_query("SELECT * FROM tblusers WHERE user_username = ".$_POST['text_username']);
Add Comment
Please, Sign In to add comment