473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

admin user permission

3
hi
i am new to php and mysql i am devloping a site wich required diffrent user level in admin area, basically i want to assign diffrent role for diffrent user like some user can update the records, some user can delete the record and superadmin will have all the access and could create the user too.

i search the google and found some basic idea however its not yet clear how to use user group and user permissions database, will you plz help me out i am using php and mysql i appriciate if some one explain me from the beginning

thanks
Dec 29 '07 #1
3 3184
djpaul
137 100+
Hee motif,
I did almost the same with my website.
I created an table admin with ID, username, password, email, admin.
Where admin is like 1, 2, and 3.
Then is set the session variables like:

[PHP]$query = mysql_query "SELECT * FROM admin WHERE username='user' AND password='password' LIMIT 1";

$admin = mysql_fetch_array($query);
session_start();
//set session variables
$_session['user'] = $admin['username'];
$_session['password'] = $admin['password'];
$_session['admin'] = $admin['admin'];
[/PHP]

Then you can do some compares in your script like:
[PHP]
if ($_session['admin'] == 2){
//blalblalbla
}else{
//bliebliebliep
}[/PHP]

Maybe this will help you.

Gr Paul
Dec 31 '07 #2
motif
3
thank you very much for your advices but i still have some confusion what u mean by following

"" Then you can do some compares in your script like:
[PHP]
if ($session['admin'] == 2){
//blalblalbla
}else{
//bliebliebliep
}[/PHP]

""

do i need to check condition on every page and every role(admin)?? if
if ($session['admin'] == 2){
//show edit button
}else{
//view button
}[/PHP]

so other idea trick can also work??

regards
Dec 31 '07 #3
Markus
6,050 Expert 4TB
thank you very much for your advices but i still have some confusion what u mean by following

"" Then you can do some compares in your script like:
[PHP]
if ($session['admin'] == 2){
//blalblalbla
}else{
//bliebliebliep
}[/PHP]

""

do i need to check condition on every page and every role(admin)?? if
if ($session['admin'] == 2){
//show edit button
}else{
//view button
}[/PHP]

so other idea trick can also work??

regards
do i need to check condition on every page and every role(admin)??
Yes. It's simple - just do it on all pages that you need to check for.
Dec 31 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Andrew Clancy | last post by:
Hi, I am trying to set up VS Developer users with non-administrator rights debug ASP (3) in VB.Net, and of course manage IIS MMC. This has succeeeded on 3 machines, including my own - but since...
1
by: Andrew Clancy | last post by:
Hi, I'm reposting this question as no resultion as yet. Couple of updates, so re-read if you have seen before. I am trying to set up VS Developer users with non-administrator rights debug ASP...
12
by: Arno R | last post by:
Hi there, I just distributed an application in which I (try to) change db.properties depending on CurrentUser() For instance I set the property's AllowBypassKey and AllowBuiltinToolbars to False...
1
by: Stephan Neuhaus | last post by:
Hi all. I'm having a problem that's driving me nuts. I am not familiar with Access, but I have read the FAQ, searched google, read the Access Security FAQ, and looked at the Access Web, to no...
1
by: Philip Holder | last post by:
Hi, I downloaded an Access 97 application as an NT admin user, then switched to a standard NT user, but couldn't open the application. I get the error: "The MS Jet database engine cannot open...
1
by: Bill Nguyen | last post by:
I tried to rename a local folder (C:\Program Files\Microsoft Mappoint\Data) in my VB.NEt app but running into permission problem. I even granted full rights to ASPNET user to the folder in...
1
by: Derrick | last post by:
I have the asp.net web admin site setup on a box as a virtual directory, on a box that does not have vs2005. I can get to the home page of the admin site, can edit and save app settings on the...
2
by: Rudolf Bargholz | last post by:
Windows 2003 R2 Server DB2 Express C Version 9 DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09012" with level identifier "01030107". Informational tokens are "DB2...
8
by: aklein | last post by:
I was given a database to update and am running into the following problem: The database appears to have been secured using Access security (it is an MDB, not MDE). Every form etc that I try to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.