Просмотр файла aguest_v1.4/admin.php

Размер файла: 2Kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="http://stalker-mobile.kmx.ru/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html" charset=utf-8"/>
<title>wap.best-icq.com</title>
<link href="local/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="shapka">
Мини чат
</div>
<div class="lightred">
<a href="smile.php">Смотреть смайлы</a><hr>
<?php
include "local/antimat.php";
include "local/conf.php";
include "local/autoinput.php";
# проверка существования переменной $_GET['action']
if (!isset($_GET['action'])){$_GET['action']='view';}
# Проверка существования файла strings.txt
if (!file_exists('strings.txt')){fclose(fopen('strings.txt','w'));}

#начало вывода формы
print <<<END
<form action="$admin" method="get">
<table>
<tr><td><input type="radio" name="action" value="add"></td><td>
Добавить запись</td><td>
<input type="text" name="string">
</td></tr>
<tr><td>
<input type="radio" name="action" value="del"></td><td>
Удалить запись номер: </td><td>
<input type="text" name="number" size="5">
</td></tr>
</table>
<input type="submit" value="Послать запрос">
</form>
END;

if ($_GET['action'] == "add"){
	# Запись в файл
	$FV=fopen('strings.txt','a');
	flock($FV,2);
	fputs($FV,$_GET['string']."\n");
	fclose($FV);

}elseif ($_GET['action'] == "del"){
	# Удаление из файла
	$strs=file('strings.txt');
	$FV=fopen('strings.txt','w');
	flock($FV,2);
	foreach($strs as $key => $value){
		if($key == $_GET['number']){continue;}
		fputs($FV,$value);
	}
	fclose($FV);
}
# Просмотр записей
foreach(file('strings.txt') as $key => $value){
	print "<b>$key.</b> $value<br>\n";
}
?>
</div>
<div class="niz"><a href="http://wap.best-icq.com">by BBT CMS</a></div>
</body></html>