PHP permission logon. how can this problem be solved?
Source: Internet
Author: User
PHP permission logon username (user): _____ password: _____ select identity (user_id): _____ & lt; ---- here is a drop-down menu, there are three student instructors and administrators who send data to login when submit is applied. how to write code in login in php PHP php permission login
User ):_____
Password ):_____
Select an identity (user_id): _____ <---- here is a drop-down menu with three values: student teacher and administrator.
When you press submit, data is transferred to login. php.
How to write code in login so that the logon records of different identities are recorded in the session and jump to different interfaces.
You can directly call the database connection code in config. php.
$ Db = mysql_connect ('localhost', 'root', '000000') or die (database connection failed !);
Mysql_select_db ('bishe ');
?>
I have never used a SESSION and I don't know how to write it ····
------ Solution --------------------
Simple! Initialize SESSION at the beginning of session_start. You can assign a value to the $ _ SESSION Super global variable or read the variable.
Http://www.w3school.com.cn/php/php_sessions.asp
------ Solution --------------------
Session_start ();
...
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service