Advertisement
Guest User

Untitled

a guest
Mar 15th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4.  
  5. <!DOCTYPE html>
  6. <html lang="en">
  7. <head>
  8. <meta charset="utf-8">
  9. <link rel="stylesheet" type="text/css" href="site.css">
  10. </head>
  11. <body>
  12. <div class="frame">
  13. <div class="headerf"></div>
  14. <div class="contentf">
  15. <h3>Incorrect user credentials.</h3>
  16. <?php
  17. include("info.inc.php");
  18. $comm=@mysql_connect(localhost,$username,$password);
  19. $rs=@mysql_select_db($database) or die( "Unable to select database");
  20.  
  21. // username and password sent from form
  22. $myusername=$_POST['myusername'];
  23. $mypassword=$_POST['mypassword'];
  24.  
  25. // To protect MySQL injection
  26. $myusername = stripslashes($myusername);
  27. $mypassword = stripslashes($mypassword);
  28. $myusername = mysql_real_escape_string($myusername);
  29. $mypassword = mysql_real_escape_string($mypassword);
  30. $sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
  31. $result=mysql_query($sql);
  32.  
  33. // Mysql_num_row is counting table row
  34. $count=mysql_num_rows($result);
  35.  
  36. // If result matched $myusername and $mypassword, table row must be 1 row
  37. if($count==1){
  38.  
  39. // Register $myusername, $mypassword and redirect to file "index.php"
  40. $_SESSION["username"] = $myusername;
  41. $_SESSION["password"] = $mypassword;
  42. header("location:../index.php");
  43. }
  44. else {
  45. echo "Please return to the log-in page.";
  46. }
  47. ?>
  48.  
  49. <form name="form" method="post" action="../login.php"><br>
  50. <td><input type="submit" name="Submit" value="Back"></td>
  51. </div>
  52. </div>
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement