#native_company# #native_desc#
#native_cta#

Refer a friend

By Justin Gloor
on 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>
<p>
<?php
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: $fromnX-Mailer: TYPE YOUR BUSINESS NAME HERE");
echo "Mail message sent : nTo : $tonFrom : $fromnSubject : $subjectnMessage : $message";
exit; } ?>

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

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

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