Търсачка, при търсене - без разширение нa files

Bummer

Registered
Ползвам тази търсачка - http://web-tourist.net/login/login/view.php?st=650
Как да се направи така, че като покаже резултатите да не показва разширението на files ?
Примерно намира file.html и да показва само file ?
Благодаря ;)
 
този ред го заменяш
Код:
echo("<a href='".$file."' target=_blank>".str_replace($dir, "", $file)."</a><br />\n");
с това
Код:
$file = explode('.', $file);
echo("<a href='".$file."' target=_blank>".str_replace($dir, "", $file[0])."</a><br />\n");
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Search</title>
</head>
<body>
<center>
<form action="search.php" method="post">
<input type="text" name="searched">
<input type="submit" value="search">
</form>
<?php
$flag=0;
$dir="directory/";
if(isset($_POST['searched'])) {
foreach(glob($dir."*") as $file) {
if(@eregi($_POST['searched'], str_replace($dir, "", $file))) {
$noext = current(explode(".",$file));
echo("<a href='".$file."' target=_blank>".str_replace($dir, "", $noext)."</a><br />\n");
$flag+=1;
}
}
if($flag==false) {
echo("Няма намерени файлове.");
}
}
?>
</center>
</body>
</html>
 

Back
Горе