Location: PHPKode > projects > Pal Vibes > palvibes/AdminLogin.php
<?php
/*
 * Created on 2008-10-25
 * Login page of admin
 */

require('includes/AdminApplicationTop.php');
require('includes/classes/Page.php');
require('includes/classes/Admin.php');

if(isset($referer->_post['submit'])) {
	$admin = new Admin;
	$admin->addWhereAnd(array('admin_username:=' => $referer->_post['username'],
							  'admin_password:=' => md5($referer->_post['password'])));
	$admin->load();
	if(0 < $admin->count) {
		$adminInfo['id'] = $admin->admin_id;
		$adminInfo['username'] = $admin->admin_username;
		$adminInfo['email'] = $admin->admin_email;
		$admin->generateSession($adminInfo);
		//if($referer->_post['refer']) {
		//	header("location:".$referer->_post['refer']);
		//}
		//else {
			header("location: AdminIndex.php");
		//}
	}
	else {
		$msg = '<span class="loginAlert">'.ADMIN_MSG_ADMIN_LOGIN_FAILED.'</span>';
	}
}

if('logout' == $referer->_get['action']) {
	$admin = new Admin;
	$admin->unsetSession();
	header("Location:AdminIndex.php");
}

$page = new Page($config);
$page->headerAdmin();
echo $page->header;
?>
<div id="frame">
<div id="infobar">
<?php echo ADMIN_BREADCRUMB_LOCATION?> <?php echo ADMIN_BREADCRUMB_LOGIN?>
</div>
<div id="content">
<div id="login">
<span class="loginTitle"><?php echo ADMIN_MSG_ADMIN_LOGIN?></span>
<br><br>
<hr size="1" color="#cccccc">
<?php 
if('suc' != $msg) {
	echo $msg;
}	
?>
<div style="text-align:center;">
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
<table id="login" cellspacing="10" cellpadding="0" border="0">
  <tr>
    <td><?php echo ADMIN_MSG_ADMIN_USERNAME?>:</td>
    <td class="formElements"><input type="text" name="username" size="26"></td>
  </tr>
  <tr>
    <td><?php echo ADMIN_MSG_ADMIN_PASSWORD?>:</td>
    <td class="formElements"><input type="password" name="password" size="26"></td>
  </tr>
  <tr>	
	<td></td>
    <td class="formElements"><input type="submit" id="submit" name="submit" value="<?php echo ADMIN_MSG_ADMIN_SUBMIT?>"></td>
  </tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<DIV class=clear></DIV>

<?php
if(!$proceed) {
	echo $alert;
}
$page->footerAdmin();
echo $page->footer;
?>
Return current item: Pal Vibes