Gastenboek
Dit is het script:
#!/usr/bin/perl
require ('cgi-lib.pl');
## Change the following to point correctly to your server's sendmail program
$mailprog = '/usr/lib/sendmail';
## Change the following to point correctly to your guestbook's URL
$guestbook_url = "http://www.hondenschooldekorteling.nl/guestbook_view.html";
## Change the following to point correctly to your guestbook's path in the server
$guestbook_file = "/storage/mijndomein/users/016222/public/sites/www.hondenschooldekorteling.nl/guestbook_view.html" ;
## Change the following to the email address where you want the notification sent
## Don't forget the backslash "\" before the "@" sign
$my_email = "gastenboek\@hondenschooldekorteling.nl";
## Change the following error message as you see fit. You may also leave it as it is.
$message = "The following error(s) occurred while processing your input." ;
###############################
## DO NOT EDIT PAST THIS LINE
###############################
&ReadParse(*field);
$name = $field{'name'} ;
$name =~ s/<([^>])*>//g;
$email = $field{'email'} ;
$email =~ s/<([^>])*>//g;
$homepage_title = $field{'homepage_title'} ;
$homepage_title =~ s/<([^>])*>//g;
$homepage_url = $field{'homepage_url'} ;
$homepage_url =~ s/<([^>])*>//g;
$main_message = $field{'main_message'} ;
$main_message =~ s/<([^>])*>//g;
$found_err = "" ;
$getdate = `date +"%D %T %Z"`;
chop ($getdate);
#####################################################
# IF THERE ARE MISSING ENTRIES, PRINT ERROR MESSAGE
#####################################################
$errmsg = "<LI>You forgot to enter your name.</LI>\n" ;
if ($name eq "") {
$message = $message.$errmsg ;
$found_err = 1 ; }
$errmsg = "<LI>Please enter a valid email address</LI>\n" ;
if ($email !~ /.+\@.+\..+/) {
$message = $message.$errmsg ;
$found_err = 1 ; }
$errmsg = "<LI>Please enter your homepage title.</LI>\n" ;
if ($homepage_title eq "") {
$message = $message.$errmsg ;
$found_err = 1 ; }
$errmsg = "<LI>Please give us your homepage URL.</LI>\n" ;
if ($homepage_url eq "") {
$message = $message.$errmsg ;
$found_err = 1 ; }
if ($found_err) {
&PrintError; }
########################################
# PRINT ENTRIES TO THE GUESTBOOK PAGE
########################################
open (FILE,"$guestbook_file") || die "Can't Open $guestbook_file: $!\n";
@lines = <FILE>;
close(FILE);
flock(POST, 2) ;
open (POST,">$guestbook_file") || die "Can't Open $guestbook_file: $!\n";
$main_message =~ s/&/&/g;
$main_message =~ s/"/"/g;
$main_message =~ s/>/>/g;
$main_message =~ s/</</g;
$main_message =~ s/\cM\n/<BR>/g;
foreach $line (@lines) {
if ($line =~ /<!--begin-->/) {
print POST "<!--begin-->\n";
print POST "<DIR> \n";
print POST "<FONT COLOR=\"#FF0000\"><B>Name:</B></FONT> <A HREF=MAILTO:$email>$name</A><BR> \n";
print POST "<FONT COLOR=\"#FF0000\"><B>Homepage:</B></FONT> <A HREF=$homepage_url>$homepage_title</A><BR> \n";
print POST "<FONT COLOR=\"#FF0000\"><B>Date Posted:</B></FONT> $getdate<BR> \n";
print POST "<FONT COLOR=\"#FF0000\"><B>Message:</B></FONT><BR>$main_message</DIR><HR WIDTH=90%><BR> \n";
} else {
print POST ("$line");
}
}
close (POST);
flock(POST, 8) ;
&success;
¬ify;
######################
# PRINT SUCCESS PAGE
######################
sub success {
print "Content-type: text/html\n\n";
print<<"end1";
<HTML>
<BODY BGCOLOR=WHITE>
<CENTER>
<H1>Thank you for signing my guestbook</H1>
<A HREF=$guestbook_url>View Guestbook</A>
</BODY>
</HTML>
end1
}
######################
# NOTIFY BY EMAIL
######################
sub notify {
open (MAIL,"|$mailprog -t");
print MAIL "To: $my_email\n";
print MAIL "From: Guestbook Notification System\n";
print MAIL "Subject: NEW GUESTBOOK ENTRY\n";
print MAIL "You have a new guestbook entry posted by $name\n";
print MAIL "from this IP - $ENV{'REMOTE_HOST'} \n";
print MAIL "You may view it at $guestbook_url\n";
close (MAIL);
exit;
}
#########################
# OUTPUT ERROR MESSAGE
#########################
sub PrintError {
print "Content-type: text/html\n\n";
print "<HTML><TITLE>Error!</TITLE></HEAD><BODY BGCOLOR=\"#FFFFFF\">\n\n";
print "<OL><H2>\n";
print $message;
print "</OL></H2></BODY></HTML>";
exit 0 ;
return 1 ;
}
Dit is geen PHP maar dit is een PERL script.
Ja sorry, je hebt gelijk.
bruut :)
www.perlhulp.nl uit jongens?
na csshulp.nl en jsphulp.nl?
:P
Wanneer komt na csshulp.nl en jsphulp.nl?
:P
Gewijzigd op 01/01/1970 01:00:00 door Crispijn -