File: 0.01.1a/customer/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::Customer, "",
 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: ?>
 43: <!DOCTYPE html>
 44: <html>
 45: <head>
 46: <link rel="stylesheet" type="text/css" href="customer.css" />
 47: <title>FreeDESK Customer Interface</title>
 48: </head>
 49: <body>
 50: <div class="header">
 51: Login to FreeDESK Customer Interface
 52: </div>
 53: <div>
 54: <form id="customer_login" action="login.php" method="post">
 55: 
 56: <?php
 57: if (isset($_REQUEST['e']))
 58: {
 59: 	if ($_REQUEST['e'] == "expired")
 60: 		echo "<b>Session Expired, Please Relogin</b>";
 61: 	else if ($_REQUEST['e'] == "failed")
 62: 		echo "<b>Login Failed, Incorrect Username or Password</b>";
 63: 	echo "<br /><br />";
 64: }
 65: ?>
 66: <table>
 67: <tr><td>Username or Email</td>
 68: <td><input type="text" name="username" /></td></tr>
 69: <tr><td>Password</td>
 70: <td><input type="password" name="password" /></td></tr>
 71: <tr><td>&nbsp;</td>
 72: <td><input type="submit" value="Login to FreeDESK" /></td></tr>
 73: </table>
 74: 
 75: </form>
 76: </div>
 77: </body>
 78: </html>
 79: 
 80: