Page 1 of 1

Graphic Counter not working. Basic test displays NoReferer

Posted: Fri Mar 06, 2009 9:43 pm
by hellpit
Script URL: http://www.cvcustom.com/
Version of script: v1.1
Hosting company: ATT
URL of phpinfo.php: http://cvcustom.com/php
URL of session_test.php: http://cvcustom.com/php
What terms did you try when SEARCHING for a solution:

Write your message below:

When I try to do the basic test http://www.cvcustom.com/counter/graphcount.php?=home

I get an image that displays NoReferer

If I actually go to http://www.cvcustom.com/counter/ Then click on the PHP I can get some # to display.

I have the scriptfile added to the index.html but no counter displays.

Any ideas what could be going on here?


Thanks for any help.


OH I just wanted to add something that I just did, I looked at my message that I posted here, when I click on the LINK to do the basic Counter test, I actually got a COUNTER! I can press F5 to do a refresh and the counter updates. Now if I click up in the URL window, and then press ENTER, I get that NoRefere Image displayed..... Now that is strange to me.

:?:

Posted: Sat Mar 07, 2009 9:47 am
by Henrie
When I click the link http://www.cvcustom.com/counter/graphcount.php?=home in from your post it displays number 000032

However when i paste the link in my browser it display does not display. Than i get NoReferer

I tested in all browsers (Firefox, Internet Explorer, Opera, Safari, Google Chrome) all with same result.

Have you tried the link in a real life page?

Greetings,
Henrie

Posted: Sat Mar 07, 2009 10:57 am
by Klemen
Are you sure you are running version 1.1? Did you make any modifications to it? Post the graphcount.php file source code here.

Here is the code on my site.

Posted: Sat Mar 07, 2009 3:48 pm
by hellpit
The only thing I changed in this code was the BaseURL.


<?php
/*******************************************************************************
* Title: PHP graphical hit counter (PHPGcount)
* Version: 1.1 @ October 26, 2007
* Author: Klemen Stirn
* Website: http://www.phpjunkyard.com
********************************************************************************
* COPYRIGHT NOTICE
* Copyright 2004-2007 Klemen Stirn. All Rights Reserved.
*
* This script may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
*
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden.
*
* Obtain permission before redistributing this software over the Internet
* or in any other medium. In all cases copyright and header must remain
* intact. This Copyright is in full effect in any country that has
* International Trade Agreements with the United States of America or
* with the European Union.
*******************************************************************************/

// SETUP YOUR COUNTER
// Detailed information found in the readme file

// URL of the folder where script is installed. INCLUDE a trailing "/" !!!
$base_url = 'http://www.cvcustom.com/counter/';
// Default image style (font)
$default_style = 'web1';
// Default counter image extension
$default_ext = 'gif';
// Count UNIQUE visitors ONLY? 1 = YES, 0 = NO
$count_unique = 0;
// Number of hours a visitor is considered as "unique"
$unique_hours = 24;
// Minimum number of digits shown (zero-padding). Set to 0 to disable.
$min_digits = 0;

#############################
# DO NOT EDIT BELOW #
#############################

/* Turn error notices off */
error_reporting(E_ALL ^ E_NOTICE);

/* Get page and log file names */
$page = input($_GET['page']) or die('ERROR: Missing page ID');
$logfile = 'logs/' . $page . '.txt';

/* Get style and extension information */
$style = input($_GET['style']) or $style = $default_style;
$style_dir = 'styles/' . $style . '/';
$ext = input($_GET['ext']) or $ext = $default_ext;

/* Does the log exist? */
if (file_exists($logfile)) {

/* Get current count */
$count = trim(file_get_contents($logfile)) or $count = 0;

if ($count_unique==0 || $_COOKIE['gcount_unique']!=$page) {
/* Increase the count by 1 */
$count = $count + 1;
$fp = @fopen($logfile,'w+') or die('ERROR: Can\'t write to the log file ('.$logfile.'), please make sure this file exists and is CHMOD to 666 (rw-rw-rw-)!');
flock($fp, LOCK_EX);
fputs($fp, $count);
flock($fp, LOCK_UN);
fclose($fp);

/* Print the Cookie and P3P compact privacy policy */
header('P3P: CP="NOI NID"');
setcookie('gcount_unique', $page, time()+60*60*$unique_hours);
}

/* Is zero-padding enabled? */
if ($min_digits > 0) {
$count = sprintf('%0'.$min_digits.'s',$count);
}

/* Print out Javascript code and exit */
$len = strlen($count);
for ($i=0;$i<$len;$i++) {
echo 'document.write(\'<img src="'.$base_url . $style_dir . substr($count,$i,1) . '.' . $ext .'" border="0">\');';
}
exit();

} else {
die('ERROR: Invalid log file!');
}

/* This functin handles input parameters making sure nothing dangerous is passed in */
function input($in) {
$out = htmlentities(stripslashes($in));
$out = str_replace(array('/','\\'), '', $out);
return $out;
}
?>

Posted: Sat Mar 07, 2009 5:16 pm
by Klemen
This is not the script that is used because:

a) Graphcount never prints the "No referer" image
b) Graphcount doesn't print the red border around counter image
c) Graphcount prints out Javascript and not a GIF image
and
d) even if you try to access an individual file it doesn't show the file but a counter:
http://www.cvcustom.com/counter/styles/web1/0.gif

Check with your host if yourdomain.com/counter is some sort of a redirect to some counter script?

You can try renaming the "counter" folder to "test" and see if it works then. Also make sure you delete any .htaccess files from the "test" folder (if any inside).

Posted: Sat Mar 07, 2009 6:34 pm
by hellpit
THAT WAS IT!!! I renamed my counter directory to something else, and now its working!

Maybe ATT has something that uses a directory called counter by default or something.

SUCCESS.