Forum Moderators: coopster & phranque

Message Too Old, No Replies

Installing a Perl script

Need Serious Help

         

davewray

4:02 am on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi everyone. Well, I finally found a script that will count outgoing clicks and will increment it on my site automatically. Problem is, I've installed it and it won't work! I'm going to do my best to describe my situation...

The readme.txt file told me to download the cgi scripts to this path: #!/usr/bin/perl

Now, this is my first question. I can get all the way to: #!/usr/bin, but then "perl" is NOT a folder, but a file. Does this mean I need to right click on that "perl" file and upload my CGI scripts that way, or can I just upload them into the "bin" folder?

What I did was upload my cgi scripts to the bin folder...which is where I think the problem is coming in.

Anyway, it could be how I've scripted the code right on my page? Here's a sample of the code I have on my web page:

<!-- Start of code:

<a href="http://www.advertiser-site.com/#!/usr/local/bin/clickmanager.cgi?dl=http://www.mydomain.com">AnchorText</a>
<!-- This is where classified text goes --><br>
[Hits: <!-- #include virtual="/#!/usr/local/bin/clickmanager.cgi?num=http://www.advertiser-site.com/" -->]

End of Code -->

The "Hits" part above is where I want the number to increment everytime my advertiser's site is clicked on. Can any of you see where I'm flawed in this script...Or perhaps the path where I've uploaded my CGI scripts? Thank-you so much for your time! I hope that someone knows enough about scripts that they can help me! Thanks :)

Dave.

ncw164x

6:42 am on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On message 18 I said that everthing is working OK, but there are errors being logged in the server error log file that are in the stats.cgi

Use of uninitialized value at /stats.cgi line 92.
Use of uninitialized value at /stats.cgi line 98.
Use of uninitialized value at /stats.cgi line 112.
Use of uninitialized value at /stats.cgi line 151.

Line 92:) if ($form{sort} eq "id") {
LIne 98:) elsif ($form{sort} eq "url") {
Line 112:) chomp;
Line 151:) $template =~ s/<\$(.+?)>/$tmpl{$1}/ig;

Each time you click on a link all four errors appear in the log file

claus

8:06 am on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1) Keep from access:

Try using the search function on top of the page looking for "htaccess" - there's a lot of threads on it. I believe there are other methods too, using some ".conf" file or other, as well as setting permissions on folders and files. It's a very large subject and deserves at least a full thread of it's own. You might also want to run "apache access control" through your favorite Search Engine.

2) Include doesn't work:

The comment tags must be there, it's part of how SSI works. You could try this syntax in stead though:

<!--#exec cgi="/cgi-bin/clickmanager.cgi?num=http://www.urltocount.com"-->

- please make sure that you use the trailing "/" in this command (as well as in the command you use already - added) if you have linked using it. These two might not be the same to the script:

- [urltocount.com...]
- [urltocount.com...]

3) Numall or num

I had to download the script to answer this one. The "numall=1" is used when you want to view the total number of clicks for all links.

The "num=http://www.example.com/" is used when you want the stats for one particular link.

4) wrap up

You don't seem to have done anything wrong. What seems to be missing right now is only getting SSI to work on your server. The file extension didn't do the trick, but keep it, as it's the normal one used for SSI-html.

Now we try changing the command from "include virtual" to "exec cgi" - this does the trick sometimes. An if it don't then we'll probably have to get you server properly configured to accept SSI, but one thing at a time, easiest first. The upside of all this is that you get to know your server a little better ;)

/claus

[edited by: claus at 9:04 am (utc) on July 23, 2003]

ShawnR

8:50 am on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I agree with claus that security is a big topic; too big to handle in a single thread; and I agree with the advice to do some research first. But just as a rough rule of thumb, you can consider the following publicly visible:
  • Anything under the directory that your httpd.conf defines as "DocumentRoot" (i.e. the directory you put your html files, and any subdirectories of that.
  • Anything under the directory that your httpd.conf defines as "ScriptAlias" can be considered cgi by your webserver, so visitors may be able to get your webserver to execute those scripts.

Shawn

davewray

3:26 am on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Claus...Thanks, I'll try that different peice of code and let you all know how it works. I'm definately going to do some searching through threads to find out about security and what I should have accessable to visitors and what I should not :)

Dave.

This 34 message thread spans 2 pages: 34