<? include ('dbconnect.php'); include ('xcheck.php'); include ('head.php'); include ('banner.php'); include ('lmenu.php'); echo "<TABLE BORDER='0' WIDTH='70%' CELLPADDING='6' CELLSPACING='2' ALIGN='left'>"; echo "<TR><TH WIDTH='100%' ALIGN='left'>"; echo "<TABLE BORDER='1' WIDTH='100%' CELLPADDING='6' CELLSPACING='2' ALIGN='center'>"; echo "<TR><TH $out COLSPAN='5'$col align='center'>"; echo "CS Maps - Season 3"; echo "</TH></TR>"; echo "<TD $out COLSPAN='5' align='left' >"; $root = $_SERVER["DOCUMENT_ROOT"]; $directory = "/season_3/dl/maps"; $path = $root.$directory; $handle = opendir($path); while ($item = readdir($handle)) { if (preg_match("/^cs_.*$/",$item)) { # this line here echo "<a href='http://www.actionleague.co.uk/season_3/dl/maps/"; echo $item; echo "'>"; echo $item."</a><BR>"; } } closedir($handle); echo "<BR></TR></TABLE></TR></TABLE>"; include ('rmenu.php'); ?>
I want the change this line to react to $map
if (preg_match("/cs_.*$/",$item)) {
if (preg_match("/^[b]$map[/b].*$/",$item)) {
but that wont work...
any ideas?
any1 🙁
it's not working because preg_match is interperating the $ as the end-of-string char. try this:
if (preg_match("/^cs_.*$/",$item)) { if (preg_match("/^".$map.".*$/",$item)) {
hth moon
cheers worked 🙂