Файл: 3in1_1x3_1x5_1x7/admin.php
Строк: 74
<?
// +----------------------------------------------------------------------+
// | MyPHP Visits Generator |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002 Artem Akatov |
// +----------------------------------------------------------------------+
// | Author: Artem Akatov <webmaster@myphp.dem.ru> |
// | Homepage: http://www.myphp.dem.ru |
// +----------------------------------------------------------------------+
//
// 2002/02/24
?>
<HTML>
<HEAD>
<TITLE>Генератор</TITLE>
<link rel="stylesheet" type="text/css" href="../../php.css">
</HEAD>
<?
require("config.php");
function show_add_type_form() {
global $base;
?><br>
<table cellspacing="0" cellpadding="0" bgcolor="#2C5D92"><tr><td>
<table border="0" width="200" cellspacing="1" class="text">
<tr><td bgcolor="#EEEEEE"><center>
Добавить новый вид</center>
</td></tr><tr><td bgcolor="#FFFFFF">
1x <input type="text" maxlength="2" size="2" name="type" class="form"></td>
</tr>
</table></tr></td></table>
<?
}
function show_types() {
global $base;
$file = file($base);
?><p>
<table cellspacing="0" cellpadding="0" bgcolor="#2C5D92"><tr><td>
<table border="0" width="300" cellspacing="1" class="text">
<tr><td width="100" bgcolor="#EEEEEE">Удалить?</td><td bgcolor="#EEEEEE">Типы генератора</td>
</tr>
<?
for ($i=0; $i<sizeof($file); $i++) {
$line = explode("^^", $file[$i]);
?>
<tr>
<td bgcolor="#FFFFFF"><input type="checkbox" name="NoTypeDel[]" value="<?=$i;?>"></td>
<td bgcolor="#FFFFFF">1x<?=$line[0];?></td>
</tr>
<?
}
echo "</table></tr></td></table>";
}
function show_form() {
global $type, $base, $ad_login, $ad_pass;
echo "<form action='admin.php?login=$ad_login&pass=$ad_pass' method='post'>";
show_types();
show_add_type_form();
echo '<p><input type="submit" value="Изменить" class="form"></form>';
}
function add_type() {
global $type, $base;
$str = $type."^^";
$fp = fopen($base, "a-");
fputs($fp, $str);
fclose($fp);
}
function del_type() {
global $base, $NoTypeDel;
$k=0;
$file = file($base);
for ($i=0; $i<sizeof($file); $i++) {
if (!in_array($i, $NoTypeDel)) {
$ResFile[$k] = $file[$i];
$k++;
}
}
$fp = fopen($base, "w");
for ($i=0; $i<sizeof($ResFile); $i++) {
fputs($fp, $ResFile[$i]);
}
fclose($fp);
}
function after_change() {
?>
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="3; URL=<?=$HTTP_REFERER;?>">
</HEAD>
<BODY>
<h3>Изменения успешно выполнены</h3>
<?
exit();
}
function login() {
?>
<form action="" method="post">
<center><p><b>Пожалуйста, пройдите аутентификацию.</b><br><br>
<table bgclolor="#2C5D92" cellpadding=0 cellspacing=0 width="350" bgcolor="#2C5D92"><td>
<table cellpadding=0 cellspacing=1 border="0" width="100%" class="text">
<tr>
<td width="50%" bgcolor="#FFFFFF" align="center"><b>Логин</b></td>
<td width="50%" bgcolor="#3F7DBC" align="center"><input type="text" name="login"></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFFF" align="center"><b>Пароль</b></td>
<td width="50%" bgcolor="#3F7DBC" align="center"><input type="password" name="pass"></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFFF" align="center"> </td>
<td width="50%" bgcolor="#3F7DBC" align="center">
<input type="submit" value="Войти">
</td>
</tr>
</table>
</td></table><br>
</form>
<?
exit();
}
if($login!=$ad_login || $pass!=$ad_pass) login();
if ($type || isset($NoTypeDel[0])) {
if (isset($NoTypeDel[0])) del_type();
if ($type) add_type();
after_change();
}
/*if ($NoTypeDel[0]) {
del_type();
after_change();
}*/
show_form();
?>
</BODY>
</HTML>