Re: Variable won't work in function, even when I global it?
| From: | Miguel Cruz | Date: | Mon, 20 May 2002 05:52:43 +0000 |
| Subject: | Re: Variable won't work in function, even when I global it? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98424@lists.php.net to get a copy of this message | ||
Rather than continuing to shroud this in mystery, could you at least give
us a taste of what is in $footertext?
miguel
On Mon, 20 May 2002, Leif K-Brooks wrote:
> I won't send the whole value of $footertext, it's too long. Yes, it
> contains the contents of the footer file. I have tried displaying it
> before the function and it works fine.
>
> Martin Towell wrote:
>
> >what's that value of $footertext?
> > is it the actual contents of the footer file?
> >have you tried displaying the contents of $footertext just before you call
> >checkmember()?
> > does it contain what you're expecting?
> >
> >-----Original Message-----
> >From: Leif K-Brooks [mailto:eurleif@buyer-brokerage.com]
> >Sent: Monday, May 20, 2002 3:23 PM
> >To: php-general@lists.php.net
> >Subject: [PHP] Variable won't work in function, even when I global it?
> >
> >
> > On my website, I open my header (and footer) file with fileopen and
> >then eval() it. I know I should include them, but I knew nothing about
> >php when I did this. Anyway, I'm working on "groups" for my website.
> > They will be a kind of club. At the top of every group page, I include
> >a group function file. Among those functions is one that checks if the
> >user trying to go to the group is a member of it. If not, it gives them
> >an error message and exits. It is also supposed to eval() the footer
> >before exiting. My code is as follows:
> >
> > function checkmember(){
> > global $groupid;
> > global $userinfo;
> > global $footertext;
> > if($groupid != $userinfo['groupid']){
> > print "<b>Error:</b> you're not a member of this group.";
> > eval($footertext);
> > exit;
> > }
> > return;
> > }
> >
> >
> >The thing is, it doesn't seem to eval() the footer. I've even tried
> >getting $footertext out of the $GLOBALS array. I have also tried
> >printing $footertext to make sure it wasn't a problem with evel().
> > Nothing has worked. When I did isset() on $GLOBALS['footertext'], it
> >worked however. Thanks to anybody who can help.
> >
> >
> >
>
>
>
>