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);
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.