PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 26th, 2003, 07:00 AM
steve55 steve55 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: UK
Posts: 44 steve55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via AIM to steve55 Send a message via Yahoo to steve55
Angry PHP : Recommendation Script Question

I am using a php recommend a friend script that also places the information the user supplies into a text file.

However I am having a few minor problems and was wondering if someone could check the script for me.

The text file is populated every time, but only certain emails seem to get through and the email is also supposed to contain a url, which it doesn't...

The script is as follows:-



<?

// Change the variable below to "no" if you do not wish to write
// the data to a text log
$logging="yes";

// Enter the website administrators email address here
$adminaddress = "test@test.com";

// Enter the company name or site name here
$sitename = "Test";

// Enter the address of your website here
$siteaddress ="http://www.test.com";

?>

<html>
<head>
<title>Tell A Friend</title>



<?php
IF ($action=="") {
?>

<?
$referer = getenv("HTTP_REFERER");
print "<p><B>$referer</B><BR><BR></p>";

?>
<p>To send the URL of this page and a brief message to friends who might like it, just fill out the
form below.
<BR>

<BR><FORM METHOD=POST ACTION="<? echo "$PHP_SELF"; ?>">

<TABLE BORDER="0" CELLSPACING="3" CELLPADDING="3">
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Your Name*:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="yname"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Your Email*:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="yemail"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #1 Name*:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="fname[1]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #1 Email*:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="femail[1]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #2 Name:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="fname[2]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #2 Email:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="femail[2]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #3 Name:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="fname[3]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #3 Email:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="femail[3]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #4 Name:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="fname[4]"></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="-
1">Friend #4 Email:</FONT></TD>
<TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"
SIZE="3"><INPUT TYPE="text" NAME="femail[4]"></FONT></TD>
</TR>

<TR>
<TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans
Serif" SIZE="-1">Additional Comments:</FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans
Serif" SIZE="3"><textarea NAME="comments" rows="3"></TEXTAREA></FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans
Serif" SIZE="3"><INPUT TYPE="hidden" NAME="url" VALUE="<? echo "$referer"; ?>"><INPUT
TYPE="submit" NAME="action" VALUE="Send"></FONT></TD>
</TR>
</TABLE>

</FORM>
<BR>
<BR>
<BR>
<BR>
<BR>


<?

} ELSEIF ($action="Send") {

if (($yname=="") || ($fname=="") || ($femail=="")|| ($yemail=="")) {
print "Please use your back button and complete all of the required form fields, then resubmit.<br><br><br><br><br><br><br><br><br><br><br>";
} else {
print "Your recommendation to the following people has been sent:<br><br> ";
// cycle through the emal addresses and names
$items="5";
$tally="";
for ($numitems=0; $numitems < $items; $numitems++) {
if (($fname[$numitems]!="") && ($femail[$numitems]!="")) {
mail("$femail[$numitems]","$yname went to $sitename and recommended you check this out","$fname[$numitems] \n\n $yname stopped by $sitename and thought you would find the following URL of interest:\n \nURL: $url \n\n Additional Comments: \n------------------------------------ \n$comments \n------------------------------------\n\nThank you! \n$sitename \n$adminaddress \n$siteaddress","FROM:$yemail");


// NEW IN VERSION 1.2 - LOGGING TO A TEXT FILE - 7/31/00
// this writes the url, comments, and email address
// to a text database so you can easily track which
// pages are being recommended most often

// Be sure to upload the blank text file that the
// data will write to. In this case, we named it url-log.txt
// If you name your blank file url-log.txt, no changes are needed here.
// If you decide to use a different filename, you must change the
// variable below.

IF ($logging=="yes") {
$filename="url-log.txt";

// Nothing needs ot be changed here

$fl=fopen($filename,"a+");
// sets the pipe delimiters
fwrite($fl,"'$url'|'$femail[$numitems]'|'$yemail'|'$comments'\n");
fclose($fl);
}
$tally.="$fname[$numitems], ";
}
}

?>
<P>Your recommendation has been sent to <?php echo "$tally"; ?> </p>

<p><B><A HREF="<? echo "$url"; ?>">GO BACK</A></B> </p>
<BR>
<BR>
<?
}

}


?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP : Recommendation Script Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT