Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2. $servername = "localhost:8889";
  3. $username = "root";
  4. $password = "root";
  5. $dbname = "users";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14.  
  15.  
  16. $username = $_POST['username'];
  17. $password = $_POST['password'];
  18.  
  19.  
  20. $sql = "SELECT count(*) as count FROM users where username = '.$username.' and password = '.$password.'";
  21.  
  22.  
  23.  
  24. if ($result = $conn->query,($sql)) {
  25.  
  26. var_dump($result);
  27.  
  28. string mysql_result ( resource $result , int $row [, mixed $field = 0 ] )
  29.  
  30.  
  31.  
  32.  
  33.  
  34. //look after a result if it find reuslt go to admin
  35.  
  36. header('Location: adminpanel.html');
  37.  
  38. } else {
  39. echo "Error: " . $sql . "<br>" . $conn->error;
  40. }
  41.  
  42. $conn->close();
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement