PHPBuilder - Refer a friend

RSS Twitter

Refer a friend

by: Justin Gloor
August 23, 2001

Version: 1.0.0

Type: Full Script

Category: Other

License: Other

Description: Here's a (borrowing an emailer script) very simple, one-file, 15-minutes-to-set-up website referrer. Just fill in the To and From fields, and voila, it's sent. Just upload it as a .php file, make a link to it on the pages you want to be referred, and it will work. It uses HTTP_REFERER, so it MUST be linked from somewhere. You only need one file, so there's no reason to make different copies for different directories or pages. Here's the cool part: You don't have to credit me! This is just simple PHP. If anyone wants to to do anything else with it, go ahead and submit updates. Have fun!

<b>Tell a friend about our site!</b>
If ($to_email && $message && $subject) {$to = "\"$to_name\" <$to_email>";
$from = "\"$from_name\" <$from_email>";
$to = str_replace("\\'", "'", $to);
$from = str_replace("\\'", "'", $from);$subject = str_replace("\\'", "'", $subject);
$message = str_replace("\\'", "'", $message);
mail($to, $subject, $message, "From: $from\nX-Mailer: TYPE YOUR BUSINESS NAME HERE");
echo "Mail message sent : \nTo : $to\nFrom : $from\nSubject : $subject\nMessage : $message";
exit; } ?>

<form action=<?php echo $PHP_SELF; ?> METHOD=POST>
To (Friend's name): <input type=text name=to_name>
To (Friend's email): <input type=text name=to_email>
From (Your name): <input type=text name=from_name>
From (Your email): <input type=text name=from_email>
Subject : <input type=text name=subject>
Message: <textarea name=message cols=60 rows=10>

I found this page and thought you'd be interested.

<? if (empty($HTTP_REFERER)) { $referrer = 'No referrer reported'; } else { $referrer = $HTTP_REFERER; } echo $referrer; ?>
<input type=submit value=Mail></form>

Comment and Contribute

Your comment has been submitted and is pending approval.

Justin Gloor



(Maximum characters: 1200). You have characters left.