


Xnova (ogame) source code interpretation for PHP web game learning (4)_PHP tutorial
Jul 13, 2016 am 10:24 AM
5. User login (login.php)
At the beginning, we said that the entrance to the game is the index.php file; now that we have installed it, we naturally turn to the login process and start watching.
As usual, the previous section is a piece of code that we have introduced in advance, so we will not go into details; the difference is that the language file used is login.mo, and there is a LOGIN constant. As follows
1 2 3 4 5 6 7 8 |
|
Next is the structure we talked about before. The branch we entered for the first time is the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Mainly to obtain the number of registered users, the last registered users, and the current number of online users; and display the login welcome page, including the user data obtained previously.
Okay, now the user can choose to register and go to the previous chapter process, or enter the username and password to go to the login process.
1. First obtain the user’s record from the database based on the entered user
2. If there is a record, use md5 to determine whether the user’s password is correct
3. If the password is correct, check whether the user has selected the remember password function, which will be used later
4. include database configuration file config
5. Setcookie, which contains username, password, etc.
6. Redirect to frames.php file
If the first few judgments are correct, some error messages will appear and the login process will end. The message() function prompt will be used, as mentioned before.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
