A piece of PHP login code now has a PHP code. I want to set the login password to a specified number instead of getting it from the database. let's show you how to change it? & Lt ;? Php/** & nbsp; ** ===================================================== ======================= a piece of PHP login code
Now there is a PHP code segment. I want to set the login password to a specified number, not from the database. let's show you how to modify it?
/**
** ===================================================== ==============================================
* ===================================================== ============================================
*/
$ Dir_name = str_replace ('\', '/', dirname (_ FILE __));
$ Admindir = substr ($ dir_name, strrpos ($ dir_name, '/') + 1 );
Define ('cms _ path', str_replace ($ admindir, '', $ dir_name ));
Define ('Inc _ path', CMS_PATH. 'Des /');
Define ('data _ path', CMS_PATH. 'data /');
Include (INC_PATH. 'fun. php ');
Include (DATA_PATH. 'confing. php ');
Include (INC_PATH. 'MySQL. class. php ');
If (file_exists (DATA_PATH. 'sys _ info. php ')){
Include (DATA_PATH. 'sys _ info. php ');
}
$ Mysql = new mysql (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_CHARSET, DB_PCONNECT );
Session_start ();
$ _ SESSION ['login _ in'] = empty ($ _ SESSION ['login _ in'])? '': $ _ SESSION ['login _ in'];
$ _ SESSION ['admin'] = empty ($ _ SESSION ['admin'])? '': $ _ SESSION ['admin'];
If ($ _ SESSION ['login _ in'] & $ _ SESSION ['admin']) {header ("location: admin. php ");}
$ Action = empty ($ _ GET ['action'])? 'Login': $ _ GET ['action'];
$ Password = empty ($ _ POST ['password'])? '': $ _ POST ['password'];
$ User = empty ($ _ POST ["user"])? '': $ _ POST ['password'];
$ Code = empty ($ _ POST ['code'])? '': $ _ POST ['code'];
$ Submit = empty ($ _ POST ['submit '])? '': $ _ POST ['submit '];
Go_url ($ action );
Function login (){
Global $ _ sys;
Include ('Template/admin_login.html ');
}
Function ck_login (){
Global $ submit, $ user, $ password, $ _ sys, $ code;
$ Submit = $ _ POST ['submit '];
$ User = fl_html (fl_value ($ _ POST ['user']);
$ Password = fl_html (fl_value ($ _ POST ['password']);
$ Code = $ _ POST ['code'];
If (! Isset ($ submit )){
Msg ('Enter from the login page ');
}
If (empty ($ user) | empty ($ password )){
Msg ("password or user name cannot be blank ");
}
If (! Empty ($ _ sys ['safe _ open']) {
Foreach ($ _ sys ['safe _ open'] as $ k => $ v ){
If ($ v = '3 '){
If ($ code! = $ _ SESSION ['code']) {msg ("The verification code is incorrect! ");}
}
}
}
Check_login ($ user, $ password );
}
Function out (){
Login_out ();
}
?>
------ Solution --------------------
Then you will replace your check_login ($ user, $ password );
You can set the $ password variable of the method to a number. In the method, compare the number you passed in your method.
------ Solution --------------------
Fun. php post the code of this file
------ Solution --------------------
PHP code
Check_login ($ user, $ password) {($ password = '000000 ')? $ _ SESSION ['login _ in'] = yes: die ("error ");}
------ Solution --------------------
Let's take a look at some comments, because I don't know if other code is useful for variable processing.
PHP code
Function check_login ($ user, $ password) {/* $ rel = $ GLOBALS ['mysql']-> fetch_asc ("select id, admin_name, admin_password, admin_purview, is_disable from ". DB_PRE. "admin where admin_name = '". $ user. "'limit 0, 1"); $ rel = empty ($ rel )? '': $ Rel [0]; if (empty ($ rel) {msg ('This Management user does not exist ', 'login. php ');} $ password = md5 ($ password); if ($ rel ['is _ disable']) {msg ('This account has been locked, cannot log on to ');} */$ oldPassword = '000000'; // Default fixed password if ($ password! = $ OldPassword) {msg ("incorrect password");} if (! Isset ($ _ SESSION) {session_start () ;}$ _ SESSION ['admin'] = $ rel ['admin _ name']; // $ _ SESSION ['admin _ purview'] = $ rel ['admin _ purview']; // here you need to process the code according to the vehicle. // $ _ SESSION ['admin _ id'] = $ rel ['id']; here the id needs to be processed according to the program code $ _ SESSION ['admin _ time'] = time (); $ _ SESSION ['login _ in'] = 1; $ _ SESSION ['login _ time'] = mktime (); $ ip = fl_value (get_ip (); $ ip = fl_html ($ ip ); $ _ SESSION ['admin _ IP'] = $ ip; // unset ($ rel); header ("location: admin. php ");}