FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » FATAL SQL ERRORS
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
FATAL SQL ERRORS [message #11457] Mon, 30 June 2003 02:48 Go to next message
creamywf is currently offline  creamywf   United States
Messages: 54
Registered: April 2002
Karma: 0
Member
OUR FORUM OFTEN WON'T OPEN THROUGH THE DAY AND GIVES US THESE MESSAGES (SEE BELOW). WHAT CAUSES THIS AND WHAT CAN WE DO ABOUT IT? WE ARE USING 2.3.3
------------------------------------------------------

Warning: Too many connections in /home/virtual/site53/fst/var/www/html/forum/index.php on line 27

Warning: MySQL Connection Failed: Too many connections in /home/virtual/site53/fst/var/www/html/forum/index.php on line 27

Warning: Supplied argument is not a valid MySQL-Link resource in /home/virtual/site53/fst/var/www/html/forum/index.php on line 28

Warning: Supplied argument is not a valid MySQL-Link resource in /home/virtual/site53/fst/var/www/html/forum/index.php on line 28

Fatal error: SQL Error has occured, please contact the administrator of the forum and have them review the forum's SQL query log in /home/virtual/site53/fst/var/www/html/forum/forum_data2/include/theme/defau lt/err.inc on line 102


WHEN WE VIEW THE FILE ABOVE WITH NOTEPAD, WE GET THE FOLLOWING:

-------------------------------------------------------
<?php
/************************************************************************** *
* copyright : (C) 2001,2002 Advanced Internet Designs Inc.
* email : forum(at)prohost(dot)org
*
* $Id: err.inc.t,v 1.9 2002/09/09 21:08:52 hackie Exp $
*************************************************************************** *

*************************************************************************** *
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*************************************************************************** /

function error_dialog($title, $msg, $returnto, $level='', $ses=NULL)
{
if ( empty($ses) ) $ses = $GLOBALS['ses'];

$level = ( empty($level) ) ? 'WARN' : strtoupper($level);
$ref = !empty($GLOBALS["HTTP_SERVER_VARS"]["HTTP_REFERER"]) ? $GLOBALS["HTTP_SERVER_VARS"]["HTTP_REFERER"] : '';

if ( $level == 'FATAL' ) {
$error_msg = "[Error Level: $level] $title<br />\n";
$error_msg .= "[Message Sent to User] ".trim($msg)."<br />\n";
$error_msg .= "[User's IP] ".$GLOBALS['HTTP_SERVER_VARS']['REMOTE_ADDR']."<br />\n";
$error_msg .= "[Requested URL] http://" .$GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'].$GLOBALS['HTTP_SERVER_VARS']['RE QUEST_URI']. "<br />\n";
if( !empty($GLOBALS["HTTP_SERVER_VARS"]["HTTP_REFERER"]) ) $error_msg .= "[Referring Page] ".$GLOBALS["HTTP_SERVER_VARS"]["HTTP_REFERER"]."<br />\n";

error_log('['.gmdate("D M j G:i:s T Y", __request_timestamp__).'] '.base64_encode($error_msg)."\n", 3, $GLOBALS['ERROR_PATH'].'fud_errors');
}

$err_id = md5(get_random_value(128).__request_timestamp__);
$ses->putvar('err_id', $err_id);
$ses->putvar('er_msg', $msg);
$ses->putvar('err_t', $title);
$ses->putvar('ret_to', base64_encode($returnto));
$ses->save_session();
header('Location: http://www.wf4bm.net/forum/index.php?t=error&'.str_replace("&amp;", "&", _rsid).'&err_id='.$err_id);
exit;
}

function std_error($type)
{
$err_array = array(
'ERR_login'=>array('ERROR: You are not logged in ', 'You are not logged in, please do so<br><br>If you would like to register go to the <a href="http://www.wf4bm.net/forum/index.php?t=register&amp;'._rsid.'">registration form</a><br>If you would like to login please go to the <a href="http://www.wf4bm.net/forum/index.php?t=login&amp;'._rsid.'">login form</a>', 'http://www.wf4bm.net/forum/index.php?t=login&amp;'._rsid.''),
'ERR_disabled'=>array('Disabled feature', 'This feature has been disabled by the system administrator', ''.$HTTP_SERVER_VARS['HTTP_REFERER'].'?'._rsid.''),
'ERR_access'=>array('ERROR: Insufficient Permissions', 'You do not have the required permissions to perform this action', ''.$HTTP_SERVER_VARS['HTTP_REFERER'].'?'._rsid.''),
'ERR_registration_disabled'=>array('Registration Disabled', 'The administrator has disabled registration, please try again later', 'http://www.wf4bm.net/forum/index.php?t=index&amp;'._rsid.''),
'ERR_emailconf'=>array('ERROR: Your account is not yet confirmed', 'You have not confirmed you account via email yet<br><table border=0><tr><td><ol><li>If you have not received a confirmation email <a href="http://www.wf4bm.net/forum/index.php?t=reset&amp;email='.$GLOBALS['usr']->email.'&amp;'._rsid.'">click here</a><li>If '.$GLOBALS['usr']->email.' is not your correct email address <a href="http://www.wf4bm.net/forum/index.php?t=register&amp;'._rsid.'">click here</a></ol></td></tr></table>', ''),
'ERR_user'=>array('ERROR: No such user', 'There is no such user', ''.$HTTP_SERVER_VARS['HTTP_REFERER'].'?'._rsid.''),
'ERR_systemerr'=>array('ERROR: System Error', 'System error has occurred, please report it to the <a href="mailto:'.$GLOBALS['ADMIN_EMAIL'].'">webmaster</a>.', ''.$GLOBALS['returnto_d'].'')
);

$err = $err_array["ERR_".$type];
if ( is_array($err) ) {
error_dialog($err[0], $err[1], $err[2], $err[3]);
}
else {
error_dialog('CRITICAL ERROR', 'You have encountered an error, but unfortunately there is a problem with the error reporting system', 'http://www.wf4bm.net/forum/index.php?t=index&'._rsid, 'FATAL');
exit();
}
}

function std_out($text, $level='INFO')
{
$fp = fopen($GLOBALS['ERROR_PATH'].'std_out.log', 'ab');
$log_str = gmdate("Y-m-d-H-i-s", __request_timestamp__);
$log_str .= " [".$level."] ";
$log_str .= str_replace("\n", ' ', str_replace("\r", ' ', $text))."\n";
fwrite($fp, $log_str);
fclose($fp);
@chmod($GLOBALS['ERROR_PATH'].'std_out.log',($GLOBALS['FILE_LOCK']=='Y'?060 0:0666));
}

function invl_inp_err()
{
error_dialog('Invalid Input', 'You've followed an invalid link, please notify the <a href="mailto:'.$GLOBALS['ADMIN_EMAIL'].'">webmaster</a>', NULL, 'FATAL');
exit;
}

function fud_sql_error_handler($query, $error_string, $error_number, $server_version)
{
if( db_locked() ) db_unlock();

if( empty($HTTP_SERVER_VARS['PATH_TRANSLATED']) ) $HTTP_SERVER_VARS['PATH_TRANSLATED'] = $GLOBALS['HTTP_SERVER_VARS']['argv'][0];

$error_msg = "(".basename($HTTP_SERVER_VARS['PATH_TRANSLATED']).") ".$error_number.": ".$error_string."<br />\n";
$error_msg .= "Query: ".htmlspecialchars($query)."<br />\n";
$error_msg .= "Server Version: ".$server_version."<br />\n";
if( !empty($GLOBALS["HTTP_SERVER_VARS"]["HTTP_REFERER"]) ) $error_msg .= "[Referring Page] ".$GLOBALS["HTTP_SERVER_VARS"]["HTTP_REFERER"]."<br />\n";

if( !error_log('['.gmdate("D M j G:i:s T Y", __request_timestamp__).'] '.base64_encode($error_msg)."\n", 3, $GLOBALS['ERROR_PATH'].'sql_errors') ) {
echo "<b>UNABLE TO WRITE TO SQL LOG FILE</b><br>\n";
echo $error_msg;
} else {
if( isset($GLOBALS['usr']) && $GLOBALS['usr']->is_mod == 'A' )
echo $error_msg;
else
trigger_error('SQL Error has occured, please contact the <a href="mailto:'.$GLOBALS['ADMIN_EMAIL'].'?subject=SQL%20Error">administrator </a> of the forum and have them review the forum's SQL query log', E_USER_ERROR);
}
exit;
}
?>
Re: FATAL SQL ERRORS [message #11458 is a reply to message #11457] Mon, 30 June 2003 02:55 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Turn of persistent connections.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Global Anonymous Can't Reply to Messages...
Next Topic: Peculiar Weirdness
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 01:26:35 GMT 2024

Total time taken to generate the page: 0.02317 seconds