NomisCZ / hlstatsx-community-edition

HLstatsX Community Edition - PHP 7 and GeoIP2 supported
GNU General Public License v2.0
83 stars 48 forks source link

PHP 7.4.8 - Function get_magic_quotes_gpc() is deprecated #62

Closed Fastmancz closed 1 year ago

Fastmancz commented 4 years ago

Describe the bug PHP Deprecated: Function get_magic_quotes_gpc() is deprecated in C:\website\hlstats\includes\functions.php on line 97

https://www.php.net/manual/en/function.get-magic-quotes-gpc.php

Environment

Fastmancz commented 4 years ago

I tried this solution and it works. Can you verify this solution? Thanks.

function valid_request($str, $numeric = false)
{
    $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`�':;߲�#+~_\-|<>\/\\\\@{}������ ]/");
    $replace_pattern = array('');
    $str = preg_replace($search_pattern, $replace_pattern, $str);
    if ( $numeric == false )
    {
        /*if ( get_magic_quotes_gpc() )
            return $str = htmlspecialchars(stripslashes($str), ENT_QUOTES);
        else
            return $str = htmlspecialchars($str, ENT_QUOTES);*/
        return $str = htmlspecialchars($str, ENT_QUOTES);
    }
    else
    {
        if ( is_numeric($str) )
            return intval($str);
        else
            return -1;
    }
}
function mystripslashes($text)
{
    //return get_magic_quotes_gpc() ? stripslashes($text) : $text;
        return stripslashes($text);
}
NomisCZ commented 4 years ago

Hello,

yes, it's the right solution, because you don't need this function anymore.

https://github.com/NomisCZ/flarum-ext-auth-steam/issues/5 PHP >= 5.4.0 - Always returns FALSE because the magic quotes feature was removed from PHP.

If you want, you can create MR (also remove old commented code).

Thanks.

Fastmancz commented 4 years ago

Hello, I found other problems. I don't want to start a new topic.

[02-Aug-2020 22:39:06 UTC] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; pData has a deprecated constructor in C:\website\hlstats\includes\pChart\pData.class on line 48

[02-Aug-2020 22:39:06 UTC] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; pChart has a deprecated constructor in C:\website\hlstats\includes\pChart\pChart.class on line 118

I recommend an update from Bozhinov. https://github.com/bozhinov/pChart2.0-for-PHP7/blob/master/pChart/pData.php https://github.com/bozhinov/pChart2.0-for-PHP7/blob/master/pChart/pCharts.php

https://github.com/NomisCZ/hlstatsx-community-edition/blob/master/web/includes/pChart/pData.class#L53 to function __construct()

https://github.com/NomisCZ/hlstatsx-community-edition/blob/master/web/includes/pChart/pChart.class#L197 to function __construct($XSize,$YSize)

I have still problem with imagettftext. Maybe I'll solve it. [02-Aug-2020 23:00:18 UTC] PHP Warning: imagettftext(): Could not find/open font in C:\website\hlstats\sig.php on line 425

Updated. https://github.com/NomisCZ/hlstatsx-community-edition/blob/master/web/sig.php#L424 to $font = realpath(IMAGE_PATH.'/sig/font/DejaVuSans.ttf'); //Source from https://stackoverflow.com/questions/48061992/imagettftext-could-not-find-open-font-error-message

However, I still can't figure out why I don't see the charts. 🤔 00a60 When I try to open a missing image: 5dw9a5d9w

php.ini extension=php_mbstring.dll extension=php_mysqli.dll extension=php_pdo_mysql.dll extension=php_openssl.dll extension=php_gd2.dll extension=php_xmlrpc.dll extension=php_sockets.dll extension=php_curl.dll

KrillinsWorld commented 3 years ago

So, WHY is this function STILL in the files I just downloaded? I have all issues worked out until this showed up in my apache logs with PHP 7.4.16. I am not moving to PHP 8 anytime soon.

So what is the fix exactly? The original poster had the function commented out but there is another function code below it. Can someone clear this up (I am not a programmer yet)? I do not want to sit here and play guessing games and "fudge-up" my databases. I use this on three servers for HL1 not sure why this will not work on CS:CZ but works for CS and Source (HL2?) CS:S and CS:GO. I found this looking for a fix for superlogs-csgo.

Thank you!