Home > Backend Development > PHP Tutorial > discuz 登录接口成功,跳转到首页没有显示登录成功状态

discuz 登录接口成功,跳转到首页没有显示登录成功状态

WBOY
Release: 2016-06-06 20:25:26
Original
1474 people have browsed it

discuz 登录接口成功,跳转到首页没有显示登录成功状态.
登录接口代码如下

$usernames = $_GET["username"];
$passwords = $_GET["password"];

list($uid, $username, $password, $email) = uc_user_login($usernames, $passwords);

if($uid > 0) {

<code> echo '登录成功';
echo uc_user_synlogin($uid);

setcookie('uid',$uid);
header("Location: http://localhost/discuz/upload/forum.php");</code>
Copy after login
Copy after login

} elseif($uid == -1) {

<code>echo '用户不存在,或者被删除';</code>
Copy after login
Copy after login

} elseif($uid == -2) {

<code>echo '密码错';</code>
Copy after login
Copy after login

} else {

<code>echo '未定义';</code>
Copy after login
Copy after login

}
有大神吗?帮我看下

回复内容:

discuz 登录接口成功,跳转到首页没有显示登录成功状态.
登录接口代码如下

$usernames = $_GET["username"];
$passwords = $_GET["password"];

list($uid, $username, $password, $email) = uc_user_login($usernames, $passwords);

if($uid > 0) {

<code> echo '登录成功';
echo uc_user_synlogin($uid);

setcookie('uid',$uid);
header("Location: http://localhost/discuz/upload/forum.php");</code>
Copy after login
Copy after login

} elseif($uid == -1) {

<code>echo '用户不存在,或者被删除';</code>
Copy after login
Copy after login

} elseif($uid == -2) {

<code>echo '密码错';</code>
Copy after login
Copy after login

} else {

<code>echo '未定义';</code>
Copy after login
Copy after login

}
有大神吗?帮我看下

你没了解接口是什么吗?

接口只是给你处理数据,数据交互的。

没有去记录session或者cookies,等你自己去判断,登录成功就将uid或者username存到session里面,需要你自己来完成。

获取用户数据

<code>array uc_get_user(string username [, bool isuid])</code>
Copy after login

etc……

再用别的函数该干嘛干嘛。

OK?

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template