TinyPortal

Development => Block Codes => Topic started by: akulion on April 12, 2007, 05:49:51 AM

Title: Invite A Friend Block [side block]
Post by: akulion on April 12, 2007, 05:49:51 AM
Demo: http://path-to-peace.com/forum2/

How To:

1 - Download image and php file attached

2 - Open php file and alter these lines:

<META HTTP-EQUIV=REFRESH CONTENT="6;URL=http://path-to-peace.com/community">

Replace the address with your homepage (this is where the redirect takes place after sending the email) - Also the 6 is the time in seconds it takes to redirect, you can change it if you want.

Also in the same file find:

if you are not diverted in 10 seconds please <a href='http://path-to-peace.com/community/'>

Replace the address for your own

3- Place the following code in a SCRIPT SIDE BLOCK

<form method=post action=tellck.php>
      <table  border="0" cellpadding="0" cellspacing="0" align=center>
<tr bgcolor='#96C33C'><td colspan=2 align=center><font face='Verdana' size='2' ><b>TELL A FRIEND</b></font></td></tr>

<tr><td width=120><font face='Verdana' size='2' >Your Name</font></td></tr><tr><td width=120><input type=text name=y_name></td></tr>
<tr><td><font face='Verdana' size='2' >Your Email</font></td></tr><tr><td><input type=text name=y_email></td></tr>
<tr ><td><font face='Verdana' size='2' >Your Friend's Name</font></td></tr><tr><td><input type=text name=f_name></td></tr>
<tr><td><font face='Verdana' size='2' >Friend's Email</font></td></tr><tr><td><input type=text name=f_email></td></tr>
<tr ><td><font face='Verdana' size='2' >Your Message</font></td></tr><tr><td><textarea name=y_msg rows=5 cols=20></textarea></td></tr>

<tr bgcolor='#96C33C'><td colspan=2 align=center><font face='Verdana' size='2' ><input type=submit value='Send'></font></td></tr>
</table>
</form>


4 - Recommended settings for block: Use frame but not title.

5 - Upload both files (1 image and 1 php file) attached to this post to your forum root (directory where your forum is installed)

6 - Activate the block and enjoy.

Title: Re: Invite A Friend Block [side block]
Post by: akulion on April 12, 2007, 05:54:01 AM
oh i nearly forgot...

in the PHP file this line defines what message to send

$header_message = "Peace $f_name \n Your friend $y_name has sent you the following message and requested you to visit the page at \n $ref \n";

Dont touch the variables starting with the $ sign, the rest u can change
Title: Re: Invite A Friend Block [side block]
Post by: rebelrose on April 18, 2007, 12:29:53 AM
This is nice thank you  :)
Title: Re: Invite A Friend Block [side block]
Post by: madagascar on June 22, 2007, 07:49:25 AM
I already implemented this feature but why i've got this error on my page before it will show my homepage?

Thanks.

ERROR:
"; $status= "NOTOK";} if (strlen($y_name) <2 ) { // checking your name $msg .="Please enter your name
"; $status= "NOTOK";} if (!stristr($f_email,"@") OR !stristr($f_email,".")) { // checking friends email $msg .="Your Friends address is not correct
"; $status= "NOTOK";} if (strlen($f_name) <2 ) { // checking freinds name $msg .="Please enter your friend's name
"; $status= "NOTOK";} if (strlen($y_msg) <2 ) { // checking Message details $msg .="Please enter your message details
"; $status= "NOTOK";} if($status=="OK"){ // all validation passed /////////// Sending the message starts here ////////////// $ref=@$HTTP_REFERER; /////Message at the top of the page showing the url//// $header_message = "Peace $f_name \n Your friend $y_name has sent you the following message and requested you to visit the page at \n $ref \n"; /// Body message prepared with the message entered by the user //// $body_message =$header_message."\n".$y_msg."\n"; $body_message .="\n "; //// Mail posting part starts here ///////// $headers=""; //$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers; // Un comment the above line to send mail in html format $headers4=$y_email; // Change this to change from address $headers.="Reply-to: $headers4\n"; $headers .= "From: $headers4\n"; $headers .= "Errors-to: $headers4\n"; $subject="Request to visit URL"; mail($f_email,$subject,$body_message,$headers); ////// Mail posting ends here /////////// echo "

Thank You, Your message has been emailed to $f_name
"; echo "
You are being redirected back to the main page, if you are not diverted in 10 seconds please click here

Or Click the back button on your browser to return to the previous page
"; //////////// Sending the message ends here ///////////// }else{// display the error message echo "
$msg
"; } ?>
Title: Re: Invite A Friend Block [side block]
Post by: GP on July 04, 2007, 04:05:54 AM
The script is not recognizing the form inputs when I try it.  Each time I get.....


Your email address is not correct
Please enter your name
Your Friends address is not correct
Please enter your friend's name


It works like a charm on Gobo's site.  What am I overlooking?  :-\
Title: Re: Invite A Friend Block [side block]
Post by: rebelrose on July 04, 2007, 06:02:25 AM
I am not sure on this script but I use this one on my site.

http://www.tinyportal.net/index.php?topic=7888.msg64830#msg64830
Title: Re: Invite A Friend Block [side block]
Post by: GP on July 04, 2007, 10:00:21 PM
Thanks RebelRose!!!  
Title: Re: Invite A Friend Block [side block]
Post by: rebelrose on July 04, 2007, 10:01:29 PM
Quote from: GP on July 04, 2007, 10:00:21 PM
Thanks RebelRose!!!  

Your welcome, hope it does what you want.
Title: Re: Invite A Friend Block [side block]
Post by: jiminoregon on July 11, 2007, 02:00:49 AM
Quote from: GP on July 04, 2007, 04:05:54 AM
The script is not recognizing the form inputs when I try it.  Each time I get.....


Your email address is not correct
Please enter your name
Your Friends address is not correct
Please enter your friend's name


It works like a charm on Gobo's site.  What am I overlooking?  :-\


I'm getting the same result...have you come up with an answer Gobo?

Thanks,

Jim
Title: Re: Invite A Friend Block [side block]
Post by: arrisje on July 11, 2007, 11:53:44 PM
I tried this one to and did not work for me neither. My forum is using gmail. Is there a possibility to use that somewhere in this code?
Thanks for all the great help I have been getting on this board. :)
B.T.W. Here is my forum http://arrisje.110mb.com/Forum/index.php (http://arrisje.110mb.com/Forum/index.php)
Title: Re: Invite A Friend Block [side block]
Post by: jiminoregon on July 12, 2007, 05:53:03 AM
Quote from: arrisje on July 11, 2007, 11:53:44 PM
I tried this one to and did not work for me neither. My forum is using gmail. Is there a possibility to use that somewhere in this code?
Thanks for all the great help I have been getting on this board. :)
B.T.W. Here is my forum http://arrisje.110mb.com/Forum/index.php (http://arrisje.110mb.com/Forum/index.php)

Try this tellck.php...it worked for me...I put in your ip.

Jim
Title: Re: Invite A Friend Block [side block]
Post by: arrisje on July 12, 2007, 11:45:03 PM
Thanks Jim for the effort it still doesn't work. Still get that parse error ;(. Well it just have to go by word of mouth :0)
Title: Re: Invite A Friend Block [side block]
Post by: arrisje on July 13, 2007, 12:19:45 AM
Before I installed tiny portal I had invite mod installed on smf. For some odd reason the invite seem to have vanished. When I tried to uninstall it it would not let me it kept telling me errors. Anyways I downloaded it again from smf mods and reiinstalled ( mind you it did tell me that there are errors.) I figured well I am going to try it anyways. Everything or nothing lol. Installed it again and it works again. ;)
Title: Re: Invite A Friend Block [side block]
Post by: jiminoregon on July 13, 2007, 02:16:29 AM
Quote from: arrisje on July 13, 2007, 12:19:45 AM
Before I installed tiny portal I had invite mod installed on smf. For some odd reason the invite seem to have vanished. When I tried to uninstall it it would not let me it kept telling me errors. Anyways I downloaded it again from smf mods and reiinstalled ( mind you it did tell me that there are errors.) I figured well I am going to try it anyways. Everything or nothing lol. Installed it again and it works again. ;)

Cool...now check your error log...bet it's filling up with errors related to the mod...if it's the same error over and over...you might just need to chmod that file to 777...uninstall and reinstall.  Or you could just ignore them if they're not causing a problem...

Good Luck,

Jim
Title: Re: Invite A Friend Block [side block]
Post by: Polymath on June 12, 2008, 09:43:47 PM
I know this is old, But I am making another website using another script. This works/instals apart from the validating

Your email address is not correct
Please enter your name
Your Friends address is not correct
Please enter your friend's name
Please enter your message details

Anybody fix this at all?
Title: Re: Invite A Friend Block [side block]
Post by: IchBin on June 13, 2008, 12:24:48 AM
Did you look at the other script that was posted in this topic?
Title: Re: Invite A Friend Block [side block]
Post by: Polymath on June 13, 2008, 12:36:05 AM
Yep. There was nothing different in it from the first. I looked for this IP part that they added but didn't see it. Also all that was trying to fix was the page URL I think, not validating that the form was filled out.

And hello IchBin. Good to see others still here too from a long time ago.
Title: Re: Invite A Friend Block [side block]
Post by: Polymath on June 13, 2008, 05:25:59 AM
This is fixed rewrote some of it from bits and pieces from the net
Title: Re: Invite A Friend Block [side block]
Post by: darkacex on July 18, 2008, 05:24:07 PM
I tried inviting myself and it didn't work o_o
Title: Re: Invite A Friend Block [side block]
Post by: Skb on August 13, 2016, 11:21:43 AM
I used this snippet to create a Tell a Friend Block. I've managed the display & send mail. After sending the mail the thank you page appears, and redirects the member to the site index, but as logged out. However, if the "click here" link is clicked, the member is able to go back to forum index as logged in. ////// Mail posting ends here ///////////
echo "<center><font face='Verdana' size='2' ><img src='Email024.gif'><br>Thank You, Your message has been emailed to $f_name</font></center>";
echo "<br><center>You are being redirected back to the main page, if you are not diverted in 10 seconds please <a href='http://www.diabetic.pub/forum/index.php'>click here</a></center><br><center>Or Click the back button on your browser to return to the previous page</center>";
//////////// Sending the message ends here /////////////
}else{// display the error message
echo "<center><font face='Verdana' size='2' color=red>$msg</font></center>";

Anything I can do to make this work ?
Title: Re: Invite A Friend Block [side block]
Post by: Skb on August 16, 2016, 08:19:03 AM
I solved the problem, by editing the tellck.php file. For anyone else who might need the solution.
META HTTP-EQUIV=REFRESH CONTENT="6;URL=http://www.diabetic.pub/forum//index.php?
Just remove the "?" at the end of the code. I don't know how it got inserted there in the first place. It led to the user getting logged out of the forum, though being redirected to the index page.
Title: Re: Invite A Friend Block [side block]
Post by: VladTepes on March 24, 2017, 05:44:31 AM
Does this work now, and is the script attached to the OP the current / correct one?
Title: Re: Invite A Friend Block [side block]
Post by: VladTepes on March 31, 2017, 01:14:39 PM
anyone?