#!perl -T
#
#Created by Danny Martin
#Final Project
use CGI qw(:standard);
$name=param("name");
$msg=param("message");
$title=param("title");
print "Content-type: text/html\n\n";
print "<html><head><title></title></head><body>";
#Open the file that stores the thread ID, then add one to the ID
open(NUM, "<num.txt");
$n=getc(NUM);
$n++;
close(NUM);
open(NUM, ">num.txt");
print(NUM "$n");
close(NUM);
if($name eq ''){
$name = "Anonymous";
}
if($name =~ /<.*>/){
print "No special characters allowed!";
}
else{
if($msg =~ /<.*>/){
print "No special characters allowed!";
}
elsif($title eq '' || $title =~ /<.*>/){
print "No title selected!";
}
else{#Problem begins here -
print "Message Posted!";
open(MESSAGE,"+>>$n.txt");
close(MESSAGE);----
# print(MESSAGE '<table bgcolor="#3399AA"><tr><td>');
# print(MESSAGE "$name says: \n");
# print(MESSAGE '<table bgcolor=#3399AA"><tr><td>');
# print(MESSAGE "\t\t$msg\n\n");
# print(MESSAGE "</tr></td></table></tr></td></table>");
# close(MESSAGE);
} #Ends here
}
print '<a href="http://localhost/cgi-bin/Site/site.pl">Click here to return</a>';
print "</body></html>";
It refuses to make the file. It executes perfectly until I want it to make the file. And single quotes won't work before you suggest it, seeing as single quotes don't do escape characters or variables.
What am I doing wrooong? :'[ I need to finish this by tomorrow