<?php
/***************************************************************************
* copyright : (C) 2006 The openology Group
* email : hide@address.com
*
* $Id
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
require_once(dirname(__FILE__)."/config_base.php");
session_start();
if ($action!="login")
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<link href="css/login.css" rel="stylesheet" type="text/css" title="Default" />
<script src="js/md5.js"></script>
<script src="js/login_focus.js"></script>
<script type="text/javascript">
function login_form_validation(formobject)
{
var value = '';
var errFlag = new Array();
errMsg = '';
if (formobject.elements['ad_name'].value == '')
{
errMsg = errMsg + 'Please input username!\n';
}
if (formobject.elements['ad_pass'].value == '')
{
errMsg = errMsg + 'Please input password!\n';
}
if (formobject.elements['ad_pass'].value != "")
formobject.elements['md5password'].value = MD5(formobject.elements['ad_pass'].value);
if (errMsg != '')
{
alert(errMsg);
return false;
}
return true;
}
</script>
</head>
<body>
<div id="loginbox">
<div id="logo">
<img alt="" src="img/logo.png" height="40" width="250" title="openology.org" />
</div>
<div id="loginbody">
<form name="login_form" action="login.php" method="post" id="login_form" onsubmit="return login_form_validation(this);">
<table border="0">
<tr>
<td colspan="2" id="loginheader">Login to Backend</td>
</tr>
<tr>
<td colspan="2" id="loginerror"></td>
</tr>
<tr id="logincontent">
<td width="5%" align="right"><label for="username">User name</label>:</td>
<td width="15%"><input type="text" id="ad_name" name="ad_name" tabindex="1" title="Enter your User name" /></td>
</tr>
<tr id="logincontent">
<td width="5%" align="right"><label for="password">Password</label>:</td>
<td width="15%"><input type="password" id="ad_pass" name="ad_pass" tabindex="2" title="Enter your Password" /></td>
</tr>
<tr>
<td colspan="2" id="logininfotext"></td>
</tr>
<tr>
<td colspan="2">
<div align="right"><input type="submit" id="log in" name="log in" class="submit" value=" OK " tabindex="3" title="Click to Login" /> <input type="reset" id="resetbutton" name="resetbutton" class="button" value="Cancel" title="Click to clear info" /></div>
</td>
</tr>
<tr>
<td colspan="2">
<div align="right"><a href="index.php?op=forgotpassword">Forgot Password</a></div>
</td>
</tr>
</table>
<input type="hidden" id="action" name="action" value="login" />
<input type="hidden" id="md5password" name="md5password" />
</form>
</div>
</div>
<div id="footer"> <span class="nobr">©2006 openology.org</span></div>
</body>
</html>
<?php
exit;
}
else if ($action=="login")
{
if ($ad_name==$user and $md5password==$pass)
{
$_SESSION['valid_user'] = $ad_name;
ShowMsg("$ad_name,$welcome","index.php");
}
else if($ad_name!=$user)
{
ShowMsg("$userError","login.php");
}
else if($ad_name==$user and $md5password!=$pass)
{
ShowMsg("$passError","login.php");
}
}
?>