PHP obtains the login user name, user group, and user ID of the discuz forum.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.