Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Running a CGI Counter Script (http://www.velocityreviews.com/forums/t163642-running-a-cgi-counter-script.html)

Mark Hobley 12-07-2005 07:08 PM

Running a CGI Counter Script
 
I have created an HTML page as follows:

<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<title>Test Page</title>
</head>
<body>
<!--#include virtual="/cgi-bin/count.cgi?testcount"-->
</body>
</html>

I was expecting this to invoke my count.cgi script, but it does not run.

If I point the browser at /cgi-bin/count.cgi, the script runs as expected.

Have I used the HTML correctly ?

Please advise.
My web server daemon is thttpd.

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/


David Dorward 12-07-2005 07:33 PM

Re: Running a CGI Counter Script
 
Mark Hobley wrote:

> <!--#include virtual="/cgi-bin/count.cgi?testcount"-->
> Have I used the HTML correctly ?


That is SSI rather then HTML. The syntax looks correct.

> My web server daemon is thttpd.


Are you accessing the page using the ssi CGI program?
http://www.acme.com/software/thttpd/ssi_man.html


--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

Mark Hobley 12-07-2005 09:08 PM

Re: Running a CGI Counter Script
 
In alt.html David Dorward <dorward@yahoo.com> wrote:

> That is SSI rather then HTML. The syntax looks correct.


Ok. Is there an HTML way of doing this ? I just want the script to run as the
page is viewed.

> Are you accessing the page using the ssi CGI program?
> http://www.acme.com/software/thttpd/ssi_man.html


My scripts that collect form data work ok. Its just the counter script that
doesn't run. Can I invoke the hit counter without ssi ?

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/


David Dorward 12-07-2005 09:35 PM

Re: Running a CGI Counter Script
 
Mark Hobley wrote:

> In alt.html David Dorward <dorward@yahoo.com> wrote:
>
>> That is SSI rather then HTML. The syntax looks correct.

>
> Ok. Is there an HTML way of doing this ? I just want the script to run as
> the page is viewed.


<img src="/cgi-bin/myscript.cgi" alt="">

.... and then ensure that myscript.cgi returns an image.

It will break if images are turned off.
Its likely to break with some privacy packages.
It means another http request for each page view.

You could also switch to a webserver which supports SSI internally, such as
Apache.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

Mark Hobley 12-07-2005 10:08 PM

Re: Running a CGI Counter Script
 
Mark Hobley <markhobley@hotpop.deletethisbit.com> wrote:

> My scripts that collect form data work ok. Its just the counter script that
> doesn't run. Can I invoke the hit counter without ssi ?


I have found that instead of using the following:

<!--#include virtual="/cgi-bin/count.cgi?testcount"-->

I can use:

<img src="/cgi-bin/count.cgi?testcount">

This runs the script.

Unfortunately, my script doesn't produce an image, so I get a rectange on the
screen where the image would go.

Can I use instead something like one of the following:

<text src="/cgi-bin/count.cgi?testcount">

or even better

<void src="/cgi-bin/count.cgi?testcount">

or

<null src="/cgi-bin/count.cgi?testcount">

?

Please advise.

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/


David Dorward 12-07-2005 10:15 PM

Re: Running a CGI Counter Script
 
Mark Hobley wrote:

> <img src="/cgi-bin/count.cgi?testcount">


> Unfortunately, my script doesn't produce an image, so I get a rectange on
> the screen where the image would go.
> Can I use instead something like one of the following:
>
> <text src="/cgi-bin/count.cgi?testcount">


No. Change the script so it outputs an image - but see my previous comments
on the subject elsewhere in this thread.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is

Mark Parnell 12-07-2005 10:22 PM

Re: Running a CGI Counter Script
 
In our last episode, Mark Hobley <markhobley@hotpop.deletethisbit.com>
pronounced to alt.html:

> Unfortunately, my script doesn't produce an image, so I get a rectange on the
> screen where the image would go.


Change the script?

> <text src="/cgi-bin/count.cgi?testcount">
> <void src="/cgi-bin/count.cgi?testcount">
> <null src="/cgi-bin/count.cgi?testcount">


Considering <text>, <void> and <null> don't exist, no. Well, there's
nothing stopping you from putting it into your page, but any browser
that did anything with it would be misbehaving.

Apart from getting the cgi to return an image (noting the caveats
mentioned by David), the only reliable way of including it would be
through SSI (or PHP, ASP etc.).

--
Mark Parnell
http://clarkecomputers.com.au

Jonathan N. Little 12-07-2005 11:14 PM

Re: Running a CGI Counter Script
 
Mark Hobley wrote:
> I have created an HTML page as follows:
>
> <!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
> <html>
> <title>Test Page</title>
> </head>
> <body>
> <!--#include virtual="/cgi-bin/count.cgi?testcount"-->
> </body>
> </html>


The code above is a SSI, Server Side Include, most hosting company
servers settings require the file extension 'shtml'. So if you have the
above code in your html document 'mypage.html' rename to 'maypage.shtml'
and see if it works.


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Mark Hobley 12-08-2005 12:08 AM

Re: Running a CGI Counter Script
 
David Dorward <dorward@yahoo.com> wrote:

> <img src="/cgi-bin/myscript.cgi" alt="">
>
> ... and then ensure that myscript.cgi returns an image.


I think that I might be able to get a 1 x 1 transparent gif from somewhere.

How would I send it from the script, which is a conventional unix script that
will run on a Bourne compatible shell?

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/


Guillaume 12-08-2005 12:45 PM

Re: Running a CGI Counter Script
 
> David Dorward:
>><img src="/cgi-bin/myscript.cgi" alt="">
>>... and then ensure that myscript.cgi returns an image.


Mark Hobley:
> I think that I might be able to get a 1 x 1 transparent gif from somewhere.
> How would I send it from the script, which is a conventional unix script that
> will run on a Bourne compatible shell?


#!/bin/sh

echo 'Content-Type: image/gif'
echo

# counting code here

cat image1x1.gif


You can add more options like Pragma: no-cache, Content-Length, ...

--
My desktop is worth a million of dollars. Put an icon on it.
http://www.milliondollarscreenshot.com/


All times are GMT. The time now is 01:28 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.