Home » Php » php – Insert dynamic function on function

php – Insert dynamic function on function

Posted by: admin February 25, 2020 Leave a comment

Questions:

So… every time i access this file (included by a function) i get:

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /srv/disk1/3203065/www/example.com/content/addons/thbs_owner_addon/functions/instant_info.php on line 6

Why?

File:

<?php 
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$dblickenzo = mysqli_connect('remotemysql.com', 'sLugg4L9bm', 'Uq6K9ai5O0');
mysqli_select_db($dblickenzo,"sLugg4L9bm");
global $instant_info_item, $dblickenzo;
if(addon_activated("thbs_owner_addon") == "YES"){
    if (strpos($instant_info_item, 'THBS License Starter') !== false) {
            $code = random_str(16);
            $querya = "INSERT INTO `licenses` (`code`, `plan`, `clients`, `base_URL`, `referrer_license`, `expire_date`) VALUES ('$code', 'Starter', 250, '$wo_domain', '0', '$woExpire_on')";
            mysqli_query($dblickenzo , $querya) or die("THBS License addon error SQL: ".mysqli_error($dblickenzo);
            echo "License key: ".$code;
    }
    if (strpos($instant_info_item, 'THBS License Pro') !== false) {
        $code = random_str(16);
        $querya = "INSERT INTO `licenses` (`code`, `plan`, `clients`, `base_URL`, `referrer_license`, `expire_date`) VALUES ('$code', 'Pro', 500, '$wo_domain', '0', '$woExpire_on')";
        mysqli_query($dblickenzo , $querya) or die("THBS License addon error SQL: ".mysqli_error($dblickenzo);
        echo "License key: ".$code; 
    }
    if (strpos($instant_info_item, 'THBS License Business') !== false) {
            $code = random_str(16);
            $querya = "INSERT INTO `licenses` (`code`, `plan`, `clients`, `base_URL`, `referrer_license`, `expire_date`) VALUES ('$code', 'Business', 999999999, '$wo_domain', '0', '$woExpire_on')";
            mysqli_query($dblickenzo , $querya) or die("THBS License addon error SQL: ".mysqli_error($dblickenzo);
            echo "License key: ".$code;
    }
    if (strpos($instant_info_item, 'THBS License Infinite') !== false) {
            $code = random_str(16);
            $querya = "INSERT INTO `licenses` (`code`, `plan`, `clients`, `base_URL`, `referrer_license`, `expire_date`) VALUES ('$code', 'Infinite', 999999999, '$wo_domain', '0', '$woExpire_on')";
            mysqli_query($dblickenzo , $querya) or die("THBS License addon error SQL: ".mysqli_error($dblickenzo);
            echo "License key: ".$code;
    }

}

Function that is including this file (in my functions.php):

function instant_info($item_name)
{
    global $_LANG;
    $instant_info_item = $item_name;
    $a = dir("content/addons/");
        while (false !== ($entry = $a->read()))
        {
            if (is_dir("content/addons/$entry") && $entry != '.' && $entry != '..') {
                if (file_exists("content/addons/".$entry."/functions/instant_info.php")) {
                    ob_start();
                    include_once("content/addons/".$entry."/functions/instant_info.php");
                    $info = ob_get_clean();
                }
            }

        }
        $a->close();
    return $info;
}

There are correct database details.

How to&Answers: