News:

Wondering if this will always be free?  See why free is better.

Main Menu

status.php uses deprecated functions

Started by rho_simafo, June 14, 2018, 02:13:48 PM

Previous topic - Next topic

rho_simafo

I have downloaded https://download.simplemachines.org/index.php?thanks;filename=status.php an drun it on my S'MF installation (PHP 7.1). At several lines status.php uses deprecated functions like mysql_connect and mysql_query. So my question is:
Does anybody know the link to a version of the script which is running under PHP 7.1?

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GigaWatt

#2
I used this tool to convert status.php to be compatible with PHP 7.x. Try this version ;).

QuoteThis tool converts ext/mysql code to ext/mysqli code, as ext/mysqli is the current MySQL extension.

Example.

Code (status.php) Select
if (empty($db_persist))
$db_connection = @mysql_connect($db_server, $db_user, $db_passwd);
else
$db_connection = @mysql_pconnect($db_server, $db_user, $db_passwd);
if ($db_connection === false)
$db_prefix = false;
@mysql_select_db($db_name, $db_connection);


Code (status.7.x.php) Select
if (empty($db_persist))
$db_connection = @($GLOBALS["___mysqli_ston"] = mysqli_connect($db_server,  $db_user,  $db_passwd));
else
$db_connection = @($GLOBALS["___mysqli_ston"] = mysqli_connect($db_server,  $db_user,  $db_passwd));
if ($db_connection === false)
$db_prefix = false;
@mysqli_select_db( $db_connection, $db_name);


Someone with a little bit more knowledge in PHP should be able to determine weather the syntax is correct.

Note: Change the name of the file from status.php.7.x to status.php

EDIT: Basically, the mysql_connect and mysql_pconnect commands are converted in the same command, so the "else" in the first "if" statement won't actually do anything differently :S.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

rho_simafo

I tried your version of status.php.
Unfortunately, it produces an error as well:

Fatal error: Uncaught Error: Call to undefined function set_magic_quotes_runtime() in status.php:39 Stack trace: #0 status.php(28): initialize_inputs() #1 {main} thrown in status.php on line 39

Arantor


GigaWatt

Didn't see this part of your first post.

Quote from: rho_simafo on June 14, 2018, 02:13:48 PM
Does anybody know the link to a version of the script which is running under PHP 7.1?

I'm running the current stable version 2.0.15 on PHP 7.1... no errors, no problems.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

rho_simafo

Quote from: GigaWatt on June 18, 2018, 11:04:16 PM
I'm running the current stable version 2.0.15 on PHP 7.1... no errors, no problems.
Me too, version 2.0.15 on PHP 7.1
Anyhow, it is not that important in the moment. I don't wait for any further post.
Thanx to all :-*

GigaWatt

So, does this mean that the problem is solved?
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Advertisement: