Here is an easy way to log in directly using Discuz's include/common.inc.php.
Copy the Code code 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", "R" Eserved_arr ");
foreach ($GLOBALS as $key = $value)
{
if (!in_array ($key, $reserved _arr))
{
Unset ($GLOBALS [$key]);
}
}
Unset ($reserved _arr, $value);
Put the above code at the beginning of any program, with the intention of not affecting the use of custom variables. This will read the login information into the $ctdf_userinfo array.
Or this is relatively simple oh, looking for a long time, this time is cool
The above introduces the free discuz forum PHP to get discuz Forum login user name, user group, user ID and other information implementation code, including free discuz forum content, I hope the PHP tutorial interested in a friend helpful.