Page 12 of 14 FirstFirst ... 21011121314 LastLast
Results 111 to 120 of 137

Thread: javascript? php? simple mailing list database?

  1. #111
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Fun. Hehe.



    Ok, here's the trim stuff:
    Replace $email = stripslashes($_POST['email']);
    with:
    $email = stripslashes(trim($_POST['email']));

    And
    $edited = str_replace($email,"",$filecontents);
    with:
    $edited = trim(str_replace($email,"",$filecontents), " ,");


    Let's see how that works.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #112
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi dj,

    thanks for the code... don't know if it's done anything... was it going to give the user an error message if they just put a couple of spaces in? and was the alert going to not pop up? i dunno... i've updated the txt file if you wanna take a look, maybe i've stuffed it some where...

  3. #113
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    All that code does is removes extra spaces from the beginning/end of the email (It would make the whole thing nothing if it's only spaces... maybe an error needs to be coded in for that.)

    The other occurance of it trims down the text file once a name has been removed.
    This won't be noticable unless you're really looking for it:
    What will happen is this:
    You remove a@b.c from:
    x@x.x, a@b.c, x@x.x
    It'll give you:
    x@x.x, , x@x.x
    I'm gonna fix that (later this post I'll give you the code), and it will just make it:
    x@x.x, x@x.x
    So... that's fine...
    But... if you had:
    x@x.x, a@b.c
    then removed a@b.c, you'd get:
    "x@x.x, "
    with and extra comma and space at the end.
    The trim function will fix that.

    Anyway, to finish that up, change:
    $edited = trim(str_replace($email,"",$filecontents), " ,");
    to:
    $edited = trim(str_replace(" ,", "", str_replace($email,"",$filecontents)), " ,");


    See if that works.

    Basically... clear the emails from the file, then try adding emails, then deleting those emails until you get a blank file... delete the end ones especially (first added and last added) just to be sure it all works.



    Anyway... at this point... how's it all working? What's left to fix?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #114
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That works beautifully! Give it a try...

    Yea the only thing left to do (I Think) is just stopping the alert if you get an error when entering the email address and also giving people an error message if they put white space in...

    Oh also the error has stopped if say they enter just "tom" I updated the txt file for ya!

  5. #115
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Oh also the error has stopped if say they enter just "tom" I updated the txt file for ya!
    Um... what?


    The alert shouldn't be too hard.

    I'm insanely busy this weekend. Sorry. When I get more time, I'll do it.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #116
    Join Date
    Jun 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi guys,

    I've been following your progress withe the code. I was wondeirng if you would so kind as to post the final script on here. I tired updating the change syou made but i think i'm quite a bit lost. I am very new to php, but i am trying to learn. If you could be post it, it would be a great help.

    thanks

  7. #117
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you just take a look at his source code, you can likely copy most of that. The link is somewhere in the thread.

    I do plan to write it up at some point... just way too tired right now. Yet another late night. Sorry, guys. I will get to it.
    Probably Monday.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #118
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33
    Um... what?


    The alert shouldn't be too hard.

    I'm insanely busy this weekend. Sorry. When I get more time, I'll do it.
    Hi Dj... Hope all is well! What I meant to say was if the user types in less than 4 characters they don't actually get an error... Try it on the site...

  9. #119
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ah.

    could just add in...
    if (strlen($var) < 4) {error}

    something like that.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #120
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Where abouts do I add it? Sorry not sure...

Bookmarks

Posting Permissions

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