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.
Source: http://www.cnblogs.com/wangzong/archive/2010/12/13/1904509.html