You are here: Re: Special Search « PHP Programming Language « IT news, forums, messages
Re: Special Search

Posted by josh.23.french on 11/03/06 04:21

A database would be the optimal solution at any rate but, assuming the
songs dir is in the current directory and $song_name is set:

<?php
function getfilearray($start) {
$dir=opendir($start);
while (false !== ($found=readdir($dir))) { $getit[]=$found; }
foreach($getit as $num => $item) {
if (is_dir($start.$item) && $item!="." && $item!="..") {
$output["{$item}"]=filearray($start.$item."/"); }
if (is_file($start.$item)) { $output["{$item}"]="FILE"; }
}
closedir($dir);
return $output;
};

$f_letter = substr($song_name,0,1);
if(is_dir("./songs/".$f_letter)){
$files = getfilesarray("./songs/".$fletter."/");
foreach($files as $name => $type){
if($name==$songname.".txt" && $type = "FILE")
$found = true;
};
};
};
if($found){
echo "<a href=\"index.php?song=$song_name\">$song_name</a>";
};
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация