182010
 

题目已经说了要干神马了。。。贴代码吧:

function synlogin($get, $post) {
$uid = $get['uid'];
$username = $get['username'];
$password=$get['password'];
if(!API_SYNLOGIN) {
return API_RETURN_FORBIDDEN;
}
require_once $this->appdir.'./forumdata/cache/cache_settings.php';
require_once $this->appdir.'./uc_client/client.php';
$cookietime = 2592000;
$discuz_auth_key = md5($_DCACHE['settings']['authkey'].$_SERVER['HTTP_USER_AGENT']);
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$uid = intval($uid);
$query = $this->db->query("SELECT username, uid, password, secques FROM ".$this->tablepre."members WHERE uid='$uid'");
if($member = $this->db->fetch_array($query)) {
_setcookie('sid', '', -86400 * 365);
_setcookie('cookietime', $cookietime, 31536000);
_setcookie('auth', _authcode("$member[password]\t$member[secques]\t$member[uid]", 'ENCODE', $discuz_auth_key), $cookietime);
} else {
if($data = uc_get_user($username)) {
$this->db->query("INSERT INTO ".$this->tablepre."members(uid,username,password,email,groupid) VALUES ($uid,'$username','$password','$data[email]',10)");
$this->db->query("insert into ".$this->tablepre."memberfields(uid) values('$uid')");
$query = $this->db->query("SELECT username, uid, password, secques FROM ".$this->tablepre."members WHERE uid='$uid'");
if($member = $this->db->fetch_array($query)) {
_setcookie('sid', '', -86400 * 365);
_setcookie('cookietime', $cookietime, 31536000);
_setcookie('auth', _authcode("$member[password]\t$member[secques]\t$member[uid]", 'ENCODE', $discuz_auth_key), $cookietime);
}else{
_setcookie('cookietime', $cookietime, 31536000);
_setcookie('loginuser', $username, $cookietime);
_setcookie('activationauth', _authcode($username, 'ENCODE', $discuz_auth_key), $cookietime);
}
}
}
}

其中$this->db->query(“insert into “.$this->tablepre.”memberfields(uid) values(‘$uid’)”);
这句很重要哦,网上的解决方案好像都没有这句,导致了spache.php页面很多无法正常显示。。。

 Posted by at 5:26 下午