Просмотр файла wapbuilder/admin/login.php

Размер файла: 2.5Kb
<?php
require_once('includes/db.php');
require_once('includes/config.php');

$error = '';

if(isset($_POST['submit']))
{
   if($_POST['login'] == $user['login'] && md5($_POST['password']) == $user['password'])
   {
      session_start();
      $_SESSION['login'] = $user['login'];
      $_SESSION['password'] = $user['password'];

      // Блокировка малопосещаемых сайтов
      $configs = mysql_query('SELECT block_limit FROM config WHERE id = 1');
      list($block_limit) = mysql_fetch_array($configs);

      $date = date('Y-m-d');
      mysql_query("UPDATE counter SET today = 0 WHERE last_date < '$date'");

      $sites = mysql_query('SELECT u.id as id FROM users u, counter c WHERE u.id = c.id AND active = "1" AND c.today < ' . $block_limit);
      while($site = mysql_fetch_array($sites, MYSQL_ASSOC))
      {
         mysql_query("UPDATE users SET active = '0', block_date = CURRENT_TIMESTAMP WHERE id = $site[id]");
      }

      header('Location: sites.php');
      exit;
   }
   else
   {
      $error = WRONG_LOGIN;
   }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE><?php echo LOGIN_TITLE; ?></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<META name="keywords" content="">
<LINK rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
body {
        background-color: #f4efe4;
}
-->
</style></HEAD>
<BODY>
<div align="center"><br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <img src="images/logo.gif" width="323" height="128">
</div>
<table align ='center' valign='center' cellspacing="0" cellpadding="0">
  <tr><td>



<table>
<FORM action="login.php" method="post" name="login">
<tr><td colspan="2">
<div align="center">
<font class="error">
<?php echo $error; ?>
</font><br>
</div>
</td></tr>
<tr><td><?php echo LOGIN; ?></td><td><INPUT type="Text" name="login" size="22" value=""></td></tr>
<tr><td><?php echo PASSWORD; ?></td><td><INPUT type="password" name="password" size="22" value=""></td></tr>
<tr><td align="right" colspan="2"><div align="center">
  <br><INPUT type="Submit" name="submit" value="<?php echo LOGIN_BUTTON; ?>">
</div></td></tr>
</form>
</table>
</td></tr></table>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="50">&nbsp;</td>
</tr>
<tr>
<td align="center">
&copy; <a href="http://compushops.net" target=_blank>Compushops, 2004</a>
<br>
</td>
</tr>
</table>

</BODY>
</HTML>