日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

ecshop 整合 QQ登陆 和 支付宝快捷登陆代码

發(fā)布時(shí)間:2025/4/14 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ecshop 整合 QQ登陆 和 支付宝快捷登陆代码 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

首先 目錄結(jié)構(gòu)

我基本上是把 文檔里面的 有用的直接上傳進(jìn)了 /api/里面然后 分別登陸 處理 、返回文件 分別寫在了 qqlogin.php ?和 alipaylogin.php 文件里面

QQ

<?php define('IN_ECS', true);require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/user.php'); require(ROOT_PATH.'api/QQConnect/API/qqConnectAPI.php'); $user_id = $_SESSION['user_id'];$action = isset($_REQUEST['act']) ? trim($_REQUEST['act']) : 'default'; $qc = new Qc(); if($action == 'default') {$qc->qq_callback();$open_id = $qc->get_openid();//根據(jù) OPEN_ID 判斷數(shù)據(jù)$sql = "SELECT * FROM".$ecs->table('users')." where qq_open_id = '".$open_id."'";$row = $db->getRow($sql);if($row){//曾經(jīng)登陸過,存在信息 ,調(diào)用信息登錄$username = $row['user_name'];$password = $row['user_name'];if ($user->login($username, $password,isset($_POST['remember']))){update_user_info();recalculate_price();$ucdata = isset($user->ucdata)? $user->ucdata : '';show_message($_LANG['login_success'] . $ucdata , array($_LANG['back_up_page'], $_LANG['profile_lnk']), array($back_act,'user.php'), 'info');}else{show_message($_LANG['login_failure'], $_LANG['relogin_lnk'], '#" onClick="Hongru.box.open(document.getElementById(\'dengludiv\').innerHTML,{isBar:0,width:0,height:0})" ', 'error');}}else{//注冊(cè)新用戶include_once(ROOT_PATH . 'includes/lib_passport.php');$username = 'qq_'.time();$password = 'qq_'.time();$email = 'qq_login'.time().'@qq.com';$other['qq_open_id'] = $open_id;if (register($username, $password, $email, $other) !== false){//$user = $qc->get_user_info();header("Location:flow.php");die();}else{show_message('QQ登陸異常,請(qǐng)聯(lián)系網(wǎng)站人員! ');exit();}}//處理QQ 登陸的用戶的信息 }elseif($action == 'login') {if($_SESSION['user_id']>0){show_message('您已經(jīng)登錄了! ');header("Location:/");}else{$qc->qq_login();}}

支付寶的

<?php define('IN_ECS', true);require(dirname(__FILE__) . '/includes/init.php'); require_once("/api/alipay/alipay.config.php"); require_once("/api/alipay/lib/alipay_notify.class.php");$user_id = $_SESSION['user_id'];//計(jì)算得出通知驗(yàn)證結(jié)果 $alipayNotify = new AlipayNotify($alipay_config); $verify_result = $alipayNotify->verifyReturn(); if($verify_result) {//驗(yàn)證成功//支付寶用戶號(hào)$open_id = $_GET['user_id'];$real_name = $_GET['real_name'];//授權(quán)令牌$token = $_GET['token'];$_SESSION['is_alipay'] = 1;//根據(jù) OPEN_ID 判斷數(shù)據(jù)$sql = "SELECT * FROM".$ecs->table('users')." where alipay_open_id = '".$open_id."'";$row = $db->getRow($sql);if($row){//曾經(jīng)登陸過,存在信息 ,調(diào)用信息登錄$username = $row['user_name'];$password = $row['$open_id'];if ($user->login($username, $password,isset($_POST['remember']))){update_user_info();recalculate_price();$ucdata = isset($user->ucdata)? $user->ucdata : '';show_message($_LANG['login_success'] . $ucdata , array($_LANG['back_up_page'], $_LANG['profile_lnk']), array($back_act,'user.php'), 'info');}else{$_SESSION['login_fail'] ++ ;show_message($_LANG['login_failure'], $_LANG['relogin_lnk'], '#" onClick="Hongru.box.open(document.getElementById(\'dengludiv\').innerHTML,{isBar:0,width:0,height:0})" ', 'error');}}else{//注冊(cè)新用戶include_once(ROOT_PATH . 'includes/lib_passport.php');$username = $real_name;$password = $open_id;$email = 'alipay'.time().'@alipay.com';$other['alipay_open_id'] = $open_id;if (register($username, $password, $email, $other) !== false){ header("Location:flow.php");die();}else{show_message('登陸異常,請(qǐng)聯(lián)系網(wǎng)站人員! ');exit();}}} else {//驗(yàn)證失敗//如要調(diào)試,請(qǐng)看alipay_notify.php頁面的verifyReturn函數(shù)echo "驗(yàn)證失敗,請(qǐng)聯(lián)系管理人員!"; }

360 存在 session 丟失問題 如有知道怎么解決的 請(qǐng)指導(dǎo) ?感激不盡

?

轉(zhuǎn)載于:https://www.cnblogs.com/yxbs/archive/2013/02/01/2889196.html

總結(jié)

以上是生活随笔為你收集整理的ecshop 整合 QQ登陆 和 支付宝快捷登陆代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。