Jump to content
Sign in to follow this  
trophy

Waring, Fatal error.

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

Share this post


Link to post
Share on other sites

It looks like either includes/counter.php doesn't exist or it has too restrictive permissions on it.

 

-jared

Share this post


Link to post
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)));

?>

Share this post


Link to post
Share on other sites

did you copy counter.php into catalog/includes or catalog/admin/includes?

Share this post


Link to post
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)));

?>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×