|
hmm, write a form, target it to perl or php script and u r done
form example {=< and }=>
{form action="/cgi-bin/email/email.cgi" method="post"}
{input type="text" name="email" size="30" maxlength="50"}
{input type="submit" value="subscribe"}
{/form}
perl script example (only active part):
#!/usr/local/bin/perl -w
my $temp=$ENV{'QUERY_STRING'};
my @pairs=split(/&/,$temp);
foreach $item(@pairs) {
my ($name,$value)=split (/=/,$item,2);
$value=~tr/+/ /;
$value=~ s/%(..)/pack("c",hex($1))/ge;
my $request{$name}=$value;
}
my $storagefile="/usr/home/domain.com/cgi-bin/email/emails.txt";
# path to the file to store emails
print "Content-type: text/html\n\n";
if (open(DB,">>$storagefile"))
{
flock DB, 2;
print DB $request{"email"}."\n";
close(DB);
# here all {} r equal to <>
print "{html}{body}{h1}thank you{/h1}{/body}{/html}";
} else {
# here all {} r equal to <>
print "{html}{body}{h1}error writing to the file{/h1}{/body}{/html}";
}
hope that helps
p.s. don't forget to set permissions of folders and files
folders: 777, cgi script: 755, output file 666
[This message has been edited by aleck (edited 09-21-2001).]
|