phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

update phpbb2 Forum connection to PDO


 
Search this topic... | Search MOD Requests... | Search Box
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Author Message
jtrumpfheller
Board Member



Joined: 05 Aug 2019

Posts: 14
Location: Berlin


flag
PostPosted: Mon Aug 05, 2019 1:45 pm 
Post subject: update phpbb2 Forum connection to PDO

Hey folks,

it's my first post here so if I post it in the wrong forum, please excuse me for this.

When the switch to phpbb3 happened I decided to stay with my customized version of phpBB 2.0.23 with the Solaris template (you can see it here: https://www.spearhead-home.com/phpBB2/). It is still working fine for me (Using it as an archive) and it is still running with PHP Version 5.6.40 and MySQL 5.7.

Now I want to use a newer version of PHP (e.g. 7.3.7) and got the problems with the deprecated mysql_connection and depended functions. For my other tables outside phpbb2 I use already the PDO functions.

Is it possible to rewrite the sql_db class to use PDO something like this:
Code:

class sql_db
{
   var $db_connect_id;
   var $query_result;
   var $row = array();
   var $rowset = array();
   var $num_queries = 0;
   var $in_transaction = 0;

   function sql_db($sqlserver, $database, $sqluser, $sqlpassword)
   {
      $this->db_connect_id = 0;

      $this->server = $sqlserver;
      $this->dbname = $database;
      $this->user = $sqluser;
      $this->password = $sqlpassword;

      $this->$options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');

      try
      {
         $this->db_connect_id = new PDO("mysql:host=".$this->server.";dbname=".$this->dbname, $this->user, $this->password, $options);
      }
      catch (PDOException $e)
      {
          print "Error!: " . $e->getMessage() . "<br/>";
      }
      return $this->db_connect_id;
   }
   
   //...
   //Same changes to
   
   //mysql_query
   //mysql_num_rows
   //mysql_affected_rows
   //mysql_fetch_array

   //should be made
}


Is there a way?

Thanks Joerg
Back to top
Vendethiel
Board Member



Joined: 26 Oct 2014

Posts: 162



PostPosted: Mon Aug 19, 2019 3:11 pm 
Post subject: Re: update phpbb2 Forum connection to PDO

It's possible, but I found that more tedious than to just use mysqli, which is what I use pretty much everywhere.
This thread might be interesting

_________________
Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs).
Back to top
jtrumpfheller
Board Member



Joined: 05 Aug 2019

Posts: 14
Location: Berlin


flag
PostPosted: Fri Aug 23, 2019 4:04 pm 
Post subject: Re: update phpbb2 Forum connection to PDO

the link for the mysqli.php doesn't exist anymore.
https://github.com/IntegraMOD/IntegraMOD151/blob/master/IM150/db/mysqli.php

I tried to use this one but I am not sure if this really works:
https://github.com/rubo77/php-mysql-fix

I inclued it in the index.php but this seems to have no effect

Code:
include_once('fix_mysql.inc.php');


Is this the right place or do I have to look deeper?


I found now useful answers in this topic
http://www.phpbb2refugees.com/viewtopic.php?t=2348

So I will not look here anymore. Anyway thanks for the help
Back to top
Vendethiel
Board Member



Joined: 26 Oct 2014

Posts: 162



PostPosted: Mon Aug 26, 2019 8:34 am 
Post subject: Re: update phpbb2 Forum connection to PDO

Oh my, I really need to edit this post.
The file was actually moved to includes, but it's the right file.

_________________
Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs).
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Requests  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0248 seconds using 15 queries. (SQL 0.0024 Parse 0.0008 Other 0.0215)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo