ohbutt69

login

Dec 11th, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.60 KB | None | 0 0
  1. <?php
  2. include("db.php");
  3. session_start();
  4. if($_SERVER["REQUEST_METHOD"] == "POST")
  5. {
  6. // username and password sent from Form
  7. $username=mysql_real_escape_string($_POST['username']);
  8. $password=mysql_real_escape_string($_POST['password']);
  9. $password=md5($password); // Encrypted Password
  10. $sql="SELECT id FROM users WHERE username='$username' and passcode='$password'";
  11. $result=mysql_query($sql);
  12. $row=mysql_fetch_array($result);
  13. $active=$row['active'];
  14. $count=mysql_num_rows($result);
  15.  
  16. // If result matched $username and $password, table row must be 1 row
  17. if($count==1)
  18. {
  19.  
  20. $_SESSION['login_user']=$myusername;
  21.     session_register("myusername");
  22. header("location: welcome.php");
  23. }
  24. else
  25. {
  26. $error="Your Login Name or Password is invalid";
  27. }
  28. }
  29. ?>
  30. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  31. <html xmlns="http://www.w3.org/1999/xhtml">
  32. <head>
  33. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  34. <title>Jon Holland - About Me</title>
  35. <link href="Style-Sheet.css" rel="stylesheet" type="text/css" />
  36.  
  37. </head>
  38. <body>
  39.     <div id="page-wrap">
  40.         <div id="inside">
  41.            
  42.             <div id="header">
  43.                 <h1>Jon Holland</h1>
  44. <div id="menu">
  45.             <ul id="navlist_ul">
  46.                 <li class="first"><a href="1-Main.html">About Me</a></li>
  47.                 <li><a href="2-Gaming.html">Gaming</a></li>
  48.                 <li><a href="3-FilmsBooks.html">Films & Books</a></li>
  49.                 <li><a href="4-Gallery.html">Gallery</a></li>
  50.                 <li><a href="5-ThingsIFindGoddamnHilarious.html">Things I Find Godamn Hilarious</a></li>
  51.                 <li><a href="membersonly.php">membersonly!</a>
  52.             </ul>
  53.         </div>
  54.                     </div>
  55.             </div>
  56.       <p>            <table width="250
  57.             " border="0" align="center" cellpadding="3" cellspacing="3" bgcolor="" id="register">
  58. <tr>
  59. <form name="login" method="post" action="login.php">
  60. <td>
  61. <table width="95%" border="0" cellpadding="3" cellspacing="3" bgcolor="#666666">
  62. <tr>
  63. <td colspan="3"><strong>Member Login </strong></td>
  64. </tr>
  65. <tr>
  66. <td width="78">Username</td>
  67. <td width="6">:</td>
  68. <td width="294"><input name="username" type="text"></td>
  69. </tr>
  70. <tr>
  71. <td>Password</td>
  72. <td>:</td>
  73. <td><input name="password" type="password"></td>
  74. </tr>
  75. <tr>
  76. <td>&nbsp;</td>
  77. <td>&nbsp;</td>
  78. <td><input type="submit"value="Login"> <a href="Register.html">Register</a></td>
  79. </tr>
  80. </table>
  81. </td>
  82. </form>
  83. </tr>
  84. </table></p>
  85.       <div style="clear: both;"></div>
  86.            
  87.             <div id="footer">
  88.                 <p>Footer stuff.</p>
  89.             </div>
  90.        
  91.         </div>
  92.        
  93.         <div style="clear: both;"></div>
  94.    
  95.     </div>
  96. </body>
  97. </html>
  98.  
  99.  
Advertisement
Add Comment
Please, Sign In to add comment