PHP: Conditional webpage changing?

Associate
Joined
24 Nov 2008
Posts
30
Location
London and North Carolina
I've been looking into PHP again after many years and seeing the joys it can offer a humble webpage but need pointing in the right direction from the gurulike entities that are present (is that enough butt kissing?) ;)

I'm trying to create a simple webpage permissions routine that accesses the cookie created by phpBB and identifies whether the user_id of the member is of a certain user_group.. and if so redirect to another page.

I have everything worked out but the page direct from php (can this even be done with php?).. will someone aid the old 'Censor in his time of need?
 
Okay, I'm going to have to read up on header() but just to clarify (I'm getting senile so please forgive me).. this method would allow me to do the following (I've done the cookie stuff and MySQL referencing - it's simply the conditional redirects I am uncertain about passing to browser)?:

1) User selects the html link
2) A php file is run which checks for phpbb cookie user_id
3) The same PHP file opens the MySQL and pulls associated group_id
4) If group_id meets criteria then redirect to 'protected' page
5) Otherwise redirect to a 'please register/error' page

(btw - many thanks for the replies so far)
 
Well as I've said I've done the checking and can identify if somone has rights :D

It's just basically forwarding them to the correct destination.. I'm not clear how to do that in php.. and if the header() method is how it should be done can the conditional PHP redirect people with different rights to different pages?

Knowledge of phpBB isn't needed in other words it's a PHP related issue :)
 
Back
Top Bottom