File: 0.01.1a/mobile/login.php (View as HTML)

  1: <?php
  2: /* -------------------------------------------------------------
  3: This file is part of FreeDESK
  4: 
  5: FreeDESK is (C) Copyright 2012 David Cutting
  6: 
  7: FreeDESK is free software: you can redistribute it and/or modify
  8: it under the terms of the GNU General Public License as published by
  9: the Free Software Foundation, either version 3 of the License, or
 10: (at your option) any later version.
 11: 
 12: FreeDESK is distributed in the hope that it will be useful,
 13: but WITHOUT ANY WARRANTY; without even the implied warranty of
 14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 15: GNU General Public License for more details.
 16: 
 17: You should have received a copy of the GNU General Public License
 18: along with FreeDESK.  If not, see www.gnu.org/licenses
 19: 
 20: For more information see www.purplepixie.org/freedesk/
 21: -------------------------------------------------------------- */
 22: if (isset($_REQUEST['username']))
 23: {
 24: 	ob_start();
 25: 	require("../core/FreeDESK.php");
 26: 	$DESK = new FreeDESK("../");
 27: 	$DESK->Start();
 28: 	ob_end_clean();
 29: 	if($DESK->ContextManager->Open(ContextType::User, "",
 30: 		$_REQUEST['username'], $_REQUEST['password']))
 31: 	{
 32: 		$sid=$DESK->ContextManager->Session->sid;
 33: 		header("Location: ./?sid=".$sid);
 34: 		exit();
 35: 	}
 36: 	else
 37: 	{
 38: 		header("Location: ./login.php?e=failed");
 39: 		exit();
 40: 	}
 41: }
 42: else if (isset($_REQUEST['logout']))
 43: {
 44: 	ob_start();
 45: 	require("../core/FreeDESK.php");
 46: 	$DESK = new FreeDESK("../");
 47: 	$DESK->Start();
 48: 	ob_end_clean();
 49: 	if($DESK->ContextManager->Open(ContextType::User, $_REQUEST['sid']))
 50: 	{
 51: 		$DESK->ContextManager->Destroy();
 52: 		header("Location: login.php?e=logout");
 53: 		exit();
 54: 	}
 55: 	else
 56: 	{
 57: 		header("Location: ./login.php?e=logout");
 58: 		exit();
 59: 	}
 60: }
 61: ?>
 62: <!DOCTYPE html>
 63: <html>
 64: <head>
 65: <meta name="viewport" content="width=device-width" />
 66: <link rel="stylesheet" type="text/css" href="mobile.css" />
 67: <title>FreeDESK Mobile Interface</title>
 68: </head>
 69: <body>
 70: <div class="header">
 71: FreeDESK Mobile
 72: </div>
 73: <div class="container">
 74: <form id="customer_login" action="login.php" method="post">
 75: 
 76: <?php
 77: if (isset($_REQUEST['e']))
 78: {
 79: 	if ($_REQUEST['e'] == "expired")
 80: 		echo "<b>Session Expired, Please Relogin</b>";
 81: 	else if ($_REQUEST['e'] == "failed")
 82: 		echo "<b>Login Failed, Incorrect Username or Password</b>";
 83: 	else if ($_REQUEST['e'] == "logout")
 84: 		echo "<b>You Are Logged Out</b>";
 85: 	echo "<br /><br />";
 86: }
 87: ?>
 88: 
 89: Username<br />
 90: <input type="text" name="username" class="mobLogin" /><br /><br />
 91: Password<br />
 92: <input type="password" name="password" class="mobLogin" /><br />
 93: <br /><br />
 94: <input type="submit" value="Login to FreeDESK" class="mobLogin" />
 95: </form>
 96: <br /><br />
 97: 
 98: 
 99: <form action="../" method="post">
100: <input type="hidden" name="mobileoverride" value="1" />
101: <input type="submit" value="Use Desktop Interface" class="mobLogin" />
102: </form>
103: 
104: </div>
105: </body>
106: </html>
107: 
108: