473,394 Members | 1,722 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,394 software developers and data experts.

PHP Admin & student login page issue !!

hi there,

I am asking that, is this possible to show links from admin page when admin login to the page in php. and when student login the admin links get hidden.

if yes please provide me the code for the same.
May 28 '13 #1
2 1379
use SESSION variables
from login, save it in a session
after a successful login, check the user's credentials
im assuming your data is already saved in a table (user name's,user level's, etc.)
then just check it if its an admin

Expand|Select|Wrap|Line Numbers
  1. <?php if($_SESSION['user_level'] == "admin"): ?>
  2. <a href="#">Dashboard</a>
  3. <?php endif; ?>
  4.  
Jun 18 '13 #2
You can accomplish this with the followings:

Let us suppose your database tables contains fields username, user_type etc.

user_type can be "admin" or "student"

Then after login you can save this user_type to Session variable like this:

Expand|Select|Wrap|Line Numbers
  1. // $user_type is the value of relevant field.
  2.  
  3. $_Session['user_type']=$user_type
  4.  
  5. if($_Session['user_type']=="admin"){
  6. //display admin links
  7. }else{
  8. //display student links
  9. }
Thanks.
Jun 18 '13 #3

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

Similar topics

4
by: SB | last post by:
Hi I'm trying to get forms-based authentication to authenticate different users for differet pages, like this: <configuration> <location path="Member" allowOverride="true"> <system.web>...
10
by: GreggTB | last post by:
I've got an page (LOGIN.ASPX) that receives the user's login information. During the page load, it checks the credentials against a database and, if validation is successful, creates an instance of...
5
by: RedEye | last post by:
Hello, I am working on a test site to explore the new login controls and membership features of ASP.NET v2.0. I have tested the controls using SQL Express and have now decided to try using a...
4
by: SJ | last post by:
I have a mobile web application running on a server at work. There is a strange thing happening though: 1) I can access and login to my mobile web app from any internet browser. (good thing). 2)...
6
by: =?Utf-8?B?eW9kYWt0?= | last post by:
I'm having issues with logging into my application after moving it from the development server to the live IIS server. Things I've already done: 1) I made sure that I have applicationName set as...
2
by: =?Utf-8?B?U2hhbm5vbg==?= | last post by:
I am trying to publish an application to a server that I do not have desktop access to because of our hosting environment. I publish to a file share. The WEB site has been configured by the hosts...
3
by: shanthiniramu | last post by:
hi... I have an issue in my hosted page while i'm login when i give an invalid email-id in my login page, the page does'nt show any alert message...... but i wrote coding to show that alert...
0
by: Anup Daware | last post by:
Hi All, I am facing this very weird issue, for every server request my control is redirecting to the login page and again coming back to the actual page from where the request was initiated when I...
12
by: tvnaidu | last post by:
I have Two kinds of web pagess, one is for control page for only admin login, another one is to view status for user login. initially both html files can view with 192.168.0.10/control.htm and other...
21
by: tvnaidu | last post by:
This is the Java script I am using fo rlogin page, but cursor not pointing to login box, any idea how can I point cursor to login box when this page loaded?. here admin login take to control page and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.