search  

<?php
mb_language("ja");
mb_internal_encoding("UTF-8");
header("Content-Type:text/html; charset=UTF-8");
if (isset($_POST["word"])) {
$word = $_POST["word"];
if( get_magic_quotes_gpc() ) { $word = stripslashes("$word"); }
$word = htmlspecialchars ($word);
$imagedir = opendir("./images");
while (false !== ($file = readdir($imagedir)));
$image = "./images/" . $word . ".jpg";
if(file_exists($image)){
print "<img src='" . $image . "'>\n";
}
else {
print "ファイルが見つかりません。";
}
closedir($imagedir);
}
else {
?>
<form action="./word.php" method="POST">
search&nbsp;<input name="word" type="text" size="10">&nbsp;<input type="submit" value="検索">
</form>
<?php
}
?>