V. User Login (login.php)
At the beginning, we said that the entrance of the game is index.php file, we have already installed, the nature turns to the login process, starts to look.
As usual, we will not go into the details of the code we have introduced, but the language file used is login.mo and a login constant. As follows
Define (' INSIDE ', true);
Define (' INSTALL ', false);
Define (' LOGIN ' , true);
$InLogin = true;
$xnova _root_path = './';
Include ($xnova _root_path. ' Extension.inc ');
Include ($xnova _root_path. ' Common. ' $PHPEX);
Next to 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}}} whe
RE 1 ', ' users ', true);
$LastPlayer = Doquery (' SELECT ' username ' from {table}} ' ORDER by ' register_time ' DESC ', ' 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 = $Play ersonline[' Onlinenow ']. "
/". $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 previous access to these user data.
OK, now the user can choose to register and turn to the previous chapter process, or enter the username and password into the login process.
1. Obtain this user's record from the database based on the user entered first
2. If there are records, then use MD5 to determine whether the user's password is correct
3. If the password is correct, see if the user has chosen to remember the password function, the following use
4. Include database configuration file config
5. Setcookie, there are user names, passwords, etc.
6. Redirect to frames.php file
The first few to determine if the words, there will be some error message, and the end of the login process, using the message () function prompts, said earlier.