ECSHOP后臺(tái)退出頻率一兩分鐘就退出,總要要重新登錄很麻煩,通過(guò)以下方法可以解決:
打開(kāi) include/lib_base.php
找到 real_ip()函數(shù),在real_ip函數(shù)中添加紅色部分代碼:
將:
functionreal_ip() { static$realip= NULL; if($realip!== NULL) { return$realip; } if(isset($_SERVER)) { if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $arr= explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); /* 取X-Forwarded-For中第一個(gè)非unknown的有效IP字符串 */ foreach($arrAS $ip) { $ip= trim($ip); if($ip!= 'unknown') { $realip= $ip; break; } } } elseif(isset($_SERVER['HTTP_CLIENT_IP'])) { $realip= $_SERVER['HTTP_CLIENT_IP']; } else { if(isset($_SERVER['REMOTE_ADDR'])) { $realip= $_SERVER['REMOTE_ADDR']; } else { $realip= '0.0.0.0'; } } } else { if(getenv('HTTP_X_FORWARDED_FOR')) { $realip= getenv('HTTP_X_FORWARDED_FOR'); } elseif(getenv('HTTP_CLIENT_IP')) { $realip= getenv('HTTP_CLIENT_IP'); } else { $realip= getenv('REMOTE_ADDR'); } } preg_match("/[d.]{7,15}/", $realip, $onlineip); $realip= !empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0'; return$realip; }
替換成:
functionreal_ip() { static$realip= NULL; if($realip!== NULL) { return$realip; } /*添加*/ if(isset($_COOKIE['real_ipd']) && !empty($_COOKIE['real_ipd'])){ $realip= $_COOKIE['real_ipd']; return$realip; } /*添加*/ if(isset($_SERVER)) { if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $arr= explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); /* 取X-Forwarded-For中第一個(gè)非unknown的有效IP字符串 */ foreach($arrAS $ip) { $ip= trim($ip); if($ip!= 'unknown') { $realip= $ip; break; } } } elseif(isset($_SERVER['HTTP_CLIENT_IP'])) { $realip= $_SERVER['HTTP_CLIENT_IP']; } else { if(isset($_SERVER['REMOTE_ADDR'])) { $realip= $_SERVER['REMOTE_ADDR']; } else { $realip= '0.0.0.0'; } } } else { if(getenv('HTTP_X_FORWARDED_FOR')) { $realip= getenv('HTTP_X_FORWARDED_FOR'); } elseif(getenv('HTTP_CLIENT_IP')) { $realip= getenv('HTTP_CLIENT_IP'); } else { $realip= getenv('REMOTE_ADDR'); } } preg_match("/[d.]{7,15}/", $realip, $onlineip); $realip= !empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0'; /*添加*/setcookie("real_ipd", $realip, time()+36000, "/"); /*添加*/ return$realip; }
版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: ecshop解決后臺(tái)自動(dòng)退出的辦法