#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Barcelona
    Posts
    333
    Rep Power
    80

    send URL from email


    Hi, I need to send a value to a script from an email so an update is made in an MySQL table. I use as follows in the email:
    Code:
    <a href='http://www.mydomain.com?pass=xyz' target='_self'>click on this link</a>
    ...and once arriving to destination URL I do:
    PHP Code:
    $sql "UPDATE adherits SET emailOk = 1 WHERE pass = '$_REQUEST[pass]'";
    cnx($sql); 
    It does the job (cnx($sql) is my function to connect to the DB) but I need that the sender is not addressed to that URL but only that data in 'pass' be stored. In other words, after pushing the link, the user shouldn't notice anything.
    How can I accomplish this?
    Thank you!
    Pere
    www.casti2001.com
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,437
    Rep Power
    9645
    Originally Posted by Pere
    I need that the sender is not addressed to that URL
    What does "not addressed" mean? They don't see a browser window? They don't see the page?

    Originally Posted by Pere
    but only that data in 'pass' be stored
    That's up to your code. What you've shown will only "store" the pass value.

    Originally Posted by Pere
    In other words, after pushing the link,
    What does "pushing" mean? Clicking?

    Originally Posted by Pere
    the user shouldn't notice anything.
    If the user has to click a link then they will notice something... What is it you don't want them to see?
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Barcelona
    Posts
    333
    Rep Power
    80
    Thank you Requinix and sorry for my limited English. 1-Yes, I meant "they don't see the page". 2-Yes, wht it really does and is what it is doing is to change the value of the field "emailOk" to 1 (to me, it means email confirmed. 3-Yes, I mean clicking. 4-In fact, the user should click that link and above value be changed and that should be all. The way I do it, he is sent to the URL so his browser is open and relevant web page opened.
    Thanks again for your time and patience!
    Pere
    www.casti2001.com
  6. #4
  7. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,112
    Rep Power
    4103
    Sounds like you either want to track if the mail was opened or validate an email address.

    Tracking open rates is typically done using a pixel image. You insert the image into the message so that when the user opens it the image is loaded and your server can record that event. Some email clients will block external resources specifically because of things like this though, so it's not really something you can rely on. It's only useful to get a rough idea of how many people have read a given email message.

    If you want to validate the email address then requiring user interaction such as clicking a link or entering a code is best. If the user completes the action then you can be reasonable certain the email address is valid (barring things like mailinator).
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Barcelona
    Posts
    333
    Rep Power
    80
    Thank you Kicken.
    May be your proposal could be a workaround for what I am trying but what I try to do is to put a link in an HTML email like
    Code:
    <a href='http://www.mydomain.com?pass=xyz' target='_self'>click on this link</a>
    and collect the value of 'pass' (in the example 'xyz') in the destination PHP file. But I need that when the receiver of the email clicks on the above link, ity do not opens his browser.
    I'll appreciate your help.
    Pere
    www.casti2001.com
  10. #6
  11. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,437
    Rep Power
    9645
    For the link to work it must be opened somewhere. You could try to close the new browser window automatically when you're done but the user would still see it open and close.

    We can help you better if we know why you have this link...
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Barcelona
    Posts
    333
    Rep Power
    80
    Thank you again Requinix. This is used in this website where menu on the right hand side I ask people to subscribe. When they subscribe i write a table with the data and in one field called emailOk I put 0 (not confirmed) and as soon as they click on that URL that field is changed to 1 (confirmed). The way it is now it goes ok but I find unuseful and ugly that a blank page gets opened just the link is clicked. You can try to subscribe and will get the auto answer with the link. No problem for It is just a test area.
    Pere
    www.casti2001.com
  14. #8
  15. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,437
    Rep Power
    9645
    What you're describing is called an opt-in, and there are a few rules and even some laws about how to handle email subscriptions.

    I know you said you didn't want the user to see anything but in this case they really should. Give them the link to let them confirm that they want to be subscribed (a "double opt-in"), and on the page they go to you can show a message that tells them they have fully subscribed - or however you want to phrase it. It's a quick little thing to reassure them that they are subscribed properly.
  16. #9
  17. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Barcelona
    Posts
    333
    Rep Power
    80
    Thank you Requinix. I'll do it the way you suggest.
    Have a nice weekend.
    Pere
    www.casti2001.com

IMN logo majestic logo threadwatch logo seochat tools logo