shopnc ucenter 帐号通信

php

2013-12-12 15:20

shopnc

api/uc.php



function synlogin($get, $post) {

$uid = $get['uid'];

$username = $get['username'];

if(!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; }


$text = mb_convert_encoding($username, "UTF-8", "gbk");  //我uc是gbk的编码 所以需要转换一下

header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');

$member_info = $this->db->fetch_first("SELECT member.*,store.store_name,store.grade_id FROM ".$this->tablepre."member as member left join ".$this->tablepre."store as store on member.store_id = store.store_id  WHERE member.member_name='".$text."' and member.member_id=".$uid);

if(empty($member_info)) {

//主要该的就是这里.

$member_info = array();

$member_info['member_id'] = $uid;

$member_info['member_name'] = $text;

$member_info['member_time'] = time();

$member_info['member_login_time'] = $member_info['member_time'];

$member_info['member_old_login_time'] = $member_info['member_time'];

$member_info['member_state'] == '1';

$member_info['member_login_ip'] = $this->getIp();

$member_info['member_old_login_ip'] = $member_info['member_login_ip'];

$member_info = $this->db->query("insert into ".$this->tablepre."member (member_id,member_name,member_time,member_login_time,member_old_login_time,member_state,member_login_ip,member_old_login_ip,member_points) values ('{$member_info[member_id]}','$member_info[member_name]','$member_info[member_time]','$member_info[member_time]','$member_info[member_time]','1','$member_info[member_login_ip]','$member_info[member_login_ip]',100)");

unset($member_info);

$member_info = $this->db->fetch_first("SELECT member.*,store.store_name,store.grade_id FROM ".$this->tablepre."member as member left join ".$this->tablepre."store as store on member.store_id = store.store_id  WHERE member.member_name='".$text."' and member.member_id=".$uid);

// return false;

}



这样其他应用的帐号登陆。本站也会加入相同的帐号了。