473,789 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

admin user permission

3 New Member
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 3203
djpaul
137 New Member
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='passw ord' LIMIT 1";

$admin = mysql_fetch_arr ay($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 New Member
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 Recognized Expert Expert
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
1896
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 then it hasnt been able to work, with seemingly exactly the same install & debug setup. All machines are Windows 2000 with IIS 5.0. My main 2 problems are: 1. the user cannot see the web site properties in MMC.
1
1756
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 (3) in VB.Net, and of course manage IIS MMC. This has succeeeded on 3 machines, including my own - but since then it hasnt been able to work, with seemingly exactly the same install & debug setup. All machines are Windows 2000 Pro with IIS 5.0.
12
3061
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 when CurrentUser() <> "xx" I just noticed that the property's can only be changed changed by a user belonging to 'Admins'. I never noticed this before. I could swear that in other apps (A97) this works fine without the user being an admin... ...
1
1794
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 avail. Briefly, the problem is this: I'm having an old Access 2.0 database that I want to convert to Access 2000 on a different computer. The reason why the new database is on a different computer is that the old database runs under Windows 95a...
1
1486
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 the file C:\Program Files...It is already opened exclusively by another user or you need permission to view its data". Any ideas?
1
1466
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 question but it's still not working. If I do it manually (my login has administrator rights to the local/client machine), I had no problem. Is there any way to assume the local admin role programmatically to do this? Thanks Bill
1
1538
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 app tab, but when I go to the security tab I get: The following message may help in diagnosing the problem: Value cannot be null. Parameter name: path If I click the "choose data store" button, I can see my conn str pointing at
2
2851
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 v9.1.200.166", "special_17369", "WR21380_17369", and Fix Pack "2".
8
2787
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 open (in the development environment) gives me 2 messages: 1) "You do not have exclusive access to the database at this time etc." 2) "You don't have permission to read frmWhatever... etc."
0
10374
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8998
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5540
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4078
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2898
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.