Page 1 of 1
admin and user
Posted: Fri Dec 01, 2006 3:49 pm
by hrubos
Plz , how to solve if when user login, system can realize he is an admin or an user???
Posted: Fri Dec 01, 2006 3:53 pm
by MrPotatoes
access level or a permissions system and in the front forum. someone'll move it.
its gonna be in the code forum btw
Posted: Fri Dec 01, 2006 3:56 pm
by Burrito
moved to code
Posted: Fri Dec 01, 2006 3:57 pm
by Luke
there are a lot of ways, depending on how many different levels of permissions you want, but if you just want admin or user permissions, you could set a column in your database or whatever you use to store username and password...
Code: Select all
<?php
if($posted['username'] == $datasource['username'] && $posted['password'] == $datasource['password'])
{
$_SESSION['logged_in'] = true;
$_SESSION['admin'] = false;
if($datasource['admin'])
{
$_SESSION['admin'] = true;
}
}
?>
Posted: Fri Dec 01, 2006 5:43 pm
by hrubos
sorry, but I really ur how to run.
I have had table user, in which are user_name and password. SO I have to create new table for user_admin or what else to do?And I can use this code in my case now???
Posted: Fri Dec 01, 2006 6:33 pm
by Burrito
create a new field on that table that identifies the level of user they are.