Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

who is online error advanced


Guest

Recommended Posts

i followed these instructions the the letter to fix the who is online error and when i did the site crashed

 

 

Solution for whos_online problem

 

1. Create a clean copy of the whos_online table. Use PHPMyAdmin for this:

 

Code:

 

CREATE TABLE whos_online_copy (

customer_id int(11) default NULL,

full_name varchar(64) NOT NULL default '',

session_id varchar(128) NOT NULL default '',

ip_address varchar(15) NOT NULL default '',

time_entry varchar(14) NOT NULL default '',

time_last_click varchar(14) NOT NULL default '',

last_page_url varchar(64) NOT NULL default ''

) TYPE=MyISAM;

 

 

 

2. Edit includes/functions/database.php:

 

Remove this:

 

Code:

 

function tep_db_error($query, $errno, $error) {

die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');

}

 

 

 

Replace with this:

 

Code:

 

function tep_db_error($query, $errno, $error) {

mysql_query('DROP TABLE IF EXISTS whos_online');

mysql_query('SET SQL_QUOTE_SHOW_CREATE = 0');

$res = mysql_query('SHOW CREATE TABLE whos_online_copy');

$row = mysql_fetch_assoc($res);

$create = preg_replace('/^CREATE TABLE whos_online_copy/', 'CREATE TABLE whos_online', $row['Create Table']);

mysql_query($create);

mysql_query('INSERT INTO whos_online SELECT * FROM whos_online_copy');

echo '<font color="red"><b>ERROR:</b></font> <a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '"><u>Please click here to restart site</a><br><br>';

die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');

}

 

 

 

What does it do?

a) The whos_online table breaks.

B) The person browsing gets a [TEP STOP] error, BUT...

c) The whos_online is automatically recreated

d) SID is maintained

e) They are asked to hit a link to go back to default.php, OR...

f) They can just press refresh

 

 

 

>>>>>>>>NOW I GET THIS <<<<<<<<<<

 

erce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } if ($$link) mysql_select_db($database); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } function tep_db_error($query, $errno, $error) { die('' . $errno . ' - ' . $error . '

 

' . $query . '

 

[TEP STOP]

 

'); } function tep_db_query($query, $link = 'db_link') { global $$link; if (STORE_DB_TRANSACTIONS == 'true') { error_log('QUERY ' . $query . "n", 3, STORE_PAGE_PARSE_TIME_LOG); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (STORE_DB_TRANSACTIONS == 'true') { $result_error = mysql_error(); error_log('RESULT ' . $result . ' ' . $result_error . "n", 3, STORE_PAGE_PARSE_TIME_LOG); } return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= ''' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = '' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } function tep_db_num_rows($db_query) { return mysql_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysql_data_seek($db_query, $row_number); } function tep_db_insert_id() { return mysql_insert_id(); } function tep_db_free_result($db_query) { return mysql_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysql_fetch_field($db_query); } function tep_db_output($string) { return stripslashes($string); } function tep_db_input($string) { return addslashes($string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(stripslashes($string)); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } ?>

Fatal error: Call to undefined function: tep_db_connect() in /home/webuyjoe/public_html/catalog/includes/application_top.php on line 155

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...