i have a db that tlls me each page by its name its user priviliges need to acces the page!
what is the best way to manage all of this?
to check on each page with the db?or any other way?
thanks in advance
peleg[/big_search]
prventing from a person to enter to a certain page
Moderator: General Moderators
Be more specific please
You will get better/more responses/help if you are more specific.
Here is a "shot in the dark" that may help you:
When the user logs in, give them a cookie specifying the user's access level...
Then, at the top of each page verify the access level...
For better security, the $access_level should be some random string like a password, instead of something obvious like 1,2,3,"low","medium","high" etc. Hope this helps.
Here is a "shot in the dark" that may help you:
When the user logs in, give them a cookie specifying the user's access level...
Code: Select all
setcookie("access_level", $access_level, time() + 14400);Code: Select all
$access_level = $HTTP_COOKIE_VARSї'access_level'];
if($access_level != "this_level") {
echo "You do not have permission to view this page\n";
exit;
}sessions
cookies
run a query against the stored/logged-in username and make a list of if-statements to allow certain people
or, the more 'professional' way:
make a column in the sql table called admin, set the default to 0 (cant access the page) then when new users sign -up they are viewed as basic, change the value to 1 for they can access that pages.
again, use if-statements.
good luck
cookies
run a query against the stored/logged-in username and make a list of if-statements to allow certain people
or, the more 'professional' way:
make a column in the sql table called admin, set the default to 0 (cant access the page) then when new users sign -up they are viewed as basic, change the value to 1 for they can access that pages.
again, use if-statements.
good luck
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
first thanks both of u !
second tony_c what do i do if the usercookies are disabled!!!!
and doing
is not enough i need to redirect to another page how do i do that?
second tony_c what do i do if the usercookies are disabled!!!!
and doing
Code: Select all
exit;-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
*nod*
whoops, im not malcolm

tim's way + keep it in a session, then check it like:
whoops, im not malcolm
tim's way + keep it in a session, then check it like:
Code: Select all
$page_rank = 3;
$user_rank = mysql_result(mysql_query("SELECT rank FROM users WHERE username = {$_SESSION['name']}"), 0,0);
if($user_rank >= $page_rank){
//print page
}
else {
header("Location: errorpage.php");
}