Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → 3d Party Tools → [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

1 (edited by Feofilaktt 31.01.2021 02:36)

Topic: [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)

Hello guys,

I would like to know if anyone has already implemented this tool using PHP7+ with(MySQLi).

I noticed that this resource only works with PHP5.6.

Could someone help me with this problem?

pvpgn-stats

Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Chat

2

Re: [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)

Try to start it.
If i dont misstake - there nedd to change 2-3 functions.

3

Re: [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)

taz wrote:

Try to start it.
If i dont misstake - there nedd to change 2-3 functions.

Cool, I'll try. But have you done this test?

Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Chat

4

Re: [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)

yes, i did it and it work, but then i made my own d2ladder. i cant remeber why

5 (edited by Feofilaktt 31.01.2021 02:52)

Re: [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)

taz wrote:

yes, i did it and it work, but then i made my own d2ladder. i cant remeber why

Work! Tks!

Code for MySQLi

<?php
// ----------------------------------------------------------------------
// Player -vs- Player Gaming Network Statistics System
// http://pvpgn.spfree.net/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Author from 2.4.4: Pelish (pelish@gmail.com)
// Original author: jfro (imeepmeep@hotmail.com)
// Author from 2.3.20: Snaiperx (http://www.rino.com.co/)
// Author from 2.3.16: STORM (http://www.stormzone.ru/)
// Tanzania theme author: Tanzania (tanzania@gmx.net)
// ----------------------------------------------------------------------

class sql_handle {
    var $db_connection;

// ----------------------------------------------------------------------------------------------
// This is how we connect to DB
// ----------------------------------------------------------------------------------------------
    function db_connect($db_hostname, $db_username, $db_password, $db)
    { global $db_port;
        $this->db_connection=mysqli_connect($db_hostname, $db_username, $db_password, $db)
            OR die ("Connection Error to Mysql Server");
        mysqli_select_db($this->db_connection, $db)
            OR die("Connection Error to Database");
        return $this->db_connection;
    }

// ----------------------------------------------------------------------------------------------
// This is how we get the number of rows in a database query result
// ----------------------------------------------------------------------------------------------

    function sql_num_rows($result) {
        return mysqli_num_rows($result);
    }

// ----------------------------------------------------------------------------------------------
// This is how we get the first row of a database query result
// ----------------------------------------------------------------------------------------------

    function sql_fetch_row($query) {
        return mysqli_fetch_row($query);
    }

// ----------------------------------------------------------------------------------------------
// This is how we get an associative result from query resources
// ----------------------------------------------------------------------------------------------

    function sql_fetch_assoc($result) {
        return mysqli_fetch_assoc($result);
    }

// ----------------------------------------------------------------------------------------------
// This is how we get queries from DB
// ----------------------------------------------------------------------------------------------

    function db_query($db_query) {
        $result = mysqli_query($this->db_connection ,$db_query)
            or die("Query: $db_query  <br /> Error: ".mysqli_error()."<br />");
        return $result;
    }

// ----------------------------------------------------------------------------------------------
// This is how we print DataBase errors
// ----------------------------------------------------------------------------------------------

    function print_db_error($string) {
        if($error_handle == "DIE") {
            die($string."<br />\n<strong>MySQL Error:</strong>".mysqli_error($this->db_connection));
        }
        else if($error_handle == "PRINT") {
            print "<hr />".$string."<br />\n<strong>MySQL Error:</strong>".mysqli_error($this->db_connection)."<hr />";
        }
    }

// ----------------------------------------------------------------------------------------------
// This is how we fetch DB from result
// ----------------------------------------------------------------------------------------------

    function db_fetch($db_result) {
        while($value = mysqli_fetch_assoc($db_result)) {
            $results[] = $value;
        }
        return $results;
    }

// ----------------------------------------------------------------------------------------------
// This is how we fetch DB from query (diffirent parsing method)
// Possibly in the future this will be removed to improve performance.
// ----------------------------------------------------------------------------------------------

    function db_query_fetch($query) {
        $result = mysqli_query($this->db_connection, $query) or $this->print_db_error("Failed to query Database<br />\nQuery: $query");
        if($result) {
            for($n=0;$row=mysqli_fetch_array($result);$n++) {
                $results[$n] = $row;
            }
        }
        else
            $results = array();
        return $results;
    }
// ----------------------------------------------------------------------------------------------
// This is how we disconnect from DB
// ----------------------------------------------------------------------------------------------

    function db_disconnect()
    {
        mysqli_close($this->db_connection);
    }

// ----------------------------------------------------------------------------------------------
// This is how we do search in DB
// ----------------------------------------------------------------------------------------------

    function db_search($value,$column,$column_want,$table) {
        $query = "SELECT $column_want FROM $table WHERE `$column` LIKE '$value'";
        $result = mysqli_query($this->db_connection, $query);
        while($entry = mysqli_fetch_assoc($result)) {
            $results[] = $entry;
        }
        return $results;
    }

}

?>

Added: 31.01.2021 12:08

@HarpyWar, It may be interesting to attach a mysqli_handler.php class to the project, as PHP5.6 has been discontinued, few hosting platforms are offering support for PHP5.6

The class is attached.

Post's attachments

mysqli_handler 5.71 kb, 7 downloads since 2021-01-31 

You don't have the permssions to download the attachments of this post.
Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Chat

Posts: 5

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 0 guests, 0 registered users

forums.pvpgn.pro → 3d Party Tools → [Solved]Problem in PvPGN-Stats with PHP7+ (MySQLi)