Показать сообщение отдельно

  #10  
Старый 01.05.2009, 07:49
KaZ@NoVa
Постоянный
Регистрация: 05.07.2008
Сообщений: 555
С нами: 9394886

Репутация: 1467


По умолчанию

Цитата:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=cp-1251"/>
</head>
<body>
<form action="index.php" method="GET">
<input type="text" name="key"></input>
<input type="submit" value="OK"></input>
</form>
<?php
if ((isset($_GET["key"]))&&(!empty($_GET["key"]))){
$key = $_GET["key"];
$key_length = strlen($key);
@$file = fopen("keys.txt", "r");
if ($file){
flock($file, LOCK_SH);
flock($file, LOCK_UN);
$i = 0;
while (!feof($file)){
$arr[$i] = fgets($file, 200);
$i++;
}
fclose($file);
$i = 0;
for ($i=0; $i<count($arr); $i++){
$l = 0;
for ($l=0; $l<strlen($arr[$i])-$key_length; $l++){
if ($key == substr($arr[$i],$l,$key_length)){
echo $arr[$i] . "<br>";
}
}
}
}
else{
echo "Не удалось открыть файл";
}
}
?>
</body>
</html>
это сохрани как index.php
все ключи вгони в файл keys.txt
 
Ответить с цитированием