Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum > PHP Code Library
User Name
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Thread Tools Search this Thread Rate Thread
Old 16-Feb-2007, 21:36
Vahid Vahid is offline
Account Disabled
Join Date: Feb 2007
Posts: 10
Vahid is on a distinguished road

Recommend Us Script


Recommend us script is one of the effective viral marketing tools. It is highly "recommended" to have recommend us page on your website and let visitors to refer others to your website.

Here is the recommend us script I have created. You just need to replace the YourURL with your own domain name. Enjoy!

PHP Code:


//This script is creadted by Vahid Chaychi at
//You need to customize it for your website. The only thing you need
//to do is replacing the with your website URL.

    $sitename = '';
} else {
    $sitename = $_SERVER['HTTP_REFERRER'];

$address = $_SERVER['REMOTE_ADDR'];
$yourname = $_POST['yourname'];
$youremail = $_POST['youremail'];
$email = $_POST['email'];

$message = $_POST['message'];

if($message != 'NA'){
    $come = '<p align="justify"><b> ' . $message . '
</font> </b></p>';

    $themessage = '
    <p align="justify">Your friend <b><u>' . $yourname . '</u></b>
 has sent you an invitation to visit our site.</p>
    <p align="justify">Please visit our site at:
 <a href="' . $sitename . ' " target="_blank"></a></p>
    <p align="justify">Your friend also attached a
 message, which was:</p>
<hr color="#FF0000" width="80%" align="left" size="1"><p>
<b>' . $come . '</b></p>
<hr color="#FF0000" width="80%" align="left" size="1">
    <p>Very truly yours,<br><br>
        ' . $yourname . ' IP address is <u>' . $address . '</u>.</p>

    $subj= "A Message From: " . $yourname . " "; 
    $header = "Return-Path: " . $email . "\r\n"; 
    $header .= "From: $yourname <" . $youremail . ">\r\n"; 
    $header .= "Content-Type: text/html; charset=iso-8859-1;\n\n\r\n"; 
    @mail ($email,"$subj",$themessage,$header);
$message2 = '<font size="2" face="Arial"><b>Thank You For Recommending
 YourURL To Your Friends!</b></font><br>
             <font size="2" face="Arial">You can use the
 form again to recommend
 us to your other friends.</font><br>


<title>Recommend To Your Friends</title>
<body topmargin="0" leftmargin="0">
<form action="<? echo $_SERVER['PHP_SELF'];?>" method="post"
 name="tellfrnd" id="tellfrnd" onSubmit="return validatetell(this)">
     <p style="margin-left: 110">
     if($message2 != NULL){
     echo $message2; } ?>
     <hr color="#FF0000" size="1" width="90%">
  <div align="center">
  <table width="723" border="0" cellpadding="2" height="1">
      <td width="715" height="22" colspan="3">
      <p style="margin-left: 5">
      <font size="4" color="#0683FF"><b>Recommend To
 Your Friends &amp; Partners:</b></font></td>
      <td width="202" height="22">
      <p align="right"><b><font face="Arial" size="2">
Your Name:</font></b></td>
      <td width="513" height="22" colspan="2">
      <input name="yourname" type="text" id="yourname" size="28"></td>
      <td width="202" height="1" valign="middle">
      <p align="right"><b><font face="Arial" size="2">Your Email 
      <td width="513" height="1" colspan="2">
      <input name="youremail" type="text" id="email" size="28"></td>
      <td width="202" height="1" valign="middle">
      <p align="right"><b><font face="Arial" size="2">
Your Friend's Email 
      <td width="513" height="1" colspan="2">
      <input name="email" type="text" id="email" size="28"></td>
      <td width="202" height="1" valign="top">
      <p align="right"><b><font face="Arial" size="2">
Your Message:</font></b></td>
      <td width="513" height="1" valign="top" colspan="2">
      <textarea name="message" id="message" rows="5" cols="42">
      <td height="24" width="202">
      <p align="center">&nbsp;</td>
      <td width="351" height="24">
      <p align="center">
          <input name="Submit" type="submit" id="Submit"
color:#0065CE;font-size:8pt; font-family:Arial"
 value="Submit The Form">
      <td width="157" height="24">&nbsp;</td>

<p align="center"><b><font size="1" face="Arial">
<a target="_blank" href=""></a></font></b></p>

function validatetell(object){
var valid = true;
if(object.yourname.value == 0){
    alert("Please Enter Your Name!");
    return false;
if ("@")==-1 ||".")==-1 ||" ")!=-1 ||<6){
       alert("Please Enter At Least One Valid Email!");;
    return false;
if(object.message.value == 0){
    object.message.value = 'NA';
return valid;

Old 12-Jun-2008, 11:51
counterbugs counterbugs is offline
New Member
Join Date: Jun 2008
Posts: 3
counterbugs is on a distinguished road

Re: Recommend Us Script

Wow. Looks great, has anyone else tried this?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web stats fcolor Web Design Forum 10 12-Jul-2007 08:48
Need Free Website Templates sam_dezine Web Design Forum 8 06-Sep-2006 03:25
Who Is A Web Designer ? alicehopkins Web Design Forum 1 13-Jun-2006 02:56
HTML Code amgujral Web Design Forum 0 07-Apr-2006 09:46
Two virtual hosts, cgi script behaves differently on each blimbo Apache Web Server Forum 0 04-Aug-2004 09:35

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:42.

vBulletin, Copyright © 2000 - 2018, Jelsoft Enterprises Ltd.