Topic: require user to be logged in to view directory
<?php
define('PUN_ROOT', './forums/');
include 'forums/include/common.php';
function login_menu() {
global $pun_user;
function directory($result) {
$handle=opendir("./files");
while ($file = readdir($handle)) {
if ($file == "." || $file == ".." || $file == "index.php") { } else { print "<a href=$file>$file</a><br>\n"; }
}
closedir($handle);
return $result;
}
if ($pun_user['is_guest']) {
echo "<br />Please <a href=\"http://animelink.be/forums/register.php\">Register Here</a> or <a href=\"http://animelink.be/forums/login.php\">Login Here</a><br />";
}
else {
echo "<b>Manga Downloader</b><p>";
echo directory($result);
echo "<p><a href=\"http://localhost/pantasia\">Go Back To Pantasia</a>";
}
}
?>
what this is suppose to do is, when the user is logged in, he can see the files in the directory
when the user is NOT logged in, he sees links to register and log in
i dont get any errors
but all i see is a blank screen
when im logged in and when im not logged in
i called it "file.php" and its like this in my directory:
file.php
/forums/ <-punbb directory
can someone fix this?