Re: whos_online temporary FIX
wholesaledealers <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.tips |
|---|---|
| Message-ID | <5d7a327e58cb4f6f4e145a0aaa70393c@osCommerce-Forums> |
This message was sent from: Tips and Tricks
http://forums.oscommerce.com/viewtopic.php?p=186623#186623
----------------------------------------------------------------
The code needs to actually read Code:
CREATE TABLE whos_online (
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;
[quote="burt"]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;
[/code]
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>');
}
[/code]
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>');
}
[/code]
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) [b]SID is maintained[/b]
e) They are asked to hit a link to go back to default.php, OR...
f) They can just press refresh[/quote]