Weird error... (after server crash @ISP)

Michelle Konzack <[email protected]> Sun, 28 May 2017 13:31:22 +0300
Newsgroups gmane.comp.php.database
Message-ID <[email protected]>
--hQiwHBbRI9kgIhsi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Guys,

I was just informed by a visitor, that  a  bunch  of  my  websites  show
PHP/pgsql errors...  Of course, they relay all  on   the  same  database
scripts and now I discovered, that the physical server had an error,  my
ISP replaced the harddisks and put a backup of the content on it!

Several month old!

WTF?

I am now for 6 month (or longer) in Estonia and have no physical  access
to my Backups in Strasbourg which really p..s me off!

However, the offending sniplet is:

----8<------------------------------------------------------------------
[47]} elseif (DB_TYPE =3D=3D 'pgsql') {
[48]
[49]  function db_connect($host=3DDB_HOST, $port=3DDB_PORT, $database=3DDB_=
NAME, $user=3DDB_USER, $pass=3DDB_PASS, $link=3D'db_link') {
[50]    global $$link;
[51]    $$link =3D pg_pconnect("host=3D$host port=3D$port dbname=3D$databas=
e user=3D$user password=3D$pass");
[52]    return $$link;
[53]  }
[54]
[55]  function db_close($link=3D'db_link') {
[56]    global $$link;
[57]    return pg_close($link);
[58]  }
[59]
[60]  function db_error($query, $errno, $error) {
[61]    die("<FONT size=3D\"+2\" color=3D\"red\"><B>Error $errno</B></FONT>=
<HR size=3D\"+3\" noshade>$error<P>$query");
[62]  }
[63]
[64]  function db_query($query, $link=3D'db_link') {
[65]    global $$link;
[66]    $result =3D pg_query($link, $query) or db_error($query, '', pg_last=
_error($link));
[67]    return $result;
[68]  }
[69]
[70]  function db_fetch_array($db_query) {
[71]    return pg_fetch_array($db_query);
[72]  }
[73]
[74]  function db_free_result($db_query) {
[75]    return pg_free_result($db_query);
[76]
[77]  function db_fetch_fields($db_query) {
[78]    return pg_fetch_fields($db_query);
[79]  }
[80]
[81]  function db_input($string, $link=3D'db_link') {
[82]    return pg_escape_string($link, $string);
[83]    return addslashes($string);
[84]  }
----8<------------------------------------------------------------------

[Sun May 28 12:14:20 2017] [error] [client 85.29.216.115] PHP Warning:  pg_=
query() expects parameter 1 to be resource, string given in /srv/tdphp-vser=
ver2/includes/01_database.inc on line 64
[Sun May 28 12:14:20 2017] [error] [client 85.29.216.115] PHP Warning:  pg_=
last_error() expects parameter 1 to be resource, string given in /srv/tdphp=
-vserver2/includes/01_database.inc on line 64


The page show "Resource id #17".

This script was working 68 days ago (before the crash) but it  seems,  I
sit on my line and do not find the error.

Any suggestions?

Have a nice Sunday

--=20
Michelle Konzack        Miila ITSystems @ TDnet
GNU/Linux Developer     00372-54541400

--hQiwHBbRI9kgIhsi
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJZKqb6AAoJEKWVf9iDRXPii58P/1oihbtq3wgkS3bvR7o1T9jK
7BLW3hVo/z0rjHzl2PQixOVR1oIi+chcNUvcqYyM4eZTaH9Z3jfIPuNL/8dMA5Eu
AkARU9jWLlkvGLC8Ix55cMXCl7CRjEpImiJ5ewDdzp79njUNkgyKItXEkr5SjbCB
iu9HHju+8Cu/+XeF3TWqM2u8bwEe+2sjkaMINSy9Ex/I+3skvif0Snm06XiyhygT
BLwYRRO9STJz5hJmoe6y4atVTts/mxNumliqNTtXZKfmodS8xHADhm57YrsaWDD3
xq3L8yAZ8CqrcgjyI2NuVGXkJodBP3gon2QQGE4pzaZjLO6HQbChIbe9fjDdQGqk
HjhqEFXXUsjeglO9MnsZdC+V+oVCVYyx5J9Y7WuLGhF0WA5h+ojdJkht8dL2N4Pw
RaRBdoeNTNX2FM4dokGQEHVw5Nj8WFkHV5j35frrtYUVUfYhQS/pTjcS4UExFAja
4906d7TmTx5ICrox8GNC35D6Yos+a/bWw6Xb2V/j02gwUJ4FhkzQicMT2u8nl2jN
2zD2A7kB71TCyyErHLpR/JjTcrxx8n40LbpPeQWpr8Z2i3wfH278z4XovxL//bve
BlateecKOn7XdebhoLrSzzsb1+UwaVyd78qAdNLxGqSVfAZ//xrH1OIfJVhbf7JF
Z7fH8OhyDBCkF/HDvC8z
=FcpZ
-----END PGP SIGNATURE-----

--hQiwHBbRI9kgIhsi--