Simple PHP api for SnipeIT app. Not maintained anymore; check out BinStack instead: https://source.netsyms.com/Business/BinStack and https://netsyms.biz/binstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

login.php 517B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Handles login requests, authentication, and session creation.
  4. */
  5. require 'required.php';
  6. // For lazy browser testing
  7. //$_POST = $_GET;
  8. $user = $_POST['user'];
  9. $pass = $_POST['pass'];
  10. if (is_empty($user)) {
  11. sendError("Missing username.");
  12. }
  13. if (is_empty($pass)) {
  14. sendError("Missing password.");
  15. }
  16. if (authenticate_user($user, $pass)) {
  17. $_SESSION['user'] = $user;
  18. $_SESSION['loggedin'] = true;
  19. sendOK("Login successful.");
  20. } else {
  21. sendError("Login incorrect, try again.");
  22. }