PHP to obtain discuz forum login user name, user group, user ID information such as the implementation Code _php instance

Source: Internet
Author: User
Tags reserved
Here's a simple way to log in directly using Discuz's include/common.inc.php.
Copy 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);

Place the above code at the beginning of any program to not affect the use of custom variables. This reads the login information into the $ctdf_userinfo array.

Or this is relatively simple oh, look for a long time, this time it's cool

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.