Vinney
08-12-2002, 09:07 PM
ok am trying to get my head around php, and to be honest am finding it ok.
i've made this php script to use on my forum/vbportal. For test purposes i've used echo "????" just to see where am at ( trying to do thing methodical ) :
<?php
error_reporting(7);
include ("mainfile.php");
$index = 1;
global $Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Test";
include("header.php");
OpenTable();
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3) {
echo "premission denied";
} else {
echo "premission granted";
CloseTable();
include("footer.php");
?>
the above code works fine..... but you have probably spotted what am going to ask.
When you not logged in and try and access the php, it does include the bottom part of the script,
CloseTable();
include("footer.php");
?>
which i need to complete the look of the error page.
I understand that is will happen because the way i have wrote the php. Correct me if am wrong, when it comes to 'if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || '
if you dont have the cridentials it stops and displays :
'echo "premission denied";'
on the other hand if you do , then it continues, hence the '} else {' part.
This is part of my learning curve.
So anyways, back to my point, how to i alter it, so that
' CloseTable();
include("footer.php"); '
is inculded in both instances ?? - what do i need to do?
i know i could use templates using :
eval("dooutput(\"".gettemplate('blah blah')."\");");
but i want to learn to hard code stuff, other than rely on templates.
thanks for you time,......
i've made this php script to use on my forum/vbportal. For test purposes i've used echo "????" just to see where am at ( trying to do thing methodical ) :
<?php
error_reporting(7);
include ("mainfile.php");
$index = 1;
global $Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Test";
include("header.php");
OpenTable();
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3) {
echo "premission denied";
} else {
echo "premission granted";
CloseTable();
include("footer.php");
?>
the above code works fine..... but you have probably spotted what am going to ask.
When you not logged in and try and access the php, it does include the bottom part of the script,
CloseTable();
include("footer.php");
?>
which i need to complete the look of the error page.
I understand that is will happen because the way i have wrote the php. Correct me if am wrong, when it comes to 'if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || '
if you dont have the cridentials it stops and displays :
'echo "premission denied";'
on the other hand if you do , then it continues, hence the '} else {' part.
This is part of my learning curve.
So anyways, back to my point, how to i alter it, so that
' CloseTable();
include("footer.php"); '
is inculded in both instances ?? - what do i need to do?
i know i could use templates using :
eval("dooutput(\"".gettemplate('blah blah')."\");");
but i want to learn to hard code stuff, other than rely on templates.
thanks for you time,......