Demand analysis
The main functions are divided into four parts: User registration, user login, user exit, User Center.
User Registration
The main functions of user registration are:
- Registration Information Form Fill-in interface JavaScript scripts initially detect user-entered registration information.
- The registration processing module detects whether the registration information meets the requirements.
- Detects if the user name already exists.
- The registration information is written to the data table and registered successfully.
User Login
The main functions of user login are:
- The login form interface JavaScript script initially detects the login information entered by the user.
- The login module checks the user input information with the database data.
- If the login information is correct, you are prompted to log on successfully and set the user to login status (session).
- The logon information is incorrect, prompting the login to fail and the user can try to log in again.
User exits
The main features of user exit are:
- Cancel the session unconditionally.
User Center
The main features of user exit are:
- Determine if the user is logged in, and if not, turn to the login screen.
- If the login is logged in, the user-related information is read.
Data Sheet Design
According to the function requirement analysis, the user table used to remember the users information needs the following fields:
Field name |
Data Type |
Description |
Uid |
Mediumint (8) |
Primary key, auto-grow |
Username |
CHAR (15) |
Registered user Name |
Password |
CHAR (32) |
MD5 Password after encryption |
Email |
varchar (40) |
User Email |
RegDate |
Int (10) |
User Registration Timestamp |
The table SQL reference is as follows:
1 CREATE TABLE`User` (2' UID ' mediumint (8) unsigned not NULLAuto_increment,3' Username 'Char( the) not NULL default "',4' Password 'Char( +) not NULL default "',5' Email 'varchar( +) not NULL default "',6' RegDate 'int(Ten) unsigned not NULL default '0',7 PRIMARY KEY(' uid ')8) ENGINE=MyISAMDEFAULTCHARSET=UTF8 auto_increment=1;
Page layout
The functions of each page are as follows:
- Reg.html: User registration information fill out the form page
- conn.php: Database connection contains files
- reg.php: User Registration Handler
- login.html: User Login Form page
- login.php: User Login Form page
- my.php: User Center
PHP User Registration and Login "1"