Weird error... (after server crash @ISP)
| From: | Michelle Konzack | Date: | Sun, 28 May 2017 10:31:22 +0000 |
| Subject: | Weird error... (after server crash @ISP) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-49174@lists.php.net to get a copy of this message | ||
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 == 'pgsql') {
[48]
[49] function db_connect($host=DB_HOST, $port=DB_PORT, $database=DB_NAME, $user=DB_USER,
$pass=DB_PASS, $link='db_link') {
[50] global $$link;
[51] $$link = pg_pconnect("host=$host port=$port dbname=$database user=$user
password=$pass");
[52] return $$link;
[53] }
[54]
[55] function db_close($link='db_link') {
[56] global $$link;
[57] return pg_close($link);
[58] }
[59]
[60] function db_error($query, $errno, $error) {
[61] die("<FONT size=\"+2\" color=\"red\"><B>Error
$errno</B></FONT><HR size=\"+3\" noshade>$error<P>$query");
[62] }
[63]
[64] function db_query($query, $link='db_link') {
[65] global $$link;
[66] $result = 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='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-vserver2/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
--
Michelle Konzack Miila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400
Attachment: [application/pgp-signature] Digital signature signature.asc
Attachment: [application/pgp-signature] Digital signature signature.asc