login.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?
  2. # Include the TV functions
  3. require_once 'includes/main.php';
  4. # Send our headers early
  5. header('Content-type: text/html; charset=utf-8');
  6. # Process logout
  7. if (isset($_REQUEST['logout'])) {
  8. logout();
  9. }
  10. # Process login
  11. if (isset($_POST['username']) && isset($_POST['password'])) {
  12. login($_POST['username'], $_POST['password']);
  13. }
  14. # Redirect if we're already authenticated
  15. if (authenticated()) {
  16. login_redirect();
  17. }
  18. #=========================================================================================
  19. printHeader('UberZach TV - Login');
  20. $url = $_SERVER['PHP_SELF'];
  21. if (isset($_GET['dest'])) {
  22. $url .= '?dest=' . urlencode($_GET['dest']);
  23. }
  24. print <<<ENDOLA
  25. <div style="width: 50%; margin-left: auto; margin-right: auto;">
  26. <form action="${url}" method="post" data-ajax="false">
  27. <p>
  28. <label>Username: <input type="text" name="username" /></label><br/>
  29. <label>Password: <input type="password" name="password" /></label><br/>
  30. </p>
  31. <p><input type="submit" name="login" value="Login" /></p>
  32. </form>
  33. </div>
  34. ENDOLA;
  35. printFooter();
  36. ?>