FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


question about mail a friend script





golles
I'm just making some scripts for fun, and I'm now working on a mail to friend script, wat is the best way to get the url the user wants to send to his friend? should I send from the current page to the send page with $_GET or should I use $_SERVER['HTTP_REFERER'] are both ways trustfull and will they work, or is it posible that something goes wrong with one of those??

when you are also willing to give me an answer maybe you can tell me if you like that page pop-ups so you fill in the form and the mail will be send or go to another page and send it from that?


//golles
rohan2kool
$_SERVER['HTTP_REFERER'] is not a reliable method, as some browsers don't support that and also many of them allow that value to be masked/aliased. So, it's better to send it via a GET or POST variable. To make it operable across all sites, while you are loading the current page (the page which you want to send to the user), in the form where you accept the email adress of the person, add a hidden form field:

Code:

$url = $_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'];
printf('<input type="hidden" value="'.$url.'" name="current_url" />');


So, whenever this form is submitted, you'll get a variable $_POST['current_url'] with the value of the URL that is to be sent.

Hope it helps... but do remember, don't at all use HTTP_REFERER when you are having an alternative.
Related topics
My Mailer Script
how u get perfaction in php and myqsl programing
No offense ment by this
Mail attachment script???
Simple(?) probability question
Script Problem
30 $FRIH to fix my script!!
Best Script For Me ?
Form Mail help........lol
Girls... What do they really want :D
Free Great scripts for your site
Deleting unverified users... I AM CONFUZLED!
Email problem
How will run question answer website?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.