This article introduces an implementation code for automatic login and automatic verification in php. If you need it, please refer to it.
| The Code is as follows: |
Copy code |
$ Urls = parse_url ($ db_bbsurl ); $ Domain = $ urls ['host']; Include_once (R_P. 'require/admvclient. php '); $ Adm_oem = new Cnzz_Adm_Oem (); // Determine whether the user password exists in the config file PwCache: getData (D_P. "data/bbscache/adm_config.php"); // user name and password configuration file If (isset ($ adm_user) & isset ($ adm_pwd )){ $ Request = array ("adm_user" => $ adm_user, "adm_pwd" => $ adm_pwd, 'cms '=> 'PW '); $ Token = $ adm_oem-> get_appkey_once ($ request ); If ($ token <0 ){ If ($ token =-1 ){ Adminmsg ('pass parameter is null or pass parameter is not number '); } Else if ($ token =-2 ){ Adminmsg ('pass parameter password error '); } } Else { $ Apikey = $ token ['adm _ key']; } } Else { $ Key = md5 ($ domain. 'kclgiq7h '); $ Request = array ('cms '=> 'PW', 'domain '=> $ domain, 'key' => $ key ); $ Token = $ adm_oem-> reg_user_once ($ request ); If ($ token <0) {// exception If ($ token =-1 ){ Adminmsg ('key error '); } Else if ($ token =-2 ){ Adminmsg ('invalid Domain Name Length (1 ~ 64 )'); } Elseif ($ token =-3 ){ Adminmsg ('incorrect domain name input (such as Chinese characters )'); } Elseif ($ token =-4 ){ Adminmsg ('wrong domain name database insert '); } Elseif ($ token =-5 ){ Adminmsg ('IP User call page exceeds the threshold, and the threshold is tentatively set to 10 '); } } Elseif (is_array ($ token) & isset ($ token )){ $ Adm_user = $ token ['adm _ user']; $ Adm_pwd = $ token ['adm _ pwd']; $ Apikey = $ token ['adm _ key']; PwCache: setData (D_P. 'data/bbscache/adm_config.php ', "<? Phprn $ adm_user = ". $ adm_user."; rn $ adm_pwd = ". $ adm_pwd." rn?> "); } } |