login.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 login
  7. if (isset($_POST['username']) && isset($_POST['password'])) {
  8. login($_POST['username'], $_POST['password']);
  9. }
  10. # Process logout
  11. if (isset($_REQUEST['logout'])) {
  12. logout();
  13. }
  14. #=========================================================================================
  15. # Generic XHTML 1.1 header
  16. print <<<ENDOLA
  17. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  18. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  19. <html xmlns="http://www.w3.org/1999/xhtml">
  20. <head>
  21. <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  22. <title>UberZach TV - Login</title>
  23. <!-- Default JQuery -->
  24. <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  25. <!-- Provide # support in JQuery-mobile autodividers -->
  26. <!-- Must be loaded before JQuery-mobile -->
  27. <script>
  28. $( document ).on( "mobileinit", function() {
  29. $.mobile.listview.prototype.options.autodividersSelector = function( elt ) {
  30. var text = $.trim( elt.text() ) || null;
  31. if ( !text ) {
  32. return null;
  33. }
  34. if ( !isNaN(parseFloat(text)) ) {
  35. return "#";
  36. } else {
  37. text = text.slice( 0, 1 ).toUpperCase();
  38. return text;
  39. }
  40. };
  41. });
  42. </script>
  43. <!-- Default JQuery-mobile -->
  44. <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
  45. <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
  46. <!-- Custom code for the linkbar -->
  47. <script src="autodividers-linkbar.js"></script>
  48. <link rel="stylesheet" href="autodividers-linkbar.css">
  49. </head>
  50. <body>
  51. ENDOLA;
  52. $url = $_SERVER['PHP_SELF'];
  53. if (isset($_GET['dest'])) {
  54. $url .= '?dest=' . urlencode($_GET['dest']);
  55. }
  56. print <<<ENDOLA
  57. <div style="width: 50%; margin-left: auto; margin-right: auto;">
  58. <form action="${url}" method="post" data-ajax="false">
  59. <p>
  60. <label>Username: <input type="text" name="username" /></label><br/>
  61. <label>Password: <input type="password" name="password" /></label><br/>
  62. </p>
  63. <p><input type="submit" name="login" value="Login" /></p>
  64. </form>
  65. </div>
  66. ENDOLA;
  67. # Generic XHTML 1.1 footer
  68. print <<<ENDOLA
  69. </body>
  70. </html>
  71. ENDOLA;
  72. ?>