PHP to get discuz Forum login user name, user group, user ID and other information implementation Code _php tutorial

Source: Internet
Author: User
Here is an easy way to log in 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", "R" Eserved_arr ");
foreach ($GLOBALS as $key = $value)
{
if (!in_array ($key, $reserved _arr))
{
Unset ($GLOBALS [$key]);
}
}
Unset ($reserved _arr, $value);

Put the above code at the beginning of any program, with the intention of not affecting the use of custom variables. This will read the login information into the $ctdf_userinfo array.

Or this is relatively simple oh, looking for a long time, this time is cool

http://www.bkjia.com/PHPjc/322759.html www.bkjia.com true http://www.bkjia.com/PHPjc/322759.html techarticle here is an easy way to log in directly using Discuz's include/common.inc.php. Copy the code code as follows: Include_once (".. /discuz/include/common.inc.php "); $CTDF _userinfo ...

  • Related Article

    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.