Forum Moderators: coopster

Message Too Old, No Replies

Tell-A-Friend with URL Capture

Is php able to do this?

         

oceanwave

3:04 pm on Mar 31, 2005 (gmt 0)

10+ Year Member



I am able to code a tell-a-friend script in javascript, using the mailto function, while capturing the URL of the page the script is located on. Since the script appears on a php index page that feeds different pages within the script, the page URL does change even though it is coded once. This is the reason I need to capture the URL.

I just read that the javascript mailto function could be a problem for some email systems, so I decided to see if this could be done in php. All I want is a simple form that asks the user their name and their friend's email address. This is then fed into the mailing along with the current page URL and a brief message.

Can this be done in php?

Am I correct that using javascript/mailto could be a problem as compared to programming this in php, or am I going to have the same problem?

What is the best way to code a tell-a-friend script so everyone is able to use it regardless of their email program, and I am able to capture the page URL in an email?

Thank you!

brendan3eb

5:10 pm on Mar 31, 2005 (gmt 0)

10+ Year Member



I don't know if there is a problem with javascript, but it can be done in php. I don't think many people would have a script like this, cause you get in trouble if someone decides to use the form to spam. I'd recommend setting only allowing one person to tell a certain amount of friends a day and track this in every possible way: cookies&sessions, ip, flash sharedObjects, etc.

you could catch the url with this code:
$dirandfile = $_SERVER['PHP_SELF'];
$domain = $_SERVER['SERVER_NAME'];
$url = "http://$domain$dirandfile";

and for mailing you can use the mail() function.

oceanwave

7:17 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



Thank you so much for answering brendan3eb!

I guess the issue of spamming wouldn't be a problem if I use the mailto function. The emails would be coming directly from the user's email, rather than from my site. The mailto would open the user's email program.

I just got nervous when I read something about the mailto function and people using aol. Unfortunately, I can't find the post again (came across it during one of my Google searches). Thought I'd find out if it was true or not.

I still am unsure if I am better off using javascript or php?

brendan3eb

7:35 am on Apr 3, 2005 (gmt 0)

10+ Year Member



I'd recommend using php, based on the fact that some people have javascript blocked, however, i dont see any spam problems as long as the email is not coming from your server.