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
3 3203
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
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
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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.
|
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.
|
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...
...
|
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...
|
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?
| |
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
|
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
|
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".
|
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."
|
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...
|
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...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |