SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    VICTORY IS MINE! luchazard's Avatar
    Join Date
    May 2001
    Location
    USA
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is there a tell-a-friend tutorial in php?

    I want to write my own tell-a-friend script in php... is there a tutorial to get me started??

  2. #2
    SitePoint Addict lveale's Avatar
    Join Date
    Jun 2001
    Location
    Dublin
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds easy enough. Get the host $HTTP_HOST and the php page $PHP_SELF, and pass it to a function that contains a call to the mail function.

    You could add additional parameters i.e your name, their name.
    PHP Code:

    $disPage 
    $HTTP_HOST $PHP_SELF;
    $urmail "lar@laurenceveale.com";
    $dermail "webmaster@sitepoint.com";

    refer2friend($urmail,$dermail$disPage);


    function 
    refer2friend($yourmail$theirmail$page)
    {
     if(
    is_email($yourmail) && is_email($theirmail))
     {  
      
    $subject "$yourmail thinks you should see $page";
      
    $message "Hi $theirmail,\n" .
                 
    "$yourmail thinks the following page may be of interest to you:\n" .
                 
    "$page";

      
    mail("$theirmail""$subject"$message,"From:  yourmail");
     } 
    //end if
    }//end function 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •