Page 1 of 1

[SOLVED] file_exists()

Posted: Sun Jun 13, 2004 9:27 pm
by HaVoC

Code: Select all

<?php
$filename = "/modules/plugins/{$module}/{$module}.php";

if (file_exists($filename)){
	$module = $module;
}
else{
	$module = "error";
}
?>
There's the code, I don't know what's wrong. But it doesn't seem to execute anything after taht if statement. I echoed $filename to see if it outputted the correct information, it did.

Posted: Sun Jun 13, 2004 9:51 pm
by scorphus
No errors? Give us the result of viewtopic.php?p=65245#65245

Scorphus.

Posted: Sun Jun 13, 2004 10:05 pm
by redmonkey
Have you tried echoing $module after your if statement?

Although I don't see any immediate errors in your code your if statement seems to be a bit odd to me. Unclear as to why it would not be written as....

Code: Select all

<?php
$filename = "/modules/plugins/{$module}/{$module}.php";

if (!file_exists($filename)){
   $module = 'error';
}
?>
Are you sure $filename should not be....

Code: Select all

$filename = "./modules/plugins/{$module}/{$module}.php";

Posted: Mon Jun 14, 2004 9:57 am
by HaVoC
Thanks! You guys are great!