Jump to content

Recommended Posts

Hi, I'm an old boy with concentration problems due to illness but do get some days when i can focus well, but it's difficult for me to learn coding from scratch and I'm more of a tinkerer.

I recently decided to try my hand at modernising an old open source Portal/Forum MKPortal integrated with AEF forum, both of which are now non existent.

After doing a decent job on the template I thought it might be a good idea to fork it, then realised it uses mysql rather than mysqli.

MKportal integrates with several forums but the one supplied with it is AEF which is no longer in development, and while I recognise that will be a problem I would still like to continue trying to update it, with my limited knowledge.

MK uses 'drivers' to connect with AEF and the code used in both of them is as follows:

$conn = mysql_connect($globals['server'], $globals['user'], $globals['password']);
@mysql_select_db($globals['database'], $conn) or die( "Unable to select database");

Simply changing it to mysqli doesn't work but I was able to get AEF forum to use mysqli, only to find there is also a problem with a functions.php file in AEF which prevents MK from working.

Both work fine using mysql up to php5.6 but later versions of php do not use mysql.

If anyone would like to look at the site as it is at the moment please do, http://oraclemeters.com I would like to know what your thoughts are, if i should persevere with my quest or if it's a total waste of time? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/309411-resourcing-an-obsolete-portalforum-help/
Share on other sites

If by "simply changing it to mysqli" you mean adding an 'i' in, well yes: while it's very similar to mysql, the biggest difference is that it takes the connection parameter first instead of last. But besides that it shouldn't be that hard.

Which means the problem is dealing with the "doesn't work" aspect. What doesn't work, how, and what have you tried?

Thanks for your response. i used this in AEForum: $connection =  mysqli_connect($host,$user,$password,$db);

And also in MKPortal's aef driver file. The result was that aeforum worked as usual and displayed correctly inside mkportal, i.e. showing the side panels of MK, but MK's home page was just blank with no error reported.

I carefully went through a lot of files to find the following:

if((mysql_num_rows($qresult) > 0)){

    for($i = 0; $i < mysql_num_rows($qresult); $i++){
    
        $row = mysql_fetch_assoc($qresult);
        
        $globals[$row['name']] = $row['regval'];
    
    }

}
@mysql_free_result($qresult);

//Load Session File
include_once($globals['mainfiles'].'/sessions.php');
//Checks a user is logged in
include_once($globals['mainfiles'].'/checklogin.php');
//Is the user Logged In
$logged_in = checklogin();

 

Plus a load more in AEF's functions.php.

 

I'm assuming that these need to be re-writen somehow, but as mentioned I'm not too smart!

But I do get the hang of things quick, with a bit of guidance.

 

There doesn't need to be a whole lot of rewriting. For example, mysql_num_rows becomes mysqli_num_rows. The two are very similar.
Then there are others like mysql_free_result. mysqli has one too, but it's in the "statement" side of things and so is called mysqli_stmt_free_result.
The other case is the ones that take the connection. mysql functions put it last, mysqli functions put it first. Additionally it's optional with mysql but required with mysqli.

You can get, like, 99% done by looking at the mysql function name and finding a corresponding mysqli function name; it lists by the object-oriented method there (eg, mysqli_stmt::free_result), but the docs page will tell you about the procedural alias. The docs also have the arguments list - check that in case there's a difference in how the function is called.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.