<?php
Defined('ADMIN_S_S') or die ('Доступ запрещен');
if (isset($_POST[id2]))
{
include("use/$_POST[id2].php");
$orig_pass = $us_pass;
};
if (isset($_POST[me])) // если форма уже отправила данные
{
//Чтение переменных из формы
$us_name = $_POST[us_name];
$us_pass = $_POST[us_pass];
$us_info = $_POST[us_info];
$us_status = $_POST[status];
$mailto = $_POST[mailto];
// форматируем по общему каналу
$reg_name2 = $us_name;
$reg_pass = $us_pass;
$reg_name2=strtr($reg_name2,"абвгдеёзийклмнопрстуфхъыэ_",
"abvgdeeziyklmnoprstufh'iei");
$reg_name2=strtr($reg_name2,"АБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЭ_",
"ABVGDEEZIYKLMNOPRSTUFH'IEI");
$reg_name2=strtr($reg_name2,
array(
"ж"=>"zh", "ц"=>"ts", "ч"=>"ch", "ш"=>"sh",
"щ"=>"shch","ь"=>"", "ю"=>"yu", "я"=>"ya",
"Ж"=>"ZH", "Ц"=>"TS", "Ч"=>"CH", "Ш"=>"SH",
"Щ"=>"SHCH","Ь"=>"", "Ю"=>"YU", "Я"=>"YA",
"ї"=>"i", "Ї"=>"Yi", "є"=>"ie", "Є"=>"Ye"
)); // очистка строки имени
$reg_name2 = str_replace(" ","_",$reg_name2);
$reg_name2 = str_replace("\\","_",$reg_name2);
$reg_name2 = str_replace("\"","_",$reg_name2);
$reg_name2 = str_replace("'","_",$reg_name2);
$reg_name2 = str_replace(".","_",$reg_name2);
$reg_name2 = str_replace("-","_",$reg_name2);
$reg_name2 = str_replace("/","_",$reg_name2);
$reg_name2 = str_replace("#","_",$reg_name2);
$reg_name2 = str_replace("=","_",$reg_name2);
$reg_name2 = str_replace("|","I",$reg_name2);
$reg_name2 = str_replace("<","_",$reg_name2);
$reg_name2 = str_replace(">","_",$reg_name2);
if ($reg_pass != "")
{ // очистка строки пароля
$reg_pass = str_replace(" ","_",$reg_pass);
$reg_pass = str_replace("\\","_",$reg_pass);
$reg_pass = str_replace("\"","_",$reg_pass);
$reg_pass = str_replace("'","_",$reg_pass);
$reg_pass = str_replace(".","_",$reg_pass);
$reg_pass = str_replace("-","_",$reg_pass);
$reg_pass = str_replace("/","_",$reg_pass);
$reg_pass = str_replace("#","_",$reg_pass);
$reg_pass = str_replace("=","_",$reg_pass);
$reg_pass = str_replace(">","_",$reg_pass);
$reg_pass = str_replace("<","_",$reg_pass);
$reg_pass = md5(md5(md5($reg_pass)));
};
// очистка "О пользователе"
$us_info = str_replace("'","_",$us_info);
$us_info = str_replace("\"","_",$us_info);
$us_info = str_replace("\\","_",$us_info);
$us_info = str_replace("<","_",$us_info);
$us_info = str_replace(">","_",$us_info);
$us_info = str_replace("Java","_",$us_info);
$us_info = str_replace("java","_",$us_info);
$us_info = str_replace("Script","_",$us_info);
$us_info = str_replace("script","_",$us_info);
$us_name2 = $reg_name2 ;
// конец
//Создание нового файла
$fp = fopen ("use/$us_name2.php", "w+");
fwrite ($fp, "<?php \r\n");
fwrite ($fp, "Defined('INDEX_S_S') or die ('Доступ запрещен'); \r\n");
// Проверка на точность
if (isset($us_name) and isset($reg_pass))
{
//запись данных
fwrite ($fp, "\$us_name = '$us_name';\r\n");
if ($_POST[us_pass] != "")
fwrite ($fp, "\$us_pass = '$reg_pass';\r\n");
else
fwrite ($fp, "\$us_pass = '$_POST[orig_pass]';\r\n");
fwrite ($fp, "\$us_mail = '$mailto';\r\n");
fwrite ($fp, "\$us_info = '$us_info';\r\n");
fwrite ($fp, "\$us_status = '$us_status';\r\n");
fwrite ($fp, "\r\n?>");
fclose ($fp);
// добавление имени страницы в счетчик и счетчик2
//открываем счетчик и читаем его в переменную
$cop = fopen ("use/log/counter.txt", "r");
$copy = fread($cop, filesize("use/log/counter.txt"));
fclose ($cop);
$copy = explode("|",$copy);
$a = 0;
while ($copy[$a] != "")
{
if ($us_name2 == $copy[$a])
{
$cop = $copy[$a] ; break;
}
$a++;
};
if ($us_name2 != $cop)
{
$cont = fopen ("use/log/counter.txt", "a+");
if (filesize("use/log/counter.txt") == 0)
{
fwrite ($cont, "$us_name2");
}
else
{
fwrite ($cont, "|$us_name2");
};
fclose ($cont);
$cont2 = fopen ("use/log/counter2.txt", "r");
$buf = fread ($cont2,filesize("use/log/counter2.txt"));
fclose ($cont2);
$buf++;
$cont2 = fopen ("use/log/counter2.txt", "w+");
fwrite ($cont2, "$buf");
fclose ($cont2);
// конец
};
};
echo 'Успешно<br/><a href="/admin.php?int=use/adm/ind.php">Далее</a>';
}
else
{
?>
<form name="redakt" action="<?php $_SERVER[self]?>" method="post">
<input name="id" type="hidden" value="red_user">
<input name="me" type="hidden" value="1">
<input name="orig_pass" type="hidden" value="<?php echo $orig_pass?>">
Имя пользователя:<br />
<input name="us_name" type="text" value="<?php echo $us_name ?>">
<br />
Ящик пользователя:<br />
<input name="mailto" type="text" value="<?php echo $us_mail ?>">
<br />
Пароль пользователя:<br />
<input name="us_pass" type="text" value="">
<br />
О пользователе:<br />
<textarea name="us_info" rows=5 cols=50><?php echo $us_info ?></textarea>
<br />
Статус:<br />
<select size="1" name="status">
<option value="0">БАН</option>
<option value="1">Пользователь</option>
<option value="2">Избранный</option>
<option value="3">Модератор</option>
</select><br />
<HR>
<input type="submit" value="Готово">
</form>
<?php
};
?>