I
think I'm making progress here.
The original opening tag was < ? p and I couldn't find a closing tag so I changed the opening one to [ php ] and added the closing tag [ / php ]. (Without the spaces)
I tried the form. I received a page with a black background (not my design) and a link to CoffeeCup; that's it. No parsing error but no thank you page either.
It did send email to both the subscriber (me at another email address) and to me as the admin. However, it did not enter the data into the database.
This is the code from the beginning to where it joins the previous post.
/* Constants */
/* Version */ $version = '2.5';
/* Date */ $date = '1/22/06';
/* Error Level */ error_reporting(E_ALL & ~E_NOTICE);
$user="username"; (use actual username and password in file)
$password="password";
$database="twoedged_sope1";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";
mysql_query($query);
mysql_close();
mysql_connect(localhost,$username,$password);
mysql_close();
@mysql_select_db($database) or die( "Unable to select database");
mysql_query($query);
$NAME=$_POST['NAME'];
$EMAIL=$_POST['EMAIL'];
$HTML=$_POST['HTML'];
$TEXT=$_POST['TEXT'];
$query = "INSERT INTO MY_NEWSLETTER VALUES ('','$NAME','$EMAIL','$HTML','$TEXT',')";
mysql_query($query);
mysql_close();
//...... Added UTF-8 support
//Config file must be in the same directory as this file
//and have the same first part of the name. i.e. myform.inc.php
list($formName,$ext) = split('\.',basename($_SERVER['PHP_SELF']),2);
if (file_exists($formName.".inc.php"))
{
include($formName.".inc.php");
}
//XML file must be in the same directory as this file
$debug = (isset($_REQUEST['debug'])) ? $_REQUEST['debug'] : $debug;
if ($debug) error_reporting(E_ALL);
//...... Display debugging information
if ($debug)
{
switch($debug)
{
case 'info' :
phpinfo();
exit();
break;
case 'version' :
err("Current MailForm version: <b>".$version."</b><br>Current PHP version: <b>".phpversion()."</b><br> Current Revision Date: <b>$date</b>");
break;
}
}
$date=date("l, F dS, Y \a\\t g:i a");
$server=$_SERVER['SERVER_NAME'];
$msg="Here is the information submitted to $formName from $_SERVER[REMOTE_ADDR] on $date\r\n\r\n------------------------\r\n";
//...... Make sure we keep the variables
$subject = $_REQUEST['subject'];
$thankyoupage = $_REQUEST['thankyoupage'];
$xmlFile = $_REQUEST['xmlfile'];
$unreg = $_REQUEST['uR'];
$email = $_REQUEST['eM'];
if (file_exists($xmlFile))
{
$fd = fopen(basename($xmlFile),'r');
while(!feof($fd))
{
$contents .= fgets($fd,1024);
}
fclose($fd);
}
else
{
err("No <xml> data file found<br>Please upload the data xml file ".$_REQUEST['xmlfile']);
}
$file_info = preg_replace("/\r|\n/"," ",$contents);
//...... Includes the form results in your thank you page
$incresults = (preg_match('/<form.*?includeresults="true".*?>/',$file_info));
//...... Sends email of form results to the user
$emailusr = (preg_match('/<form.*?emailuser="true".*?>/',$file_info));
preg_match('/<hidden.*?name="mailto".*?value="(.*?)".*?>/',$file_info,$matches);
$mailto = $matches[1];
preg_match('/<hidden.*?name="thankyoumessage".*?value="(.*?)".* ?>/',$file_info,$matches2);
$thanksMsg = unhtmlentities($matches2[1]);
preg_match('/<form.*?bkcolor2="(.*?)".*?>/',$file_info,$matches3);
$backgroundclr = $matches3[1];
preg_match('/<form.*?fontcolor2="(.*?)".*?>/',$file_info,$matches4);
$fontclr = $matches4[1];
preg_match('/<form.*?autoresponse="(.*?)".*?>/',$file_info,$matches5);
$autoresponse = $matches5[1];
if(!$thanksMsg)
{
$thanksMsg="Thank you for your form submission!";
}
if(!$subject)
{
$subject="Form Submission";
}
//...... Reversing array elements so they appear in correct form order
$_REQVARS = array_merge($_POST,$_GET);
//...... Delete them from the request array, we won't need
//...... to send these in the actual email.
unset($_REQVARS['thankyoupage']);
unset($_REQVARS['subject']);
unset($_REQVARS['mailto']);
unset($_REQVARS['xmlfile']);
unset($_REQVARS['thankyoumessage']);
unset($_REQVARS['uR']);
unset($_REQVARS['eM']);
$addtoThank.="<span><p align=\"center\">Below is the information you submitted:</br></br></p><p align=\"center\">";
$txtmsg=$formName.'|'.date("Y-m-d H:i:s").'|'.$_SERVER['REMOTE_ADDR'].'|';
$_REQVARS=array_reverse($_REQVARS);
foreach($_REQVARS as $key=>$value)
{
$new1=str_replace("_"," ",$key);
$msg .= "$new1: ".stripslashes($value)."\r\n\r\n";
$addtoThank.="$new1: ".stripslashes($value)."<br/>";
$txtmsg .= "$new1: ".stripslashes($value)."|";
}
$addtoThank.="</p></span>";
$addtoThank=str_replace("_"," ",$addtoThank);
}
if($unreg == 'true')
Thanks.