Here is a simple method, directly use include/common.inc.php of discuz to log in.
Copy 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);
Put the above code in At the beginning of any program, the purpose is not to affect the use of custom variables. This will read the login information into the $CTDF_USERINFO array.
This is relatively simple. I’ve been looking for it for a long time and I’m happy with it this time.
http://www.bkjia.com/PHPjc/322759.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322759.htmlTechArticleHere is a simple method, directly use discuz’s include/common.inc.php to log in. Copy the code The code is as follows: include_once("../discuz/include/common.inc.php"); $CTDF_USERINFO...