|
-
Oct 9th, 2002, 07:40 AM
#1
Thread Starter
Hyperactive Member
Mail List script
Hi guys,
I have a script for a mail list, which adds the name and email address to a text file. I now deen to be able to add the street address, town, county and postcode. I tried modifying the script myself but can't get it to work. Could someone have a go or show me where I'm going wrong?
Here's the part of the script that adds the details to the text file:
sub add {
$dup = 0;
if (-e "$list")
{
open (FILE,"$list") || die "Can't open $list!\n";
@lines=<FILE>;
close(FILE);
foreach $line (@lines) {
&splitlist;
if ($uemail eq $email) {$dup = '1';}
}
}
if ($dup eq '0')
{
while (-f $listlock){select(undef,undef,undef,0.1);}
open(LOCKFILE, ">$listlock");
open (FILE,">>$list");
print FILE "$email=$name=$date\n";
close(FILE);
close(LOCKFILE);
unlink($listlock);
}
&printresult;
}
I tried doing this:
open (FILE,">>$list");
print FILE "$email=$name=$address=$town=$county=$postcode=$date\n";
close(FILE);
but it didn't work.
-
Oct 9th, 2002, 07:56 AM
#2
Stuck in the 80s
Re: Mail List script
Originally posted by GingerNut
Hi guys,
I have a script for a mail list, which adds the name and email address to a text file. I now deen to be able to add the street address, town, county and postcode. I tried modifying the script myself but can't get it to work. Could someone have a go or show me where I'm going wrong?
Here's the part of the script that adds the details to the text file:
sub add {
$dup = 0;
if (-e "$list")
{
open (FILE,"$list") || die "Can't open $list!\n";
@lines=<FILE>;
close(FILE);
foreach $line (@lines) {
&splitlist;
if ($uemail eq $email) {$dup = '1';}
}
}
if ($dup eq '0')
{
while (-f $listlock){select(undef,undef,undef,0.1);}
open(LOCKFILE, ">$listlock");
open (FILE,">>$list");
print FILE "$email=$name=$date\n";
close(FILE);
close(LOCKFILE);
unlink($listlock);
}
&printresult;
}
I tried doing this:
open (FILE,">>$list");
print FILE "$email=$name=$address=$town=$county=$postcode=$date\n";
close(FILE);
but it didn't work.
Why don't you do this in PHP and use a MySQL database? It'd be so much easier.
-
Oct 9th, 2002, 08:23 AM
#3
Thread Starter
Hyperactive Member
-
Oct 9th, 2002, 10:00 AM
#4
Black Cat
What exactly is the problem or error message? And can't you use the flock() function for file locking?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Oct 9th, 2002, 10:35 AM
#5
Thread Starter
Hyperactive Member
There is no error message. I just can't get it to write the postal address to the text file.
-
Oct 9th, 2002, 01:31 PM
#6
Black Cat
So what's it writing to the text file, empty strings between the '=' where the address parts should be?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Oct 9th, 2002, 02:28 PM
#7
Thread Starter
Hyperactive Member
It writes the email address, the name and the date. Like this:
[email protected]=Test=Oct 08, 02 (15:59:52 BST)
-
Oct 9th, 2002, 02:43 PM
#8
Stuck in the 80s
Originally posted by GingerNut
Wouldn't know how.
So learn?
Rather than posting here for everyone to fix your scripts for you. I've done a couple of them for you in the PHP forum.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|