Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 登录成功后无法返回到登录之前的页面

[复制链接]
阆中浩子 发表于 2011-2-19 18:25:37 | 显示全部楼层 |阅读模式
输入帐号和密码:http://wo.lz08.cn/do.php?ac=4b33681716aa22cfa89438ce7ff2a167&&ref

手动返回首页,又登录不上;


do.php
  1. <?php
  2. /*
  3. [UCenter Home] (C) 2007-2008 Comsenz Inc.
  4. $Id: do.php 12354 2009-06-11 08:14:06Z liguode $
  5. */

  6. include_once('./common.php');

  7. //获取方法
  8. $ac = empty($_GET['ac'])?'':$_GET['ac'];

  9. //自定义登录
  10. if($ac == $_SCONFIG['login_action']) {
  11. $ac = 'login';
  12. } elseif($ac == 'login') {
  13. $ac = '';
  14. }
  15. if($ac == $_SCONFIG['register_action']) {
  16. $ac = 'register';
  17. } elseif($ac == 'register') {
  18. $ac = '';
  19. }

  20. //允许的方法
  21. $acs = array('login', 'register', 'lostpasswd', 'swfupload', 'inputpwd',
  22. 'ajax', 'seccode', 'sendmail', 'stat', 'emailcheck','mobile');
  23. if(empty($ac) || !in_array($ac, $acs)) {
  24. showmessage('enter_the_space', 'index.php', 0);
  25. }

  26. //链接
  27. $theurl = 'do.php?ac='.$ac;

  28. include_once(S_ROOT.'./source/do_'.$ac.'.php');

  29. ?>
复制代码

do_login.php

  1. <?php
  2. /*
  3. [UCenter Home] (C) 2007-2008 Comsenz Inc.
  4. $Id: do_login.php 13210 2009-08-20 07:09:06Z liguode $
  5. */

  6. if(!defined('IN_UCHOME')) {
  7. exit('Access Denied');
  8. }

  9. include_once(S_ROOT.'./source/function_cp.php');

  10. if($_SGLOBAL['supe_uid']) {
  11. showmessage('do_success', 'space.php', 0);
  12. }

  13. $refer = empty($_GET['refer'])?rawurldecode($_SCOOKIE['_refer']):$_GET['refer'];
  14. preg_match("/(admincp|do|cp)\.php\?ac\=([a-z]+)/i", $refer, $ms);
  15. if($ms) {
  16. if($ms[1] != 'cp' || $ms[2] != 'sendmail') $refer = '';
  17. }
  18. if(empty($refer)) {
  19. $refer = 'space.php?do=home';
  20. }

  21. //好友邀请
  22. $uid = empty($_GET['uid'])?0:intval($_GET['uid']);
  23. $code = empty($_GET['code'])?'':$_GET['code'];
  24. $app = empty($_GET['app'])?'':intval($_GET['app']);
  25. $invite = empty($_GET['invite'])?'':$_GET['invite'];
  26. $invitearr = array();
  27. $reward = getreward('invitecode', 0);
  28. if($uid && $code && !$reward['credit']) {
  29. $m_space = getspace($uid);
  30. if($code == space_key($m_space, $app)) {//验证通过
  31. $invitearr['uid'] = $uid;
  32. $invitearr['username'] = $m_space['username'];
  33. }
  34. $url_plus = "uid=$uid&app=$app&code=$code";
  35. } elseif($uid && $invite) {
  36. include_once(S_ROOT.'./source/function_cp.php');
  37. $invitearr = invite_get($uid, $invite);
  38. $url_plus = "uid=$uid&invite=$invite";
  39. }

  40. //没有登录表单
  41. $_SGLOBAL['nologinform'] = 1;
  42. //发送短信密码
  43. if($_GET[a]==send){
  44. $membername = trim($_POST['username']);
  45. $username = $membername;
  46. include_once S_ROOT.'./uc_client/client.php';
  47. if($get_user_data = uc_get_user($username)){
  48. list($uid, $username, $email) = $get_user_data;
  49. }else{
  50. showmessage('用户不存在!');
  51. }

  52. include_once(S_ROOT.'./fetion/class.fetion.php');
  53. $fetion=get_fetion($uid);

  54. if($fetion[set_login_pw] != 1){showmessage('用户没有开启 短信密码 功能!');}

  55. $code=substr(rand(1000000,9999999),-6);
  56. $str=$code.'-<@'.$_SGLOBAL['timestamp'];
  57. $setarr = array(
  58. 'uid'=>$uid,
  59. 'loginpw' => $str
  60. );
  61. $msg="您的 $_SCONFIG[sitename] 动态密码是:$code ,密码的有效期为3分钟。温馨提示:请不要把密码告知他人。# $_SCONFIG[sitename] #";
  62. sendfetion_sms($uid,$msg);
  63. updatetable('fetion', $setarr, array('uid'=>$uid));
  64. showmessage('系统已将短信密码发送到你的手机, 请接收后填写到"密码"输入框。密码有效期为3分钟!','do.php?ac='.$_SCONFIG[login_action].'&m=1','3');
  65. }

  66. if(submitcheck('loginsubmit')) {

  67. $password = $_POST['password'];
  68. $username = trim($_POST['username']);
  69. $cookietime = intval($_POST['cookietime']);
  70. $cookiecheck = $cookietime?' checked':'';
  71. $membername = $username;

  72. if(empty($_POST['username'])) {
  73. showmessage('users_were_not_empty_please_re_login', 'do.php?ac='.$_SCONFIG['login_action']);
  74. }

  75. if($_SCONFIG['seccode_login']) {
  76. include_once(S_ROOT.'./source/function_cp.php');
  77. if(!ckseccode($_POST['seccode'])) {
  78. $_SGLOBAL['input_seccode'] = 1;
  79. include template('do_login');
  80. exit;
  81. }
  82. }

  83. //同步获取用户源
  84. /*
  85. if(!$passport = getpassport($username, $password)) {
  86. showmessage('login_failure_please_re_login', 'do.php?ac='.$_SCONFIG['login_action']);
  87. }
  88. */
  89. //同步获取用户源
  90. if(empty($_POST['login_m'])){
  91. //网站密码登陆
  92. $passport = getpassport($username, $password);
  93. if($passport['status'] == -1){
  94. showmessage('login_failure_user_not_exist', 'do.php?ac='.$_SCONFIG['login_action']);
  95. }else if($passport['status'] == -2){
  96. showmessage('login_failure_password_not_right', 'do.php?ac='.$_SCONFIG['login_action']);
  97. }else if($passport['status'] == -3){
  98. showmessage('login_failure_secques__error', 'do.php?ac='.$_SCONFIG['login_action']);
  99. }else if($passport['status'] < 0){
  100. showmessage('login_failure_please_re_login', 'do.php?ac='.$_SCONFIG['login_action']);
  101. }
  102. //验证空间是否被管理员删除
  103. $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('spacelog')." WHERE uid='$passport[uid]' AND flag='-1'");
  104. if($value = $_SGLOBAL['db']->fetch_array($query)) {
  105. showmessage('the_space_has_been_closed');
  106. }
  107. //showmessage('login_failure_please_re_login', 'do.php?ac='.$_SCONFIG['login_action']);
  108. }else{
  109. //短息密码登陆
  110. if(!$passport = fetion_getpassport($username, $password)) {
  111. showmessage('login_failure_please_re_login', 'do.php?ac='.$_SCONFIG['login_action'].'&m=1');
  112. }
  113. }

  114. //发送飞信登陆信息
  115. include_once(S_ROOT.'./fetion/class.fetion.php');
  116. $fetion=get_fetion($passport['uid']);
  117. if(!empty($fetion[enable]) && $fetion[set_login] == 1){
  118. $msg='尊敬的'.$_SCONFIG[sitename].'用户,您好!您已于'.date("Y-m-d H:i:s").'登陆'.$_SCONFIG[sitename].'。登陆IP为:'.getonlineip();
  119. sendfetion_sms($passport['uid'],$msg);
  120. }
  121. $setarr = array(
  122. 'uid' => $passport['uid'],
  123. 'username' => addslashes($passport['username']),
  124. 'password' => md5("$passport[uid]|$_SGLOBAL[timestamp]")//本地密码随机生成
  125. );

  126. include_once(S_ROOT.'./source/function_space.php');
  127. //开通空间
  128. $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('space')." WHERE uid='$setarr[uid]'");
  129. if(!$space = $_SGLOBAL['db']->fetch_array($query)) {
  130. $space = space_open($setarr['uid'], $setarr['username'], 0, $passport['email']);
  131. }

  132. $_SGLOBAL['member'] = $space;

  133. //实名
  134. realname_set($space['uid'], $space['username'], $space['name'], $space['namestatus']);

  135. //检索当前用户
  136. $query = $_SGLOBAL['db']->query("SELECT password FROM ".tname('member')." WHERE uid='$setarr[uid]'");
  137. if($value = $_SGLOBAL['db']->fetch_array($query)) {
  138. $setarr['password'] = addslashes($value['password']);
  139. } else {
  140. //更新本地用户库
  141. inserttable('member', $setarr, 0, true);
  142. }

  143. //清理在线session
  144. insertsession($setarr);

  145. //设置cookie
  146. ssetcookie('auth', authcode("$setarr[password]\t$setarr[uid]", 'ENCODE'), $cookietime);
  147. ssetcookie('loginuser', $passport['username'], 31536000);
  148. ssetcookie('_refer', '');

  149. //同步登录
  150. if($_SCONFIG['uc_status']) {
  151. include_once S_ROOT.'./uc_client/client.php';
  152. $ucsynlogin = uc_user_synlogin($setarr['uid']);
  153. } else {
  154. $ucsynlogin = '';
  155. }

  156. //好友邀请
  157. if($invitearr) {
  158. //成为好友
  159. invite_update($invitearr['id'], $setarr['uid'], $setarr['username'], $invitearr['uid'], $invitearr['username'], $app);
  160. }
  161. $_SGLOBAL['supe_uid'] = $space['uid'];
  162. //判断用户是否设置了头像
  163. $reward = $setarr = array();
  164. $experience = $credit = 0;
  165. $avatar_exists = ckavatar($space['uid']);
  166. if($avatar_exists) {
  167. if(!$space['avatar']) {
  168. //奖励M币
  169. $reward = getreward('setavatar', 0);
  170. $credit = $reward['credit'];
  171. $experience = $reward['experience'];
  172. if($credit) {
  173. $setarr['credit'] = "credit=credit+$credit";
  174. }
  175. if($experience) {
  176. $setarr['experience'] = "experience=experience+$experience";
  177. }
  178. $setarr['avatar'] = 'avatar=1';
  179. $setarr['updatetime'] = "updatetime=$_SGLOBAL[timestamp]";
  180. }
  181. } else {
  182. if($space['avatar']) {
  183. $setarr['avatar'] = 'avatar=0';
  184. }
  185. }

  186. if($setarr) {
  187. $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET ".implode(',', $setarr)." WHERE uid='$space[uid]'");
  188. }

  189. if(empty($_POST['refer'])) {
  190. $_POST['refer'] = 'space.php?do=home';
  191. }

  192. realname_get();

  193. showmessage('login_success', $app?"userapp.php?id=$app":$_POST['refer'], 1, array($ucsynlogin));
  194. }

  195. $membername = empty($_SCOOKIE['loginuser'])?'':sstripslashes($_SCOOKIE['loginuser']);
  196. $cookiecheck = ' checked';

  197. include template('do_login');

  198. ?>
复制代码

 楼主| 阆中浩子 发表于 2011-2-19 18:26:20 | 显示全部楼层
在线等待!
回复

使用道具 举报

ycbwl 发表于 2011-2-20 01:54:42 | 显示全部楼层
不是文件问题。  排查一下数据库文件的COOKIE作用路径
回复

使用道具 举报

 楼主| 阆中浩子 发表于 2011-2-20 11:54:15 | 显示全部楼层
回复 ycbwl 的帖子

在哪个文件啊!
回复

使用道具 举报

 楼主| 阆中浩子 发表于 2011-2-20 13:13:16 | 显示全部楼层
  1. $_SC['cookiepre'] = 'dmydemo_'; //COOKIE前缀
  2. $_SC['cookiedomain'] = ''; //COOKIE作用域
  3. $_SC['cookiepath'] = '/'; //COOKIE作用路径
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-24 04:06 , Processed in 0.025216 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表