PHP User Registration and Login "1"

Source: Internet
Author: User

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:

    1. Registration Information Form Fill-in interface JavaScript scripts initially detect user-entered registration information.
    2. The registration processing module detects whether the registration information meets the requirements.
    3. Detects if the user name already exists.
    4. The registration information is written to the data table and registered successfully.
User Login

The main functions of user login are:

    1. The login form interface JavaScript script initially detects the login information entered by the user.
    2. The login module checks the user input information with the database data.
    3. If the login information is correct, you are prompted to log on successfully and set the user to login status (session).
    4. 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:

    1. Cancel the session unconditionally.
User Center

The main features of user exit are:

    1. Determine if the user is logged in, and if not, turn to the login screen.
    2. 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"

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.