Forums

PHP

This topic is locked

restrict access to page PHP

Posted 24 Jun 2003 15:46:54
1
has voted
24 Jun 2003 15:46:54 Adam Davies posted:
Using DMX 6.1 with php/mysql server model

Hi im a bit stuck with this so if anyone can point me to a tutorial
and/or extension it would be appreciated.

I've sorted out a user login using felixone's login extension no problem
but what im trying to do is retrict access to various pages depending on
whether they have the value "1" in a field on their user database table,
for example in the user table there are several fields: red,green,blue.
red has a value of 1 green has a value of 0 and blue has a value of 1

so what im trying to do is that if a user clicks on link to red page it
lets him in because he has they value of "1" in the red field but if he
click on green it sees that he has a value of 0 so access is denied.

any help or pointers would be great.

Cheers.


Replies

Replied 24 Jun 2003 17:13:03
24 Jun 2003 17:13:03 Dean Saunders replied:
HI coctc2001

if you use the dreamweaver login options you can set the up the restrict access to page via the user authentication on the behaviors panel.

or you can stick a simply condintional region in that will check when the page is loaded if the value is 1 and if it is then show the content if not then it will rediect them before the page is loaded to a page of your choice. or simply state that "they do not have permission to access this area" and then have a back button.

this would mean 2 or three lines of script at the top of your page and 1 kine of code oat the bottom.

the good thing is once you have the script you can simply drop it onto a page and then set the value for who gets onto that page.

if their is only two types of people you can simply make the conditonal script into 2 includes one for the top of the page with the "if green = 1 then show page or if they are not 1 then show access denied text" code and one for the bottom of the page with the close if statment on.

this way you and simply add the include file tages to the pages and then only have the one bit of script so if you want the change the denied message you only change it once and this altomattically updates every page using the include tages.

I have a bit code like this somewhere if you want me to i can stick it up here for you to copy



Cheers

Dean

The one joy of computing is you can't go to jail for SCREEN RAGE.
Replied 24 Jun 2003 17:53:35
24 Jun 2003 17:53:35 Adam Davies replied:
Yes please that would be great

Reply to this topic