目前官方随着ECShop V2.73的发布也发布了相对应的EC助理1.30版。默认EC助理1.28也支持到ECShop V2.72,要想让EC助理1.28也支持到ECShop V2.73,那要了解ECShop V2.73在ECShop V2.72上都做了哪些改变。我就讲了。EC助理1.28下载,下载后请根据里面的文档和教程安装。
安装完成后我们按照教程连接我们ECShop V2.73网站时会直接抛出一个用户名或者密码错误的提示,这时打开上传到服务器上的接口目录assistant_utf8下的ecaService.php文件,在51行会看到下面的代码:
function checkLogin($username,$password) { $username= base64_decode($username); $password= base64_decode($password); //$username = str_iconv(ECS_CHARSET, EC_CHARSET, $username); //$password = str_iconv(ECS_CHARSET, EC_CHARSET, $password); //return true; $sql= "SELECT user_id, user_name, password, last_login, action_list, last_login". " FROM ". $GLOBALS[‘ecs‘]->table(‘admin_user‘) . " WHERE user_name = ‘". $username."‘ AND password = ‘" . md5($password) ."‘"; $row= $GLOBALS[‘db‘]->getRow($sql); if($row) { returntrue; }else{ returnfalse; } }
修改这段代码之前,需要你到你网站数据库查看ecs_admin_user表中ec_salt这个字段的值,下面是我这个表的截图:
<pre name="code" class="php">function checkLogin($username, $password) { $username = base64_decode($username); $password = base64_decode($password); //$username = str_iconv(ECS_CHARSET, EC_CHARSET, $username); //$password = str_iconv(ECS_CHARSET, EC_CHARSET, $password); //return true; $sql = "SELECT user_id, user_name, password, last_login, action_list, last_login". " FROM " . $GLOBALS[‘ecs‘]->table(‘admin_user‘) . " WHERE user_name = ‘" . $username. "‘ AND password = ‘" . md5(md5($password).‘5606‘) . "‘"; $row = $GLOBALS[‘db‘]->getRow($sql); if ($row) { return true; }else{ return false; } }</pre><br><br>
注意这段代码的5606要替换成你数据库中对应的值,操作之后EC助理1.28就能完美支持ECShop V2.73了,简单吧。来说下原理,
ECShop V2.73得管理登录加密方式在之前的版本上做了改变,我们来看ECShop V2.73的管理员登录加密部分代码:
if(!empty($ec_salt)) { /* 检查密码是否正确 */ $sql= "SELECT user_id, user_name, password, last_login, action_list, last_login,suppliers_id,ec_salt". " FROM ". $ecs->table(‘admin_user‘) . " WHERE user_name = ‘". $_POST[‘username‘]. "‘AND password = ‘" . md5(md5($_POST[‘password‘]).$ec_salt) . "‘"; } else { /* 检查密码是否正确 */ $sql= "SELECT user_id, user_name, password, last_login, action_list, last_login,suppliers_id,ec_salt". " FROM ". $ecs->table(‘admin_user‘) . " WHERE user_name = ‘". $_POST[‘username‘]. "‘AND password = ‘" . md5($_POST[‘password‘]) . "‘"; }
更多相关问题访问布谷网。
时间: 2024-12-14 18:09:00