Function Help!
Posted: Wed May 12, 2004 12:20 pm
I made a function called: page(), It's not working. Here is the function script:
And here is the use of the function:
it keeps saying: Parse error: parse error, expecting `T_CASE' or `T_DEFAULT' or `'}'' in /home/cheekuon/public_html/inc/pages.php on line 16
Any ideas?
Code: Select all
<?php
function page($url, $title, $type)
{
if($type == "memberonly") {
if(session_is_registered("loggedin") && $page != "logout") {
case $title:
include("$url");
break;
} else {
case $title:
include("pages/error.php");
break;
}
} elseif($type == "any") {
case $title:
include("$url");
break;
} elseif($type == "guest") {
if(!session_is_registered("loggedin") {
case $title:
include("$url");
break;
} else {
case $title:
include("pages/error.php");
break;
}
}
}
?>Code: Select all
<?php
include("functions/page.php");
switch ($page) {
page("pages/attackresult.php", "attackresult", "memberonly");
page("pages/register.php", "register", "guest");
page("pages/aboutus.php", "aboutus", "any");
page("pages/profile.php", "profile", "memberonly");
page("pages/research.php", "research", "memberonly");
page("pages/topexp.php", "topexp", "any");
page("pages/topgold.php", "topgold", "any");
page("pages/top10002.php", "top10002", "any");
page("pages/mcc.php", "mcc", "memberonly");
page("pages/inbox.php", "inbox", "memberonly");
page("pages/sendmessage.php", "sendmessage", "memberonly");
page("pages/clan.php", "clan", "memberonly");
page("pages/shop1.php", "shop1", "memberonly");
page("pages/shop2.php", "shop2", "memberonly");
page("pages/shop3.php", "shop3", "memberonly");
page("pages/shop4.php", "shop4", "memberonly");
page("pages/minegold.php", "minegold", "memberonly");
page("pages/help.php", "help", "any");
page("pages/top1000.php", "top1000", "any");
page("pages/news.php", "news", "any");
page("pages/login.php", "login", "guest");
page("pages/gold.php", "gold", "memberonly");
page("pages/rank.php", "rank", "any");
page("pages/attack.php", "attack", "memberonly");
page("pages/logout.php", "logout", "memberonly");
page("pages/shop.php", "shop", "memberonly");
page("pages/info.php", "info", "any");
page("pages/heroinfo1.php", "heroinfo1", "any");
page("pages/lightinfo.php", "lightinfo", "any");
page("pages/darkinfo.php", "darkinfo", "any");
page("pages/heroinfo2.php", "heroinfo2", "any");
page("pages/heroinfo3.php", "heroinfo3", "any");
page("pages/heroinfo4.php", "heroinfo4", "any");
page("pages/raidersinfo.php", "raidersinfo", "any");
page("pages/incognitosinfo.php", "incognitosinfo", "any");
page("pages/barbariansinfo.php", "barbariansinfo", "any");
page("pages/earthlingsinfo.php", "earthlingsinfo", "any");
default:
include("pages/home.php");
}
?>Any ideas?