Hi. Can someone please tell me why i am getting $template1 shown instead of the variable $template1? The code is below and the HTML code it includes is available at http://www.ace-installer.com/template.html
Code is below;
#!/usr/bin/perl
print "Content-type: text/html \n\n";
#############################################
# Script Copyright 1999-2000 Ace Installer. #
# All Rights Reserved. #
##################################################
# This script is provided to help you install #
# Links 2 on your server. Provided free by #
# Ace Insataller (http://www.aceinstaller.com). #
##################################################
##################################################
###################################################
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/\=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
# Get page 1's Template....
open (DAT, "template.html") || die ("Cannot open template.html - $!");
my @file = <DAT>;
close DAT;
my $template;
foreach (@file) { $template .= $_; }
# Open up classifieds.dat and get all the classifieds
open (ADS, "classifieds.dat");
$split_variables = <ADS>;
@classifieds = split(/<ADNEW>/,$split_variables);
close(ADS);
# The Main Sub Routines
&get_ads;
# This subroutine gets all of the ads and saves them as the variables...
sub get_ads
{
@classifieds1 = split(/:::/,$classifieds[1]);
$ID = "$classifieds1[0]";
$title = "$classifieds1[1]";
$url = "$classifieds1[2]";
$email = "$classifieds1[3]";
$advert = "$classifieds1[4]";
$name = "$classifieds1[5]";
$date = "$classifieds1[6]";
# Print's the first classified
print "$template";
$template1 = "hello";
}
Any help you can offer is much appreciated
Yours
A.J.Newby
Code is below;
#!/usr/bin/perl
print "Content-type: text/html \n\n";
#############################################
# Script Copyright 1999-2000 Ace Installer. #
# All Rights Reserved. #
##################################################
# This script is provided to help you install #
# Links 2 on your server. Provided free by #
# Ace Insataller (http://www.aceinstaller.com). #
##################################################
##################################################
###################################################
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/\=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
# Get page 1's Template....
open (DAT, "template.html") || die ("Cannot open template.html - $!");
my @file = <DAT>;
close DAT;
my $template;
foreach (@file) { $template .= $_; }
# Open up classifieds.dat and get all the classifieds
open (ADS, "classifieds.dat");
$split_variables = <ADS>;
@classifieds = split(/<ADNEW>/,$split_variables);
close(ADS);
# The Main Sub Routines
&get_ads;
# This subroutine gets all of the ads and saves them as the variables...
sub get_ads
{
@classifieds1 = split(/:::/,$classifieds[1]);
$ID = "$classifieds1[0]";
$title = "$classifieds1[1]";
$url = "$classifieds1[2]";
$email = "$classifieds1[3]";
$advert = "$classifieds1[4]";
$name = "$classifieds1[5]";
$date = "$classifieds1[6]";
# Print's the first classified
print "$template";
$template1 = "hello";
}
Any help you can offer is much appreciated
Yours
A.J.Newby