PDA

For continued disscussion on this topic : inserting command to execute perl in html



roro
08-11-2000, 08:26 AM
this is the .pl

#!/usr/bin/perl
# Type The absolute of the the LOG file.
$log = "/home/uninet/data/exam_log.txt";

# Type the absolute path to the counter file.
$count = "/home/uninet/data/exam_num.txt";

# Type name of your site
$name = "Your Site's Name Here.";

# Type the absolute path to the statistic page. (The page that views the log)
$stat = "/home/uninet/www/exm/stat.html";

# What is the ending of the digits (you need to get a full set of 10 images to
#represent the digits)?
$end = ".gif";

$path = "exm/";

$min_length = "000";

#Testing Date
@months = ('Jan','Feb','Mar','Apr','May','June',
'July','Aug','Sept','Oct','Nov','Dec');

@days = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');

($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$date = " $days[$wday], $months[$mon]/$mday/$year $hour:$min:$sec";

# Get Count
open (CD, "$count");
$counter = <CD>;
close (CD);

chop ($counter) if $count =~ /\n$/;
# Increase Count
$counter++;
open (CD, ">$count");
print CD $counter;
close (CD);
print "Content-type: text/html\n\n";
$counter = sprintf("%${min_length}.f", $counter);
$counter =~ s/ /0/g;
@digit = split(//, $counter);

# Print Counter
foreach $digit (@digit) {
$i = "<img src=\"${path}${digit}${end}\" alt=\"${digit}\">";
print "$i";
}

#Logging
open (datk, ">>$log");
print datk "<td>$counter</td><td><a href=\"$ENV{'HTTP_REFERER'}\">$ENV{'HTTP_REFERER'}</a></td><td>$ENV{'REMOTE_ADDR'}</td><td>$date</td><td>$ENV{'HTTP_USER_AGENT'}</td><TR>";
close (datk);
open (datk, "$log");
$data = <datk>;
close (datk);
#Print Sheet
open (logs,">$stat");
print logs "<html><head><title>Statistics for $name.</title></head><body>You've had $counter non-unique hits (details may take awhile to load).<BR><table border = 1><td>Hit No.</td><td>Referer</td><td>IP address</td><td>date</td><td>client</td><TR>$data</table><BR>(C)1997-2000 <a href=\"http://www.roro.com\">roro</a>. Count\+Stat&trade; V1.5.4 (03.04.2000)<BR><i>$ENV{'SERVER_SOFTWARE'}</i> </body></html>";
close (logs);

how can i execute this program in my web page

big_wreck
08-11-2000, 12:09 PM
The usual syntax is:

<!-- exec cgi = "path to script" -->

is the usual way of doing it.
You must have access to cgi services on your server

-------------------------------------
Can we move this to the CGI forum ??

Arielladog
08-11-2000, 01:55 PM
I haven't used this command before (don't use CGI at all), but isn't it:

<!--#exec cgi="path to script"-->

P.S.-Congrats on your 100th post, BW :)

[Edited by Arielladog on 08-11-2000 at 08:29 AM]

big_wreck
08-11-2000, 02:39 PM
Oops .. fat fingered that one .. thanks for picking up the # A-dog !! :)

Thanks on the congrats .. does this mean privileges ??

caislander
08-11-2000, 03:03 PM
Morning

Please do not open a new thread for each post continue to use the same one for all questions reference a single problem.. To that end I am closing your previous thread; http://www.webxpertz.net/forums/showthread.php?threadid=689


Later :)

wiseone
08-26-2000, 05:56 PM
I hardly know any thing about perl but I have a magazine in front of me with related material. they way they do it is to use PerlScript. If you can conform your perl into
PerlScript this is how they do it:

<%@ LANGUAGE = PerlScript %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HEAD>
<TITLE></TITLE>
</HEAD>
</BODY>
<%
.....Your Perl Script.....
%>
</BODY>
</HTML>

Hope it help's

WiseOne

rick
08-30-2000, 06:57 PM
This is not conventional, but it works for me:

<img src="cgi-bin/script.pl" border=0 height=0 width=0>

roro
08-31-2000, 07:54 AM
i can't put <img src="cgi-bin/script.pl" border=0 height=0 width=0>
cause the output of my script is <img src="exm/1.gif" alt="1"><img src="exm/2.gif" alt="1">
so
any proposition?