Файл: id2759/PHP Version/fileman/login.php
Строк: 123
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Aquonics File Manager |
// +----------------------------------------------------------------------+
// | Copyright (c) 2001 Aquonics Scripting |
// +----------------------------------------------------------------------+
// | You may not remove the copyright or redistribute the script in any |
// | form. This program is Freeware, please read the license at |
// | http://www.aquonics.com/license.php |
// | |
// | Visit www.aquonics.com for more top scripts, free and custom. |
// +----------------------------------------------------------------------+
// | Authors: Stephen Ball <stephen@aquonics.com> |
// +----------------------------------------------------------------------+
//
// $Id$
error_reporting(0); /* Turn off ugly error messages */
// Try to include important files
// or die with an error message
if (!(include("./common.lib.php"))) {
die("<html><head><title>Error!</title></head><body bgcolor="#FFFFFF"><font size="2" face="Verdana, Geneva, Arial, Helvetica, Sans-Serif" color="#000000"><center><b>There was an error loading the library file.</b></center></font></body></html>");
}
if (!(include("./settings.inc.php"))) {
die("<html><head><title>Error!</title></head><body bgcolor="#FFFFFF"><font size="2" face="Verdana, Geneva, Arial, Helvetica, Sans-Serif" color="#000000"><center><b>There was an error loading the settings file.</b></center></font></body></html>");
}
// Find out what the user is trying to do
if ($op == "validate") {
// The are trying to log in
// so set cookies
setcookie("username", $username);
setcookie("password", md5($password));
if (validate_user($username, md5($password)) == 1) {
// Valid that they are allowed access
header("Location: ./" . $main_script . "");
exit;
}
else {
// Otherwise send them back to the log in form
// and remove the cookies
header("Location: ./" . $login_script . "?op=out");
exit;
}
}
else {
// They aren't trying to login
// so remove the cookies
setcookie("username", "", time()-3600);
setcookie("password", "", time()-3600);
}
// Find out the starttime
$starttime = starttime();
// Print the page header
html_header("Login");
?>
<tr>
<th align="left" bgcolor="#4682B4" valign="middle"><font size="2" face="Verdana, Geneva, Arial, Helvetica, Sans-Serif" color="#FFFFFF">Login</font></th>
</tr>
<tr>
<td align="left" bgcolor="#F5F5F5" valign="middle">
<form style="margin: 0" action="<?=$PHP_SELF;?>" method="post">
<input type="hidden" name="op" value="validate" />
<table border="0" width="100%" cellpadding="3">
<tr>
<td align="center" width="100%" colspan="2"><font size="1" face="Verdana, Geneva, Arial, Helvetica, Sans-Serif" color="#000000">Please enter your details below to log in!</font></td>
</tr>
<tr>
<td align="left" width="15%" nowrap="nowrap"><font size="1" face="Verdana, Geneva, Arial, Helvetica, Sans-Serif" color="#000000">Username</font></td>
<td align="left" width="85%"><input type="text" name="username" size="50" /></td>
</tr>
<tr>
<td align="left" width="15%" nowrap="nowrap"><font size="1" face="Verdana, Geneva, Arial, Helvetica, Sans-Serif" color="#000000">Password</font></td>
<td align="left" width="85%"><input type="password" name="password" size="50" /></td>
</tr>
<tr>
<td align="center" width="100%" colspan="2"><input type="submit" value="Log in!" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?
// Print the page footer
html_footer($starttime);
?>