PDA

View Full Version : I need help re directing this script



bjict
07-01-2005, 10:07 AM
What am I doing wrong I need to redirect this script to pointfortin.com

<HTML>
<HEAD>
<TITLE>Tell Friend v1.1 - Powered by: (http://www.phpscriptcenter.com/tellfriend.php)</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<!--

Powered by: Tell Friend Version 1.1 (http://www.phpscriptcenter.com/tellfriend.php)

-->
<?php

///////////////////////////////////////////////
// //
// Tell Friend v 1.1 //
// ----------------------------------------- //
// by Graeme (webmaster@phpscriptcenter.com) //
// http://www.phpscriptcenter.com //
// //////////////////////////////
// PHP Script CENTER offers no warranties on this script. //
// The owner/licensee of the script is solely responsible for any //
// problems caused by installation of the script or use of the script //
// //
// All copyright notices regarding Tell Friend, must remain //
// intact on the scripts and in the HTML for the scripts. //
// //
// (c) Copyright 2001 PHP Script CENTER //
// //
// For more info on Tell Friend, //
// see http://www.phpscriptcenter.com/tellfriend.php //
// //
///////////////////////////////////////////////////////////////////////////


// number of friend feilds to put on the page
$tellnumber = "4";

// subject of email
$subject = "I just found a cool site";

// Message sent in the email
$message = "Checkout this cool site i found http://pointfortin.com/series1-5.html";

// url to redirect user to once they click submit
$thankyouurl = "http://www.pointfortin.com/thankyou.html";




//////////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE //
//////////////////////////////////////////////////////////////////////////////////


if($submitform) {

$num=0;
while($num < $tellnumber) {
$num++;
$temail = "femail"."$num";
$tname = "fname"."$num";

if($$tname OR $$temail) {
if(!$$tname) {
$error .= "Missing Friends Name, Friend $num<BR>";
}
if(!$$temail) {
$error .= "Missing Friends Email, Friend $num<BR>";
}

}
if($$temail) {
if(!ereg("@",$$temail)) { $error .= "Invalid Email Address, Friend $num<BR>"; }
if(!ereg("\.",$$temail)) { $error .= "Invalid Email Address, Friend $num<BR>"; }
}
}
if(!$tname) {
$error .= "Missing your name<BR>";
}
if(!ereg("@",$email)) { $error .= "Invalid Email Address<BR>"; }
if(!ereg("\.",$email)) { $error .= "Invalid Email Address<BR>"; }

if($error) {
?>
<P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080">
<TABLE WIDTH="394" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD WIDTH="26%" BGCOLOR="#004080">
<B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Error</FONT></B></TD>
</TR>
<TR>
<TD WIDTH="26%" BGCOLOR="#ffffff">
<FONT COLOR="#000000" SIZE="-1" FACE="Verdana"><?php echo $error; ?></FONT></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER>
<P><CENTER>&nbsp;</CENTER></P>
<P><CENTER><FONT SIZE="-2" FACE="Verdana"><B>Powered by:</B> <A HREF="http://www.phpscriptcenter.com/tellfriend.php">Tell Friend</A> Version 1.1</FONT></CENTER></P>
</BODY></HTML>
<?php
exit();
}


$num=0;
while($num < $tellnumber) {
$num++;
$temail = "femail"."$num";
$tname = "fname"."$num";
$then = $$tname;
if($$temail AND $$tname) {
mail($$temail,"$subject","
Hi, $then

$message

From
$name

---------------------
Powerd by Tell Friend v1.1 (http://www.phpscriptcenter.com/tellfriend.php)

","From: $name <$email>");
}

}

header("Location: $thankyouurl");
exit();

} else {

$num=0;
while($num < $tellnumber) {
$num++;
$theboxes .= " <TR>
<TD WIDTH=\"49%\" BGCOLOR=\"#ffffff\">
<P><CENTER><B><FONT COLOR=\"#000000\" SIZE=\"-1\" FACE=\"Verdana\">$num</FONT></B></CENTER></TD>
<TD WIDTH=\"26%\" BGCOLOR=\"#ffffff\">
<P><CENTER><INPUT NAME=\"fname$num\" TYPE=\"text\" SIZE=\"25\"></CENTER></TD>
<TD WIDTH=\"25%\" BGCOLOR=\"#ffffff\">
<INPUT NAME=\"femail$num\" TYPE=\"text\" SIZE=\"25\">
</TD>
</TR>";
}


?>
<P><CENTER><FONT FACE="Verdana"><B>Tell your friend about our site</B></FONT></CENTER></P>
<FORM ACTION="tellfriend.php" METHOD="POST"><P><CENTER><TABLE BORDER="0" CELLSPACING="0"
CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080">
<TABLE WIDTH="394" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD WIDTH="26%" BGCOLOR="#004080">
<P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Your Name</FONT></B></CENTER></TD>
<TD WIDTH="25%">
<P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Your Email</FONT></B></CENTER></TD>
</TR>
<TR>
<TD WIDTH="26%" BGCOLOR="#ffffff">
<P><CENTER><INPUT NAME="name" TYPE="text" SIZE="25"></CENTER></TD>
<TD WIDTH="25%" BGCOLOR="#ffffff">
<INPUT NAME="email" TYPE="text" SIZE="25">
</TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER></P><P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080">
<TABLE WIDTH="394" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD WIDTH="49%" BGCOLOR="#004080"></TD>
<TD WIDTH="26%" BGCOLOR="#004080">
<P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Friends name</FONT></B></CENTER></TD>
<TD WIDTH="25%">
<P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Friends email</FONT></B></CENTER></TD>
</TR><?php echo $theboxes; ?></TABLE></TD>
</TR>
</TABLE></CENTER></P>
<P><CENTER><INPUT NAME="submitform" TYPE="submit" VALUE="Submit"></CENTER></FORM>
<P><CENTER>&nbsp;</CENTER></P>
<P><CENTER><FONT SIZE="-2" FACE="Verdana"><B>Powered by:</B> <A HREF="http://www.pointfortin.com">Pointman</A> Version 1.1</FONT></CENTER></P>
</BODY></HTML>
<?php
exit();

}

?>

Twey
07-02-2005, 11:18 AM
This should be in the PHP forum.

Change:

<HTML>
<HEAD>
<TITLE>Tell Friend v1.1 - Powered by: (http://www.phpscriptcenter.com/tellfriend.php)</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<!--

Powered by: Tell Friend Version 1.1 (http://www.phpscriptcenter.com/tellfriend.php)

-->
<?php

To:


<?php if(!$submitform) { ?>
<HTML>
<HEAD>
<TITLE>Tell Friend v1.1 - Powered by: (http://www.phpscriptcenter.com/tellfriend.php)</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<!--

Powered by: Tell Friend Version 1.1 (http://www.phpscriptcenter.com/tellfriend.php)

-->
<?php
}

That will get rid of the "headers already sent by..." message. I presume this is what was bugging you?

The problem is that the script tried to change the HTTP headers after HTML was sent to the browser. The server sends a page like so:
headers seperated by a single linebreak two linebreaks requested content
Obviously, it is impossible to modify the headers after content has already been sent, which was what the script was trying to do. The above modification checks to see if the headers are going to be altered, and if so, doesn't send the content at the top.