Results 1 to 8 of 8

Thread: Mail List script

  1. #1

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372

    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.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Wouldn't know how.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.

  5. #5

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    There is no error message. I just can't get it to write the postal address to the text file.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.

  7. #7

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    It writes the email address, the name and the date. Like this:

    [email protected]=Test=Oct 08, 02 (15:59:52 BST)
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  8. #8
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width