Here is a simple method to log on directly using discuz's include/common. inc. php.
Copy codeThe 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, so as not to affect the use of custom variables. In this way, the logon information is read to the $ CTDF_USERINFO array.
It's still relatively simple. I 've been searching for a long time and it's so nice this time.