Register the session through a specific file as the background entry; otherwise, the session fails to exit. You cannot log on to the background directly using the original background address. In this way, the diversity and changeable nature of the entry file name will provide a safer environment for your background login. This article uses Joomla! The background link is used as an example to explain how to "modify" our background link to make it more secure.
Principle: use a specific file to register a session for the background Portal. Otherwise, the session fails to exit. You cannot log on to the background directly using the original background address. In this way, the diversity and changeable nature of the entry file name will provide a safer environment for your background login.
1. entry File: myadmin. php (the file name can be changed at any time)
Purpose: register a session. The source code is as follows:
The code is as follows:
[Html]
2. modify the background Portal File:/administrator/index. php (it can start with any CMS portal file)
Purpose: access through session control. The source code is as follows:
[Code]
Define ('_ JEXEC', 1); // Line 9 define ('DS ', DIRECTORY_SEPARATOR) of the original file ); // original file Line 10 // Add session_name ("Zjmainstay"); session_start (); $ OK _to_browse = ($ _ SESSION ['admin _ user'] = "Y"); if (! $ OK _to_browse) {header ("Content-type: text/html; charset = utf-8"); exit ('deny unauthorized access! ');} Else {$ _ SESSION ['admin _ user'] = "Y"; // use session_write_close () to continue the session;} // Add End
The above is a simple method to make background login more secure (adding session verification in php) content. For more information, please follow the PHP Chinese network (www.php1.cn )!