Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Waring, Fatal error.


trophy

Recommended Posts

I have installed "Enhanced" visitor counter onto my site,

When I go into admin I get an error message as below.

I have checked and searched hi and lo but can not find the problem.

Instalation of add on is correct, from what I can see.

All help appreciated

 

Warning: require(includes/counter.php) [function.require]: failed to open stream: No such file or directory in /home/hobbiesp/public_html/admin/includes/footer.php on line 13

 

Fatal error: require() [function.require]: Failed opening required 'includes/counter.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/hobbiesp/public_html/admin/includes/footer.php on line 13

Link to comment
Share on other sites

Here is the compltete contribution, counter/php.

I feel pretty confident that I have done it all correct.

If there is an error in the programme then I am out of my depth.

 

 

 

- Copy the counter.php in the catalog/includes directory. Or change it manually, see file below.

- Edit catalog/includes/application_top.php

Search for the who's online function call, and remove/remark it:

 

// include the who's online functions

// require(DIR_WS_FUNCTIONS . 'whos_online.php');

// tep_update_whos_online();

 

(Be smart, copy these lines in your clipboard....)

 

- Edit catalog/includes/footer.php

Paste the lines (without the remarks :-) just below require(DIR_WS_INCLUDES . 'counter.php');

 

(Important!! If you place it above this line, your counter will not work!)

 

require(DIR_WS_INCLUDES . 'counter.php');

// include the who's online functions

require(DIR_WS_FUNCTIONS . 'whos_online.php');

tep_update_whos_online();

 

That's all!

 

 

 

 

 

For the manual freaks, here's the counter.php:

 

<?php

/*

$Id: counter.php,v 1.5 2003/02/10 22:30:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

$wo_session_id = tep_session_id();

 

$known_customer_query = tep_db_query("select count(*) as count from " . TABLE_WHOS_ONLINE . " where session_id = '" . $wo_session_id . "'");

$known_customer = tep_db_fetch_array($known_customer_query);

 

$counter_query = tep_db_query("select startdate, counter from " . TABLE_COUNTER);

 

if ($known_customer['count'] > 0) {

// User already known, don't add 1...

$counter = tep_db_fetch_array($counter_query);

$counter_startdate = $counter['startdate'];

$counter_now = ($counter['counter']);

} else {

 

if (!tep_db_num_rows($counter_query)) {

$date_now = date('Ymd');

tep_db_query("insert into " . TABLE_COUNTER . " (startdate, counter) values ('" . $date_now . "', '1')");

$counter_startdate = $date_now;

$counter_now = 1;

} else {

$counter = tep_db_fetch_array($counter_query);

$counter_startdate = $counter['startdate'];

$counter_now = ($counter['counter'] + 1);

tep_db_query("update " . TABLE_COUNTER . " set counter = '" . $counter_now . "'");

}

}

 

$counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4)));

?>

Link to comment
Share on other sites

Hi Jared appreciate you help.

Yes I have, this is what is in the admin/includes

 

Gill A

 

<?php

/*

$Id: counter.php,v 1.5 2003/02/10 22:30:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

$wo_session_id = tep_session_id();

 

$known_customer_query = tep_db_query("select count(*) as count from " . TABLE_WHOS_ONLINE . " where session_id = '" . $wo_session_id . "'");

$known_customer = tep_db_fetch_array($known_customer_query);

 

$counter_query = tep_db_query("select startdate, counter from " . TABLE_COUNTER);

 

if ($known_customer['count'] > 0) {

// User already known, don't add 1...

$counter = tep_db_fetch_array($counter_query);

$counter_startdate = $counter['startdate'];

$counter_now = ($counter['counter']);

} else {

 

if (!tep_db_num_rows($counter_query)) {

$date_now = date('Ymd');

tep_db_query("insert into " . TABLE_COUNTER . " (startdate, counter) values ('" . $date_now . "', '1')");

$counter_startdate = $date_now;

$counter_now = 1;

} else {

$counter = tep_db_fetch_array($counter_query);

$counter_startdate = $counter['startdate'];

$counter_now = ($counter['counter'] + 1);

tep_db_query("update " . TABLE_COUNTER . " set counter = '" . $counter_now . "'");

}

}

 

$counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4)));

?>

Link to comment
Share on other sites

Well I am now I am confused as this is what I have.

Which inbcludes should I have the counter in?

when I log onto my server this is what I see.

 

 

- folder /

- admin

backups

images

+ includes

cgi -bin

download

fresh

images

+ includes

pub

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...