cunaedy / Cart-Engine

The small, yet powerful shopping cart based on PHP & MySQL.
https://www.c97.net/cart-engine-small-powerful-free-shopping-cart-script.php
5 stars 4 forks source link

Cart-Engine not accessible #11

Open WebbieFrank opened 4 years ago

WebbieFrank commented 4 years ago

Hi, I got messages from users they could not access the webshop (https://www.accordeonmuziek.ml/Cart-Engine-master/ When I tried, I got in, but when I clicked Login/Register, I got a 403 error. Below is the log output for today and my htaccess is set to _htaccess. Could you help, please? Thank you, Frankie. Log: [22-Jul-2020 13:04:28 UTC] PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/mvmotk/accordeonmuziek.ml/Cart-Engine-master/includes/function.php on line 106

Gerdix commented 4 years ago

Your error comes with PHP 7.3 A suggestion for solution is this, beginning /includes/function.php at line 95:

function filter_param($param, $mode = '')
{
    global $config;
    if (!is_array($param)) {
        $is_array = false;
        $params = array($param);
    } else {
        $is_array = true;
        $params = $param;
    }

    $cmd = explode(" ", $mode);
    foreach ($params as $k => $param) {
        $html = false;
        if (!$config['gpc_quotes']) {
            $param = addslashes($param);
        }
        $param = trim($param);
        foreach ($cmd as $cm) {
            if ($cm == 'noslash') {
                $param = stripslashes($param);
            }
            if ($cm == 'nohtml') {
                $param = strip_tags($param);
            }
            if ($cm == 'filterhtml') {
                $param = strip_tags($param, $config['allowed_html_tags']);
                $html = 1;
            }
            if ($cm == 'html') {
                $html = true;
            }
            if (($cm == 'rte') && ($config['wysiwyg'])) {
                $html = true;
            }
            if (($cm == 'rte') && (!$config['wysiwyg'])) {
                $html = false;
            }
        }

        if (!$html) {
            $param = htmlspecialchars($param, ENT_QUOTES);
        }
        $params[$k] = $param;
    }

    if (!$is_array) {
        return $params[0];
    } else {
        return $params;
    }
}`

replaced:

function filter_param($param, $mode = '')
{
    global $config;
    $html = 0;
    if (!$config['gpc_quotes']) {
        $param = addslashes($param);
    }

    $param = trim($param);
    $cmd = explode(" ", $mode);
    reset($cmd);
    while (list($key, $cm) = each($cmd)) {
        if ($cm == 'noslash') {
            $param = stripslashes($param);
        }
        if ($cm == 'nohtml') {
            $param = strip_tags($param);
        }
        if ($cm == 'filterhtml') {
            $param = strip_tags($param, $config['allowed_html_tags']);
            $html = 1;
        }
        if ($cm == 'html') {
            $html = 1;
        }
        if (($cm == 'rte') && ($config['wysiwyg'])) {
            $html = 1;
        }
        if (($cm == 'rte') && (!$config['wysiwyg'])) {
            $html = 0;
        }
    }

    if ($html) {
        return $param;
    } else {
        return htmlspecialchars($param, ENT_QUOTES);
    }
}