hlstatsx-community-edition
hlstatsx-community-edition copied to clipboard
Heatmaps - rewrite DB class to MySQLi (PHP >= 7.x)
Is your feature request related to a problem? Please describe. I would sugest creating a separate repository with the heatmaps for HLStatsX
Describe the solution you'd like The heatmaps can be downloaded from here: https://bitbucket.org/Maverick_of_UC/hlstatsx-community-edition/raw/0577b45e5f33df4e2a6122077fa44902073a8844/extras/HeatmapPack/heatmap-src_3.zip
They need also a fix for using mysqli. This is the error I get when I try to run php generate.php
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/games/cs-miez/tools/hlstatsx/hlxce/heatmaps/heatmap.class.php:582
Stack trace:
#0 /home/games/cs-miez/tools/hlstatsx/hlxce/heatmaps/heatmap.class.php(46): DB::connect()
#1 /home/games/cs-miez/tools/hlstatsx/hlxce/heatmaps/generate.php(10): Heatmap::init()
#2 {main}
thrown in /home/games/cs-miez/tools/hlstatsx/hlxce/heatmaps/heatmap.class.php on line 582
https://github.com/NomisCZ/hlstatsx-community-edition/pull/36#issuecomment-599238937
dont know if this helps, but rcguy https://github.com/rcguy/ has heatmaps that just need a very little edit to work with php7. i did this and added it to my puzzle of "hlstatsx somehow working files"
For some reason these files hosted here are NOT getting updated accordingly?
The lines 582, 583, 588, 592 and 596 in heatmap.class.php need to be changed with the following to work with mysqli functions:
582 --> mysqli_connect(DB_HOST, DB_USER, DB_PASS); 583 --> mysqli_select_db(DB_NAME); 588 --> return mysqli_query($query); 592 --> return mysqli_fetch_assoc($result); 596 --> return mysqli_num_rows($result);
Mainly all mysql_ need to read mysqli_ in a nutshell.
sources: https://www.php.net/manual/en/function.mysqli-connect.php https://www.php.net/manual/en/mysqli.select-db.php https://www.php.net/manual/en/mysqli.query.php https://www.php.net/manual/en/mysqli-result.fetch-assoc.php https://www.php.net/manual/en/mysqli-result.num-rows.php
-Krillin