Advertisement
Niko454

Untitled

Apr 21st, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <html>
  5. <head>
  6. <style>
  7. #login
  8. {
  9.  
  10. position:absolute;
  11. top: 30%;
  12. bottom: 30%;
  13. left:30%;
  14. right:30%;
  15. margin: 0px auto;
  16. }
  17.  
  18. </style>
  19. </head>
  20. <body>
  21. <?php
  22.  
  23.  
  24. echo"<center>";
  25. echo"<div id=\"login\">";
  26.  
  27. echo"<form method=\"POST\" action=\"connectivity.php\">";
  28. echo"<b>Username</b> <input type =\"text\" name=\"username\">";
  29. echo"<br/><br/>";
  30. echo"<b>Password</b>&nbsp;<input type =\"password\" name=\"password\">";
  31. echo"<br/><br/>";
  32. echo"<input type=\"submit\" value=\"submit\">";
  33.  
  34. echo"</div>";
  35. echo"</center>";
  36. ?>
  37.  
  38. </body>
  39. </html>
  40.  
  41.  
  42.  
  43.  
  44.  
  45. <?php
  46. $username = $_POST['username'];
  47. $password = $_POST['password'];
  48. $host="localhost";
  49. $uname="user";
  50. $pword="";
  51. $db="z1760359";
  52. $conn=mysqli_connect($host,$uname,$pword,$db) or die("Oops something went wrong");
  53. session_start();
  54.  
  55. $query="Select firstName from member where userName='$username' AND password='$password'";
  56.  
  57. if(!empty($_POST['username']))
  58. {
  59. $query_first=mysqli_query($conn,$query) or die(" Querry not retrieved");
  60. //mysqli_error($query_first);
  61. $query_second=mysqli_fetch_assoc($query_first);
  62. $rows=mysqli_num_rows($query_second);
  63. if($rows ==1)
  64. {
  65. $_SESSION['user_name']=extract($query_second);
  66. echo"login successfull";
  67. sleep(3);
  68. header('Location:search.php');
  69. }
  70. else
  71. {
  72. echo"Incorrect Password or Username";
  73. }
  74.  
  75.  
  76. }
  77. else
  78. {
  79. echo"please enter the password or username";
  80.  
  81. }
  82.  
  83.  
  84. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement