Jump to content

How do i invite people to my website (Like Facebook)


ammar555

Recommended Posts

I only have one quick question and I hope someone will direct me to the right path. As we all know Facebook is very growing website, and i have noticed something that they use. When someone registers on their website, they ask you to log in to your e-mail and they try to find your friends based on who you have in your list. Now i am want to create something similar to that, but i really don't know how to start? I am not even sure if i need php to do that. When someone registers on my website, I want to let them invite all of their friends by sending them a message automatically so that they could come and register on my website too  ::) . How do i start?  >:( What is the idea here? Will i need php to do that ? I would love any help!

Link to comment
Share on other sites

What you are looking for is a "PHP invite a friend script" and yes it could be written in PHP.

 

You can ask people for help in the forums to help you write one or you can search for it on the search engines.

 

Good luck!

 

I will google that right now and thanks, if i have something i will come back

Link to comment
Share on other sites

You can use API's, which can be gotten by Windows Live, Yahoo, Google mail, and others, or you can simply have a textbox for your users friends email address('s) and use the mail() function to process it.

 

 

Is this what you mean?

http://msdn.microsoft.com/en-us/library/bb463989.aspx

 

Or is this something else? Do you know where i can get examples ?

Link to comment
Share on other sites

Yes, that can help you. Bare in mind, it's confusing and you need atleast a VPS hosting. (Most shared hostings dont support all the features it needs) Hence why I've just stuck to an invite a friend script in PHP. It's pretty basic and rubbish, but I can post it through if you want?

Link to comment
Share on other sites

Yes, that can help you. Bare in mind, it's confusing and you need atleast a VPS hosting. (Most shared hostings dont support all the features it needs) Hence why I've just stuck to an invite a friend script in PHP. It's pretty basic and rubbish, but I can post it through if you want?

 

Yes please I would love that, at least i will get the idea

Link to comment
Share on other sites

   
<?php
        if(isset($_POST['invite'])) {
      if(empty($_POST['recipent'])) { //Check if the recipent field in the form is empty
                       echo "You have left an empty field!"; 
                } else {
         $to = $_POST['recipent']; //Recipent field in the form - This is the email the invitation is going to
         $subject = "SUBJECT HERE."; //Subject
         $message  = "YOUR MESSAGE HERE"; //Message
         $header  = "From: YOUR-NAME <[email]YOUR-EMAIL@EMAIL.COM[/email]> " . "\r\n"; //Set the header of the message

         $send = mail($to, $subject, $message, $header); //Put it all together and SEND!

         echo "Your invitations have been sent!"; //It's successful so display a message
      }      
   }
?>   
   <form action="" method="post"> 
   <span>Type in your friends emails seperated with a comma and click invite!</span><br />
   <input type="text" name="recipent" id="recipent" size="50" />
<input type="submit" name="invite" value="Invite!" />
   </form>

 

Replace.. "SUBJECT HERE", "YOUR MESSAGE HERE", "YOUR-NAME", "YOUR-EMAIL@EMAIL.COM", with the desired inputs.

 

This should work though.

 

edit: multiple email addresses can be used, if it's seperated.

Link to comment
Share on other sites

   
<?php
        if(isset($_POST['invite'])) {
      if(empty($_POST['recipent'])) { //Check if the recipent field in the form is empty
                       echo "You have left an empty field!"; 
                } else {
         $to = $_POST['recipent']; //Recipent field in the form - This is the email the invitation is going to
         $subject = "SUBJECT HERE."; //Subject
         $message  = "YOUR MESSAGE HERE"; //Message
         $header  = "From: YOUR-NAME <[email]YOUR-EMAIL@EMAIL.COM[/email]> " . "\r\n"; //Set the header of the message

         $send = mail($to, $subject, $message, $header); //Put it all together and SEND!

         echo "Your invitations have been sent!"; //It's successful so display a message
      }      
   }
?>   
   <form action="" method="post"> 
   <span>Type in your friends emails seperated with a comma and click invite!</span><br />
   <input type="text" name="recipent" id="recipent" size="50" />
<input type="submit" name="invite" value="Invite!" />
   </form>

 

Replace.. "SUBJECT HERE", "YOUR MESSAGE HERE", "YOUR-NAME", "YOUR-EMAIL@EMAIL.COM", with the desired inputs.

 

This should work though.

 

edit: multiple email addresses can be used, if it's seperated.

 

It looks great, i will check it out and come back, ("YOUR MESSAGE HERE"), I still have to design the invitation message, and make it look like a website (HTML format). When I am done with the design, Do I copy the code and paste it instead of  ("YOUR MESSAGE HERE")

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.