This document 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:
Copy codeThe Code is as follows:
<? Php
Session_name ("Zjmainstay"); // The session name can be changed.
Session_start ();
$ _ SESSION ['admin _ user'] = "Y"; // The session variable name can be changed.
Session_write_close ();
?>
<Meta http-equiv = "refresh" content = "0; url = http://www.youdomain.com/administrator/">
[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 of the original file
Define ('ds', DIRECTORY_SEPARATOR); // Line 10 of the original file
// 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 illegal access! ');
} Else {
$ _ SESSION ['admin _ user'] = "Y"; // resume session usage
Session_write_close ();
}
// Add End
Login example: http://www.youdomain.com/myadmin.php
After the carriage return will automatically jump to: http://www.youdomain.com/administrator/ (original background login address)
And directly enter: The http://www.youdomain.com/administrator/ will prompt 'Deny illegal access' and exit.
Author: Zjmainstay
Source: http://www.cnblogs.com/Zjmainstay/