Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    mailing list problem

    Hi,

    I've got a problem with a mailing list program. The setup and everything worked fine, but every time that I sent a test message to myself, the link is broken in half and doesn't work when it's pasted together.

    Since I don't know a thing about PHP, I've included the code below, so maybe you can help me out by finding the error.

    Thanks!
    ---------------------------------------------------------------------------



    <?

    if (file_exists("setup/setup.phtml")):

    include("setup/setup.phtml");

    if (file_exists("$listadmin/$list.phtml")):

    include("$listadmin/$list.phtml");

    if (file_exists("$header.phtml")):
    include("$header.phtml");
    endif;

    echo "<center><br><br><br>";

    function emailOK($str) {
    $badChars = "[ ]+| |\+|=|[|]|{|}|`|\(|\)|,|;|:|!|<|>|%|\*|/|'|\"|~|\?|#|\\$|\\&|\\^|www[.]";
    return (eregi($badChars,$str));
    }

    if ($enc != ""):
    if (file_exists("confirm/$enc")): $optin = "off"; include("confirm/$enc"); endif;
    endif;

    if ( !(eregi("([a-z0-9_\.-])+@([a-z0-9_\.-])+\.([a-z0-9_\.-])+",$email)) || emailOK($email)):

    echo "<P>The address <b>$email</b> you submitted is not a valid one.
    <BR>Please check and try again.";
    echo "<P><FORM><INPUT class=\"btn\" TYPE=BUTTON VALUE=\" Back\" onClick=\"history.go(-1)\"></form>";

    else:

    if (file_exists("$lists/$id.phtml")):

    exec("grep $email $lists/$id.phtml",$execAr);

    if ($execAr[0] != ""):

    echo "<IMG SRC=\"http://www.brokenfrontier.com/images/bigl.jpg\" WIDTH=236 HEIGHT=110 BORDER=0><p><b>Error!</b><BR>This address has already been submitted to the list. <P><FORM><INPUT class=\"btn\" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

    else:

    if ($optin == "on"):

    $enc = uniqid("");

    $to = "$email";
    $from = "$listname <$from>";
    $subject = "Sign up Confirmation";
    $body = "Thanks for subscribing to $listname list.\n\nTo confirm your registration, please click on the link below :\n$url/subscribe.phtml?list=$list&enc=$enc\n\nIf you did not register, do not click on the link and you will not receive any further newsletters.";

    mail($to,$subject,$body,"FROM: ".$from);

    $filemessage = "<? \$email = \"$email\"; ?>";
    $cartFile = fopen("confirm/$enc","w+");
    fputs($cartFile,$filemessage);
    fclose($cartFile);

    echo "Thanks!<P>A message has been sent to <b>$email</b> to complete your registration.<BR>Please check your email and follow the instructions. <P><FORM><INPUT class=\"btn\" TYPE=BUTTON VALUE=\" Back \" onClick=\"history.go(-1)\"></form>";

    else:

    $filename = "$lists/$id.phtml";
    $fd = fopen( $filename, "r" );
    $contents = fread( $fd, filesize( $filename ) );
    fclose( $fd );

    if ($contents == ""):
    $fileMessage = "$email";
    else:
    $fileMessage = "\n$email";
    endif;

    $count=0;
    $maxloop=5;
    $finished=0;
    while ($count<$maxloop&&!$finished) {
    if (file_exists("$lists/$id.phtml")):

    exec ("mv -f $lists/$id.phtml $lists/$id.tmp");

    $cartFile = fopen("$lists/$id.tmp","a+");
    fputs($cartFile,$fileMessage);
    fclose($cartFile);

    exec ("mv -f $lists/$id.tmp $lists/$id.phtml");
    $finished=1;

    else:

    sleep(1);

    endif;
    $count++;
    }

    echo "<IMG SRC=\"http://www.brokenfrontier.com/images/bigl.jpg\" WIDTH=236 HEIGHT=110 BORDER=0><P>Thanks!<P><b>$email</b> has been added to the mailing list.";

    endif;

    endif;

    else:

    echo "<IMG SRC=\"http://www.brokenfrontier.com/images/bigl.jpg\" WIDTH=236 HEIGHT=110 BORDER=0><P><b>Error!</b><BR>The newsletter to which you want to subscribe no longer exists.";

    endif;
    endif;

    else:

    echo "Sorry, your address could not be added at the moment.<BR>Please try again later.";

    endif;

    else:

    echo "Sorry, your address could not be added at the moment.<BR>Please try again later.";

    endif;


    if (file_exists("$footer.phtml")):
    include("$footer.phtml");
    endif;

    ?>

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    anyone, please?


  •  

    Posting Permissions

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