Home > Backend Development > PHP Tutorial > Free discuz forum implementation code for obtaining Discuz forum login user name, user group, user ID and other information under PHP

Free discuz forum implementation code for obtaining Discuz forum login user name, user group, user ID and other information under PHP

WBOY
Release: 2016-07-29 08:44:01
Original
1743 people have browsed it

Here is a simple method, directly use include/common.inc.php of discuz to log in.

Copy the code The code is as follows:


include_once("../discuz/include/common.inc.php");
$CTDF_USERINFO = array();
$CTDF_USERINFO["sid"] = $ sid;
$CTDF_USERINFO["uid"] = $discuz_uid;
$CTDF_USERINFO["user"] = $discuz_user;
if ($discuz_uid == 0)
{
$CTDF_USERINFO["user"] = "guest_" . $sid;
}
$CTDF_USERINFO["groupid"] = $groupid;
/**
* clear discuz variables
*/
$reserved_arr = array("GLOBALS", "_POST", "_GET", "_COOKIE", "_FILES ", "_SERVER", "_ENV", "_REQUEST", "CTDF_USERINFO", "reserved_arr");
foreach ($GLOBALS as $key => $value)
{
if (!in_array($key, $reserved_arr ))
{
unset($GLOBALS[$key]);
}
}
unset($reserved_arr, $value);


Place the above code at the beginning of any program, its purpose is not to affect Use of custom variables. This will read the login information into the $CTDF_USERINFO array.
This one is relatively simple. I’ve been looking for it for a long time and I’m happy with it this time.

The above introduces the implementation code of free discuz forum to obtain Discuz forum login user name, user group, user ID and other information under PHP, including the content of free discuz forum. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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