Advertisement
Guest User

Untitled

a guest
May 10th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <style type="text/css">
  2. <!--
  3. body,td,th {
  4.     font-family: Arial;
  5.     color: #FFFFFF;
  6. }
  7. body {
  8.     background-color: #000000;
  9. }
  10. -->
  11. </style>
  12. <div align="center">
  13. <form method="post" name="login" id="login" action="login-test4.php">
  14. <div align="center">
  15.   <table width="354" height="43" border="1" align="center" cellpadding="0" cellspacing="1" bordercolor="#333333">
  16.     <tr>
  17.       <td width="135" height="18"><span class="style3">Username : </span></td>
  18.         <td width="210"><input name="username" type="text" class="textarea" id ="username" value="" size="35" maxlength="20" /></td>
  19.       </tr>
  20.     <tr>
  21.       <td height="22"><span class="style3">Password : </span></td>
  22.         <td><input name="password" type="password" class="textarea" id ="password" value="" size="35" maxlength="20" /></td>
  23.       </tr>
  24.   </table>
  25. </div>
  26. <p align="center">
  27. <input type="button" id="submit" name="groovybtn1" class="groovybutton" value="Log in">
  28. </form>
  29.  
  30. <?php
  31.  
  32. // connecting
  33. $con = mysql_connect("localhost", "151287", "mrwhite");
  34. mysql_select_db("151287") or die(mysql_error());
  35.  
  36. echo "<br /><br />Connected to Database succesfuly";
  37.  
  38. //starting session
  39.  
  40. if ( ($_POST['username'] != NULL) && ($_POST['password'] != NULL) )
  41. {
  42.  
  43. //getting name + pass for later
  44.  
  45. $name = $_POST['username'];
  46. $password = $_POST['password'];
  47.  
  48. // selecting data
  49. $sql = "SELECT * FROM members
  50. WHERE username='$name' AND user_password='$password'";
  51. $result = mysql_query($sql, $con) or die(mysql_error());
  52.  
  53. if (mysql_num_rows($result) == 1)
  54. {
  55. echo "Welcome $name !";
  56. }
  57. else
  58. {
  59. echo "Wrong username or password!";
  60. }
  61. }
  62. ?>
  63.  
  64. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement