Solved

NOT telling a friend script

Posted on 2004-04-24
5
283 Views
Last Modified: 2006-11-17
Hi

I got this script online (http://www.tamingthebeast.net/articles3/tell-a-friend-script.htm) and it seems to work in a different form on the site but not for me in this version.

I keep getting

Parse error: parse error in /usr/home/mydomain/public_html/tellafriend.php on line 14.
If i take out line 14/15/16 for a test i get the same error lower

Here.s the php and below i've also put the .htm that calls it

I've got 70 points left at the moment - hope it's enough.


<?PHP

// Taming The Beast Tell-A-Friend script V 1.1
// 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 section removes any nasty tags that the  
# user may have entered in 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 = "simon@playmac.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 = "thankyou.htm";  

 //  Change the subject text below to suit
$tsubject = "A great site";

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

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

http://www.amazon.com

";
# 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.htm


<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="450" cellpadding="0" cellspacing="0" align="center">
     <tr valign="top">
     <td valign="middle" align="center">
     <p>Complete the details below to send our link to your friends.</p>
     <form name="tellafriend" action="tellafriend.php" method="post" onsubmit="return checkfields()">
     <div align="center">

   <center>
   <table border="0" cellpadding="10" cellspacing="0">
     <tr>
       <td> *your name:</td>
       <td>
     <input size="30" name="name" maxlength="45">
       </td>
     </tr>

     <tr>
       <td>*your email:</td>
       <td>
     <input size="30" name="email" maxlength="45">
       </td>
     </tr>
     <tr>
       <td colspan="2">

         <p align="center">please enter your friend's email addresses:</td>
     </tr>
     <tr>
       <td>*email 1:</td>
       <td>
     <input size="30" name="friendmail1" maxlength="45">
       </td>
     </tr>

     <tr>
       <td>email 2:</td>
       <td>
     <input size="30" name="friendmail2" maxlength="45">
       </td>
     </tr>
     <tr>
       <td>email 3:</td>

       <td>
     <input size="30" name="friendmail3" maxlength="45">
       </td>
     </tr>
     <tr>
       <td colspan="2">
         <p align="center">
         The email that will be sent will contain your name. <br>

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

     </td>
     </tr>
     </table>
     </body>
     </html>

Thanks for any help.
0
Comment
Question by:macuser777
  • 2
5 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10910012
this should work..


<?PHP

// Taming The Beast Tell-A-Friend script V 1.1
// 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 section removes any nasty tags that the  
# user may have entered in the form fields

$friendmail1 =$_REQUEST["friendmail1"];
$friendmail2 =$_REQUEST["friendmail2"];
$friendmail3 =$_REQUEST["friendmail3"];
$email =$_REQUEST["email"];
$name =$_REQUEST["name"];

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 = "simon@playmac.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 = "thankyou.htm";  

 //  Change the subject text below to suit
$tsubject = "A great site";

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

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

http://www.amazon.com

";
# 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;
?>


0
 
LVL 4

Author Comment

by:macuser777
ID: 10910027
Hi

I tried the code but...

I get the error at line 20 now

Parse error: parse error in /usr/home/amazonez/public_html/tellafriend.php on line 20

that's this line in my page

strip_tags($friendmail3);  
0
 
LVL 4

Author Comment

by:macuser777
ID: 10911614
Hi

I've found a much better free script that works no problem.

I'll post the link here ans apply for a delete/PAQ if that's ok

http://www.gatequest.net/products/Site_Recommender/

Thanks
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10953002
Closed, 70 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now