Discussion Locked

adding a counter

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I built a web page using print shop 10. Now i am trying to add a counter. I cant seem to get it on to my page. I tried to add an html object but cant find the proper tool in the insert screen. Has anyone used this or have an idea on how to get it on. Thanks Tom

3 replies

by www.tecklord.by.ru

The best way for solving your problem is to use free counters from searching engens, which you build in without any help of your programme

by michellewright966

tom, i seem to have the same problem, if you get any good advice could you please e-mail me with the information.
michelle

by rockslammer

If you have perl and SSI (.shtml pages) this works nicely
and reads the last IP address so no one can run your counter
up by refreshing the page over and over.

make these 2 files to hold the data
$CountFile="your server's path/tclite21.dat";
$IPfile="your server's path/addr2.dat";
you can name them as you wish they can be .dat .txt
or any other text format that
your server has a MIME for

====cut
#!/usr/bin/perl
print "Content-type: text/html\n\n";

# File = tclite version 2.
# Author = David Stanley (htmlite).
# Created = February 2002.
# Cost = Free.

# Put the data files into a string for easier use.
$CountFile="your server's path/tclite21.dat";
$IPfile="your server's path/addr2.dat";
$VisitorAddress ="$ENV{'REMOTE_ADDR'}";

# Open the IP file and get current number
open (IPC, $IPfile);
flock (IPC, 2);
$LastIP=;
flock (IPC, 8);
close (IPC);

# Open the counter file and get current number.
open (COUNT, $CountFile);
flock (COUNT, 2);
$Counter=;
flock (COUNT, 8);
close (COUNT);

# Kill the REFRESH bug.
if ($VisitorAddress eq $LastIP){
print "$Counter";
exit;
}

open (IPC,">$IPfile");
flock (IPC, 2);
print IPC "$VisitorAddress";
flock (IPC, 8);
close(IPC);

# Open the counter file for replacing current number with number plus one.
open (COUNT, ">$CountFile");
flock (COUNT, 2);
$Counter++;
print COUNT $Counter;
flock (COUNT, 8);
close (COUNT);

# Display results.
print "$Counter";
=====cut
save the text between the cuts as
counternameyouwant.cgi
make sure you set the correct paths and the file
names for the data files!
use notepad or a ansi plain text editor
save as all files name.cgi
dont use wordpad or a formatted text editor it will add
returns and the script will error.
ftp the cgi to the cgi bin or you can run it in the
same directory as the page in some server's depends
CHMOD to 775 on UNIX
ftp the data files chmod to 666 or 657

then on the page - it must be shtml!
...visitors
and the count will be visable on the page
www.compro-serve.com
upload this file between the ==cuts

This discussion is closed to new replies.