PDA

View Full Version : Graphic is not displayed


tinytony
05-14-2002, 09:21 AM
I have asked this question before but I incorrectly stated the problem.

I have a counter which I call as:

<img src="counter/counter.php?page=index&digit=scoreboard" border='0'>

This counter can either write to a database or a file. When I use the dB it
correctly updates the dB.
When I call the file it does not write to the file.
And, the gracphic does not show.

When I change the above to call the counter on my home site (from the HM site),
everything works as it should. The file or dB is updated and the graphic is shown on the HM site.

<img src="http://www.berkshire.mydomain.com/counter/counter.php?page=index&digit=bluepl" border='0'>

I have write permissions on the file and directory but I do not know why the
graphic does not show.

I am not sure where to ask question as I do not know what is causing problem.

Thanks

Keith83
05-14-2002, 12:53 PM
Show us exactly what script you're trying to call. I tried going to "http://www.berkshire.mydomain.com/counter/counter.php?page=index&digit=bluepl" and got a 404.

You may be getting an error message that you're not seeing because it's hidden in the HTML.

And if you're getting different results whether you're trying to use a database or just files, then make sure we can test both versions.

Finally, the source to counter.php would be helpful.

tinytony
05-14-2002, 03:31 PM
At the present my home dns server is down. If it were up the correct URL would be:

www.berkshire.dns2go.com

I use dns2go since I use roadrunner which changes the IP address periodically.

At present my IP site can be reached at: http://24.92.168.100/

As you will see the graphic appears and it works.

When I go to http://tony.siverthornhoa.org/ the graphic does not appear.

There are 2 files. config.inc.php which follows and counter.txt which is actually counter.php

<?php
/* ----------------------------------------------*/
/* PNG Counter 1.0 (PHP) */
/* Copyright (c)2001 Chi Kien Uong */
/* URL: http://www.proxy2.de */
/* ----------------------------------------------*/

/* Use Database(mysql) or files to store counting */
/* execute this in your database space before using pngcounter
CREATE TABLE counter (
page varchar(30) NOT NULL default '',
count bigint(20) NOT NULL default '0',
PRIMARY KEY (page),
KEY fichero (page)
) TYPE=MyISAM;
*/
$CFG['db'] = false; /* if false ignore 4 following fields */
$CFG['dbhost'] = "10.10.10.10:3306"; /* host:port */
$CFG['dbuser'] = "root";
$CFG['dbpasswd'] = "";
$CFG['dbname'] = "calendar";

/* How many digits to show? */
$CFG['pad'] = 5;

/* Check HTTP_REFERER? */
$CFG['referer_check'] = false;
$VALID = array(
"http://localhost",
"http://www.fmartinro.f2s.com"
);

/* Block reloading? */
$CFG['block_ip'] = true;
$CFG['lock_timeout'] = 30; // minutes

?>


and counter.php which also follows:

Keith83
05-14-2002, 04:04 PM
You spelled your page wrong: "http://tony.siverthornhoa.org/". Luckily you had your real address in your profile :)

You have a few problems. First: you're not returning the correct content-type for the resulting image from the counter. Make sure you do a header("Content-type: image/png"); (I think that's the right MIME type) beforehand. Currently, your server is returning text/html as the type, which is wrong.

Second: in your HTML source you have "<img src="/home/themis/public_html/silhoa/tony/counter/counter.php?page=index&digit=bluepl" border='0'>" which is surely not what you want. Although, you have what looks like the correct image tag commented out.

Third: if you go directly to http://tony.silverthornhoa.org/counter/counter.php?page=index&digit=bluepl you get this error:

Warning: stat failed for digits/bluepl/1.png (errno=13 - Permission denied) in /home/silhoa/public_html/tony/counter/counter.php on line 21

Warning: Cannot add header information - headers already sent by (output started at /home/silhoa/public_html/tony/counter/config.inc.php:52) in /home/silhoa/public_html/tony/counter/counter.php on line 187

So the script itself isn't working right. You may not have the images installed in the right place or the correct permissions set. And check on what config.inc.php is outputting at line 52. That error is coming up because the script is trying to redirect to error.png but can't because some output has already been sent in config.inc.php. You didn't post that file, so I can't tell you what's goin on there.

Finally, on line 198 of counter.php you have "echo $page." x ".$digit."<br>";" which I don't think you want to have, since this script is supposed to output a PNG and nothing else.

You'll have to check on those error messages you're getting. Since you have access to both servers, it might be helpful to make sure they're both set up identically. If you still need help after checking on all this stuff, feel free to come back here.

tinytony
05-15-2002, 01:49 PM
First: To Keith83

I want to thank you for your help. Your point about the header to output the graphic was correct.

As for the other errors; I had a problem with the pages directory.

When I went into the directory today, (pages) it was a directory with many files which I did not creates. The file which was supposed to be there, 'index.txt' was not. Some how this directory overwrote my original pages directory. Fortunately there was only one file in it so it was no problem recreating it.

I deleted the unknown directory but I did not delete it from the Trash so if someone from HM wants to look at it, it is still available.

To close, thanks very much for taking the time to help me.