Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <form action="login_controller.php" method="POST">
  2. <span class="user_label">Username: </span>
  3. <input class="username" type="text" name="username"><p>
  4. <span class="pass_label">Password: </span>
  5. <input class="password" type="password" name="password"><p>
  6. <input class="submit" type="submit" name="submit" value="Login">
  7. </form>
  8.  
  9. <?php
  10. require_once 'config/config.php';
  11.  
  12. if (isset($_POST['submit']) && $_POST['submit'] == 'Login') {
  13.  
  14. $username = $_POST['username'];
  15. $password = $_POST['password'];
  16.  
  17. if (!empty($username) && !empty($password)) {
  18.  
  19.  
  20. $users_count = $pdo->query("SELECT COUNT(username)
  21. FROM users
  22. WHERE username = {$username}");
  23. $count_all = $users_count->fetchColumn();
  24.  
  25. print_r($count_all);
  26.  
  27. }
  28.  
  29. else {
  30. header('Location: login.php');
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement