TinyPortal

Development => Block Codes => Topic started by: rebelrose on August 29, 2006, 07:11:25 PM

Title: Tell A Friend Block
Post by: rebelrose on August 29, 2006, 07:11:25 PM
I have a Tell A Friend Block, that send up to three email, to tell a friend about your site. If anyone is intered in the code. You have to have custom mod installed for this to work. A member on my forum showed this to me.

You can see it work here Forum (http://www.rebelrosenetworks.com/forum/index.php)
Title: Re: Tell A Friend Block
Post by: G6Cad on August 29, 2006, 07:14:26 PM
That looked really nice, i love the image you use in the tell a friend block :)
Title: Re: Tell A Friend Block
Post by: rebelrose on August 29, 2006, 07:18:52 PM
Thank you Mrs G6
Title: Re: Tell A Friend Block
Post by: RoarinRow on August 29, 2006, 07:42:20 PM
Very nice, do you have the code you can share?
Title: Re: Tell A Friend Block
Post by: rebelrose on August 29, 2006, 07:48:09 PM
This is how it works:

First you have to download and install the "custom actions" mod

then after that you go and create a javascript/html bloc telling people about it

the code I use for it is this:



<div align="center"><a href="http://yoursite.com/forum/index.php?action=tellafriend"><img

src="http://yoursite.com/forum/Themes/yourtheme/images/friends.gif" width="125" height="125"

border="0" /></a></div>


then you go into the admin and custom actions and create 2 pages - both are HTML

first the "tell a friend" page:


<html>
<head>
<title>tell a friend</title>
<script language="javascript">
<!--

function reset() {
document.tellafriend.name.value="";
document.tellafriend.email.value="";
document.tellafriend.friendmail1.value="";
document.tellafriend.friendmail2.value="";
document.tellafriend.friendmail3.value="";
}

function validate() {


if (document.tellafriend.friendmail1.value.length==0) {
alert("please enter your friend's email address");
return false;
}

if (document.tellafriend.email.value.length==0) {
alert("please enter your email address");
return false;
}
if (document.tellafriend.name.value.length==0) {
alert("please enter your name");
return false;
}

document.tellafriend.submit()
return true;
}

//-->
</script>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="500" cellpadding="0" cellspacing="0" align="center">
  <tr valign="top">
    <td valign="middle" align="center"><img

src="http://www.yoursite.com/forum/Themes/yourtheme/images/tell.gif" width="500" height="100"></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center"> <p><font color="#000099" size="4" face="Arial">Complete
        the details below to send our link to your friends.</font></p>
      <form name="tellafriend"

action="http://www.yoursite.com/forum/Themes/yourtheme/tellafriend.php" method="post"

onsubmit="return checkfields()">
        <div align="center">
          <center>
            <table width="500" border="0" cellpadding="10" cellspacing="0">
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial"> *your
                  name:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="name" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">*your
                  email:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="email" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td colspan="2"> <p align="center"><font color="#000099"><strong><font size="2"

face="Arial">please
                    enter your friend's email addresses:</font></strong></font></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">*email
                  1:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="friendmail1" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">email
                  2:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="friendmail2" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td><strong><font color="#000099" size="2" face="Arial">email
                  3:</font></strong></td>
                <td> <strong><font color="#000099" size="2" face="Arial">
                  <input size="30" name="friendmail3" maxlength="45">
                  </font></strong></td>
              </tr>
              <tr>
                <td colspan="2"> <p align="center"><font color="#000099"><strong><font size="2"

face="Arial">
                    The email that will be sent will contain your name and email
                    address. <br>
                    <input onclick="validate();" type="button" value="click here to send">
                    </font></strong></font></td>
              </tr>
            </table>
          </center>
        </div>
      </form></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center">&nbsp; </td>
  </tr>
</table>
</body>
</html>


then the thank you page:


<html>
<head>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="500" cellpadding="0" cellspacing="0" align="center">
  <tr valign="top">
    <td valign="middle" align="center">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center"><img src="http://yoursite.com/myimages/thankyou.gif" width="400"

height="300"></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center">&nbsp; </td>
  </tr>
</table>
</body>
</html>


NOW you need to create a php file for the whole thing to work and name it "tellafriend.php"
you load this to your theme folder

the file should contain this info:


<?PHP

// This following statement must be left intact.
// Taming The Beast Tell-A-Friend script V 1.2
// Taming the Beast.net - http://www.tamingthebeast.net
// Free Web Marketing and Ecommerce Resources
// By using this code you agree to indemnify
// Taming the Beast from from any liability that might arise
// from it's use.
// This following statement must be left intact.

# This section removes any nasty tags that the user may
# have input into any of the form fields

strip_tags($friendmail1);
strip_tags($friendmail2);
strip_tags($friendmail3);
strip_tags($email);
strip_tags($name);


# This section sends you a notification email when
# the form is used

// Your email address (for copies to be sent to you)
$emailto = "you@yoursite.com";

// Your email subject text
$esubject = "a page has been sent";

// The email text for copies sent to you
$emailtext = "
".$name." has used the tell-a-friend form. Their email address is ".$email."

The people they have recommended are:

".$friendmail1."
".$friendmail2."
".$friendmail3."

";
# Send the email to you
@mail("$emailto", $esubject, $emailtext, "From: $email");

## This section sends to the recipients
// Target page after successful submission
$thankyoupage = "http://yoursite.com/forum/index.php?action=thankyou";

// Change the subject text below to suit
$tsubject = "Come join me at the your Forum";

// Change the text below for the email
$ttext = "
Hi,

A friend yours, ".$name.", whose email address is ".$email." thought you may like to visit our forum!! ".$name." has used our Tell-a-Friend form to send you this

email.

http://yoursite.com/forum/

";
# This sends the email to the addresses entered
@mail("$friendmail1,$friendmail2,$friendmail3", $tsubject, $ttext, "FROM: $email");

# After submission, the target URL
header("Location: $thankyoupage");
exit;
?>


Just be sure to change any image, url and information to your own.
Title: Re: Tell A Friend Block
Post by: rebelrose on August 29, 2006, 07:49:44 PM
We work on all kind of modification on our Tiny Portals, I love Tiny Portal
Title: Re: Tell A Friend Block
Post by: RoarinRow on August 29, 2006, 08:05:01 PM
Quote from: RebelRose on August 29, 2006, 07:49:44 PM
We work on all kind of modification on our Tiny Portals, I love Tiny Portal

Very cool, thanks!
Title: Re: Tell A Friend Block
Post by: rebelrose on August 29, 2006, 08:06:53 PM
your welcome
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 04:15:39 AM
Question, I installed the custom action mod, but do not see this in the admin area, what should I be looking for?

To create the 2 pages for this snippet.

Cheers,
GB
Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 04:18:22 AM
Quote from: Greenbug on August 31, 2006, 04:15:39 AM
Question, I installed the custom action mod, but do not see this in the admin area, what should I be looking for?

I don't understand what you mean by what you should be looking for?
If you mean the area to do custom mods then look in the control panel under features and options and you will see custom actions.
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 04:38:07 AM
I gotcha, thanks.

I wasnt sure where I should be looking.

GB
Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 04:42:55 AM
Glad to help, let me know if you need more help.
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 04:59:46 AM
Well Im not sure why but its loads so slowly since I did this, any ideas why?

It will load though but it takes 30 secs to load front page.

And of course as soon as I say something it works fine.

Thanks your thought process has fixed my site. WOW incredible.

GB

http://www.americasforum.org/index.php
Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 05:02:18 AM
how about a link for a look see
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 05:14:56 AM
I spoke to soon, I have checked the code and I do not see www.yoursite.com?action=thankyou anywhere but I end up on yoursite.com none the less

When would this be on the closing post statement?


again I found it,

"come join me at the smurf talk forum" LMAO!!!
Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 05:18:45 AM
Did you create the thank you page?

Yes check the code really well and make sure you put all your site information in.
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 05:21:54 AM
So if I use the theme chooser option then I will need to do this to every theme I have, right?

Hmm looks like maybe 2 themes for my site.
Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 05:23:06 AM
This is a Tiny Portal add on Block, It should be fine when you change themes as should all the other TP Blocks
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 05:31:22 AM
The reason I ask is I remember seeing the action="http://www.americasforum.org/**Themes/amber/**tellafriend.php" method="post"

I removed the Theme/amber and put theÃ,  tellafriend.php in the root?

Ahhh it doesnt matter the file will still be in that directory regardless of the theme its currently in.

Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 05:35:37 AM
All I did was exactly what I posted and it works great.


I did visit your site and choose different themes and it still showed up as I knew it would. But just to let you know.
Title: Re: Tell A Friend Block
Post by: Greenbug on August 31, 2006, 05:38:04 AM
I dont really understand completely what I am doing and was confused about the path being wrong because I had used the Themes/themname/tellafriend.php but even if I was in another them that link would be correct since that file is really there. That had me going there for a minute.

I chenged what I needed to and it also works great for me,

Thanks!

GB
Title: Re: Tell A Friend Block
Post by: rebelrose on August 31, 2006, 05:39:38 AM
lol, glad you got it figured out. The link will work with whatever theme you have on there.
Title: Re: Tell A Friend Block
Post by: Lord Anubis on February 08, 2007, 12:28:01 AM
Nice work...Works perfectly! 

Thank You
Title: Re: Tell A Friend Block
Post by: snoopy_inc on September 11, 2007, 05:39:58 PM
hrm... isnt there a easier way of doing this... :/ im  a noob at code :/
Title: Re: Tell A Friend Block
Post by: DOOM666 on March 02, 2008, 10:28:10 AM
ok i have it set up but its not working when i send a email to some one they never get it.

but i do but this this is all i get
Quotehas used the tell-a-friend form. Their email address is

The people they have recommended are:
Title: Re: Tell A Friend Block
Post by: IchBin on March 02, 2008, 02:23:52 PM
Did you change all the information in the code to point to your site? For example:

<form name="tellafriend" action="http://www.yoursite.com/forum/Themes/yourtheme/tellafriend.php" method="post"
Title: Re: Tell A Friend Block
Post by: DOOM666 on March 04, 2008, 04:45:26 AM
yes i did all that.

but i did find out that I'm getting a mailer demon on my sever say that there was a email address add even tho there was.
Title: Re: Tell A Friend Block
Post by: kasstro on March 09, 2008, 03:21:47 AM
greetings,

it looks really nice, but i can't make it work on my site; it doesn't send the message.

but it shows the thankyoupage and sends me an email as an administrator (a copy of the message) but it's empty '(unknown sender)'.

thank you in advance.

Quote from: ©RebelRose on August 29, 2006, 07:11:25 PM
I have a Tell A Friend Block, that send up to three email, to tell a friend about your site. If anyone is intered in the code. You have to have custom mod installed for this to work. A member on my forum showed this to me.

You can see it work here Forum (http://www.rebelrosenetworks.com/forum/index.php)
Title: Re: Tell A Friend Block
Post by: Jakki on June 16, 2008, 05:08:04 PM
I know this is an old topic but I seem to be having the same problem, I went through everything line by line to no avail.
I get the E-mail saying it was used, but the people I sent it to does not receive the e-mail.
I get this in the E-mail.

"has used the tell-a-friend form. Their email address is

The people they have recommended are:"


Any ideas?
Title: Re: Tell A Friend Block
Post by: pass25 on July 04, 2008, 12:44:00 AM
Hi,
Can anyone help me?
Hi have made all the steps in the first post, but give me an error:

QuoteWarning: Cannot modify header information - headers already sent by (output started at /home/techtuga/public_html/forum/tellafriend.php:1) in /home/techtuga/public_html/forum/tellafriend.php on line 67

Thank´s
Title: Re: Tell A Friend Block
Post by: pass25 on July 07, 2008, 01:09:16 AM
I tink that the error it´s a conflict whith the  thank you mod.
Because the last html page, call the function thankyou.
Title: Re: Tell A Friend Block
Post by: Final60 on August 03, 2008, 03:21:08 AM
Heya Im pretty sure ive entered all information required, everything works included the confirmation email to myself when someone sends an invitation, the only problem is that no invitation seems to get sent!

If someone could take the time to look at the following do double check for me, would appreciate that alot!


Quote<?PHP

// This following statement must be left intact.
// Taming The Beast Tell-A-Friend script V 1.2
// Taming the Beast.net - http://www.tamingthebeast.net
// Free Web Marketing and Ecommerce Resources
// By using this code you agree to indemnify
// Taming the Beast from from any liability that might arise
// from it's use.
// This following statement must be left intact.

# This section removes any nasty tags that the user may
# have input into any of the form fields

strip_tags($friendmail1);
strip_tags($friendmail2);
strip_tags($friendmail3);
strip_tags($email);
strip_tags($name);


# This section sends you a notification email when
# the form is used

// Your email address (for copies to be sent to you)
$emailto = "mail.final@virgin.net";

// Your email subject text
$esubject = "a page has been sent";

// The email text for copies sent to you
$emailtext = "
".$name." has used the tell-a-friend form. Their email address is ".$email."

The people they have recommended are:

".$friendmail1."
".$friendmail2."
".$friendmail3."

";
# Send the email to you
@mail("$emailto", $esubject, $emailtext, "From: $email");

## This section sends to the recipients
// Target page after successful submission
$thankyoupage = "http://www.dcpryzom.co.uk/forum/index.php?action=Thank%20You";

// Change the subject text below to suit
$tsubject = "Invitation to join DCP!!!";

// Change the text below for the email
$ttext = "
Hi,

A friend of yours, ".$name.", whose email address is ".$email." thought you may like to visit our forum!! ".$name." has used our Tell-a-Friend form to send you this

email.

Join us in Ryzom, World of Warcraft and many other games on multiple platforms.

Visit our site for more info.

www.dcpryzom.co.uk/forum";

# This sends the email to the addresses entered
@mail("$friendmail1,$friendmail2,$friendmail3", $tsubject, $ttext, "FROM: $email");

# After submission, the target URL
header("Location: $thankyoupage");
exit;
?>



Tell a friend page:
Quote<title>tell a friend</title>
<script language="javascript">
<!--

function reset() {
document.tellafriend.name.value="";
document.tellafriend.email.value="";
document.tellafriend.friendmail1.value="";
document.tellafriend.friendmail2.value="";
document.tellafriend.friendmail3.value="";
}

function validate() {


if (document.tellafriend.friendmail1.value.length==0) {
alert("please enter your friend's email address");
return false;
}

if (document.tellafriend.email.value.length==0) {
alert("please enter your email address");
return false;
}
if (document.tellafriend.name.value.length==0) {
alert("please enter your name");
return false;
}

document.tellafriend.submit()
return true;
}

//-->
</script>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="500" cellpadding="0" cellspacing="0" align="center">
  <tr valign="top">
    <td valign="middle" align="center"><img

src="http://www.finalonline.co.uk/mypics/ryzom/recruit.gif" width="468" height="85"></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center"> <p><font color="#666666" size="4" face="Arial">Complete
        the details below to send our link to your friends.</font></p>
      <form name="tellafriend"

action="http://www.dcpryzom.co.uk/forum/Themes/df_tp/tellafriend.php" method="post"

onsubmit="return checkfields()">
        <div align="center">
          <center>
            <table width="500" border="0" cellpadding="10" cellspacing="0">
              <tr>
                <td><font color="#666666" size="2" face="Arial"> *your
                  name:</font>
</td>
                <td> <font color="#666666" size="2" face="Arial">
                  <input size="30" name="name" maxlength="45">
                  </font>
</td>
              </tr>
              <tr>
                <td><font color="#666666" size="2" face="Arial">*your
                  email:</font>
</td>
                <td> <font color="#666666" size="2" face="Arial">
                  <input size="30" name="email" maxlength="45">
                  </font>
</td>
              </tr>
              <tr>
                <td colspan="2"> <p align="center"><font color="#666666"><font size="2"

face="Arial">please
                    enter your friend's email addresses:</font>
</font></td>
              </tr>
              <tr>
                <td><font color="#666666" size="2" face="Arial">*email
                  1:</font>
</td>
                <td> <font color="#666666" size="2" face="Arial">
                  <input size="30" name="friendmail1" maxlength="45">
                  </font>
</td>
              </tr>
              <tr>
                <td><font color="#666666" size="2" face="Arial">email
                  2:</font>
</td>
                <td> <font color="#666666" size="2" face="Arial">
                  <input size="30" name="friendmail2" maxlength="45">
                  </font>
</td>
              </tr>
              <tr>
                <td><font color="#666666" size="2" face="Arial">email
                  3:</font>
</td>
                <td> <font color="#666666" size="2" face="Arial">
                  <input size="30" name="friendmail3" maxlength="45">
                  </font>
</td>
              </tr>
              <tr>
                <td colspan="2"> <p align="center"><font color="#666666"><font size="2"

face="Arial">
                    The email that will be sent will contain your name and email
                    address.

                    <input onclick="validate();" type="button" value="click here to send">
                    </font>
</font></td>
              </tr>
            </table>
          </center>
        </div>
      </form></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center">&nbsp; </td>
  </tr>
</table>
</body>
</html>

Thank you page

Quote<html>
<head>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="500" cellpadding="0" cellspacing="0" align="center">
  <tr valign="top">
    <td valign="middle" align="center">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center"><img src="http://www.finalonline.co.uk/mypics/ryzom/thankyou.gif" width="250"

height="250"></td>
  </tr>
  <tr valign="top">
    <td valign="middle" align="center">&nbsp; </td>
  </tr>
</table>
</body>
</html>
Title: Re: Tell A Friend Block
Post by: Lafemme on October 17, 2008, 11:58:38 PM
Hi, i have the same problem as whocares.. I do receive an mail that someone has recoomended the site.. but in not in detail.. i get the same message :

"has used the tell-a-friend form. Their email address is

The people they have recommended are:"

also i have send a test e-mail.. i do not seem to receive the recommendation.

does anybody know what could be wrong?
Title: Re: Tell A Friend Block
Post by: IchBin on October 18, 2008, 12:51:08 AM
I would check with your host to see if they have disabled the PHP mail function.
Title: Re: Tell A Friend Block
Post by: Lafemme on October 18, 2008, 02:42:22 PM
oke.. i run my own server.. :D how should i check this?
Title: Re: Tell A Friend Block
Post by: IchBin on October 18, 2008, 05:07:04 PM
Look at your PHP configuration and see. This isn't a PHP server site. You should be able to find everything you need with a google search. You can start with this page that might help you.
www.php.net/phpinfo

Otherwise, you need to look in your php.ini file.
Title: Re: Tell A Friend Block
Post by: Lafemme on October 18, 2008, 06:02:19 PM
oke.. thank you :) i will do that
Title: Re: Tell A Friend Block
Post by: Lafemme on October 20, 2008, 11:58:00 AM
hi... the hosting company who i rent the connection from has checked every setting and made php test mails.  Al these settings seme to be correct, so in there eyes it has to do something with the script
Title: Re: Tell A Friend Block
Post by: IchBin on October 20, 2008, 10:58:12 PM
Take the @ sign off of this line and see if it gives you any error when submitting the form again.
@mail("$friendmail1,$friendmail2,$friendmail3", $tsubject, $ttext, "FROM: $email");
Title: Re: Tell A Friend Block
Post by: Lafemme on October 21, 2008, 02:42:36 PM
nope.. did not work :(
Title: Re: Tell A Friend Block
Post by: IchBin on October 22, 2008, 03:04:27 AM
Looks like you'll have to skip using this scrip then.
Title: Re: Tell A Friend Block
Post by: Lafemme on October 23, 2008, 10:51:28 AM
yes.. i guess so.. thank you for helping out though :D
Title: Re: Tell A Friend Block
Post by: Lafemme on November 26, 2008, 03:24:03 PM
hello... A friend helpt me with this problem, since i really wanted this feature.... he told me to do this:

Find:

strip_tags($friendmail1);

Replace:

if (!empty($_POST['friendmail1']))
$friendmail1 = $_POST['friendmail1'];

if (!empty($_POST['friendmail2']))
$friendmail2 = $_POST['friendmail2'];

if (!empty($_POST['friendmail3']))
$friendmail3 = $_POST['friendmail3'];

if (!empty($_POST['email']))
$email = $_POST['email'];

if (!empty($_POST['name']))
$name = $_POST['name'];

strip_tags($friendmail1);


and it works like a charm!!

So.. thanks Sinan!
Title: Re: Tell A Friend Block
Post by: Polymath on January 12, 2009, 06:41:59 AM
Nice Lafemme.
Bit late but it now works for me. Thanks
Title: Re: Tell A Friend Block
Post by: Lafemme on January 12, 2009, 10:39:52 AM
Your welcome :) 

... but...  better late then never ;)
Title: Re: Tell A Friend Block
Post by: Polymath on June 04, 2009, 08:30:07 AM
Old thread I know, but all information is here.

More out of curiosity as mine is being used for spam. The name is a title, the from email is the one it is going to..and the friends emails are the same.

Example:
Quotebuy dirt cheap airline tickets has used the tell-a-friend form. Their email address is ewrwrw-3323@gmail.com

The people they have recommended are:

ewrwrw-3323@gmail.com
ewrwrw-3323@gmail.com
ewrwrw-3323@gmail.com


So what I want to know is there any security for it or is that it... remove?
Title: Re: Tell A Friend Block
Post by: JPDeni on June 04, 2009, 12:58:09 PM
With this code, it looks like the only thing you could do is make the pages viewable only by members, which would probably help.
Title: Re: Tell A Friend Block
Post by: Polymath on June 05, 2009, 01:01:05 AM
Ahh right..yeah thank you. I had to do that with my contact page a long time ago.

Cheers