Page 1 of 1
restrict user access on certain pages
Posted: Mon Jun 30, 2008 5:00 am
by ma5ect
Hi PPL,
On my website i have setup user log in. once they log in i want to restrict certain users from certain pages.. and on some pages i want the user to enter their username and password again..but i am stuck on how to restrict them.. any user guides on how to tackle this issue..i am using dreamweaver cs3
many thanx
Re: restrict user access on certain pages
Posted: Mon Jun 30, 2008 5:15 am
by Jasheppard
set a cookie or session var or whatever:
Code: Select all
setcookie("auth",convert('true','encrypt'),time()+3600); // the convert() function is my encrypter :)
after they log in and on the page you want to restrict...
Code: Select all
if (convert($_cookie['auth'],'encrypt')!="true") die("ACCESS DENIED");
Re: restrict user access on certain pages
Posted: Mon Jun 30, 2008 8:06 am
by Rovas
ma5ect wrote:Hi PPL,
... and on some pages i want the user to enter their username and password again...
Why? Your users will get annoyed and leave. If you want to still do it make it so that you verify his passwords think the way Yahoo, Google do this.
Re: restrict user access on certain pages
Posted: Mon Jun 30, 2008 8:36 am
by highjo
you can actually have tables in the database to store user privileges (if it's not already there) by organizing them in a user groups.It's done usually with numbers.if you have a table that store credentials like username and password, you can create a new table called for example group_id where you have g_id and role fields.then you append to your credentials table the field g_id.you'll do the referencing stuff.Now you can store the g_id in a session when user log in.then in your logic according to the number of group that you have you can limit the access to certain pages by their g_id.and bring them a login page.You can add the session time out system if needed.Hope this help.
