V. User Login (login.php)
At the beginning, we said that the entrance to the game is index.php file; we've installed it, and naturally turned to the login process to start looking.
As usual is a section of the code we have introduced, we will no longer speak in detail; the difference is that the language file used is Login.mo, and there is a login constant. As follows
Define (' INSIDE ', true);d efine (' INSTALL ', false);d efine (' LOGIN '
And then again, the structure we talked about earlier, the first branch we saw was the following code:
$parse = $lang; $Count = Doquery (' SELECT Count (*) as ' players ' from {{ Table}} WHERE 1 ', ' users ', true); $LastPlayer = Doquery (' SELECT ' username ' from {{table}}} ORDER by ' Register_time ' DES C ', ' users ', true); $parse [' last_user '] = $LastPlayer [' username ']; $PlayersOnline = Doquery ("Select COUNT (DISTINCT (ID)) As ' Onlinenow ' from {{table}} WHERE ' Onlinetime ' > ' ". (Time () -900). "';", ' users ', true); $parse [' online_users '] = $PlayersOnline [' Onlinenow ']; $parse [' users_amount '] = $ count[' players '; $parse [' servername '] = $game _config[' game_name ']; $parse [' forum_url '] = $game _config[' Forum_url ']; $parse [' passwordlost '] = $lang [' Passwordlost ']; $page = parsetemplate (gettemplate (' Login_body '), $parse);//Test pour Prendre le nombre total de joueur et le nombre de joueurs connect 閟 if ($_get[' ucount '] = = 1) {$page = $PlayersOnline [' Onli Nenow ']. " /". $Count [' players ']; Die ($page);} else {display ($page, $lang [' Login ']);}
The main is to obtain the number of registered users, the last registered users, the current number of online, and display the landing welcome page, including the previously obtained user data.
OK, now the user can choose to register and turn to the previous chapter process, or enter a username and password into the login process.
1. Obtain this user's record from the database based on the user entered.
2. If there is a record, use MD5 to determine if the user's password is correct
3. If the password is correct, see if the user has chosen to remember the password function, followed by
4. Include database configuration file config
5. Setcookie, there is a user name, password, etc.
6. Redirect to frames.php file
Some of the previous judgments, there will be some error message, and the end of the login process, using the message () function hint, the previous also said.