MyBB Community Forums

Full Version: How to edit database user groups.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, im Debugger. Ive created a payment system using sellix, and once the user has paid it redirects them to a webhook and runs a function but it dosent seem to change the users group, im not sure of as why, i also dont get any errors, here is a snippet of the code, it would be great if anyone could help me find a fix, or tell me if im doing it wrong.

Code:

  1. <?php
    
    define("IN_MYBB", 1);
    require_once "./global.php";
    $userN = $mybb->user['uid'];
    $userG = $mybb->user['usergroup'];
    
    
    //get the nottifcation from sellix
    $payload = file_get_contents('php://input');
    
    
    $secret = "no";
    
    // get our signature header
    $header_signature = $_SERVER["HTTP_X_SELLIX_SIGNATURE"];
    
    //verify that notifcation came from sellix
    $signature = hash_hmac('sha512', $payload, $secret);
    if (hash_equals($signature, $header_signature)) {
    
        //decode the payload to json
        $jsonString = json_decode($payload, true);
    
        $event = $jsonString['event'];
        $data = $jsonString['data'];
        $uqid = $data['uniqid'];
        $status = $data['status'];
    
    
        if($status == 'COMPLETED'){
    
    
        $query = $db->query("UPDATE ".TABLE_PREFIX."users SET usergroup='3' WHERE uid='".$userN."'");
    
    
    
        }
    
    
    }
    
    ?>