Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

169 lines (123 sloc) 5.884 kb
* The template for displaying all pages.
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
* Template Name: Process
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
//$siteRoot = "";
//Auto prepend database configuration file
//$connect=mysql_connect("localhost","secondwind","xs4D3NN}d8Ih2gZH]ETqSoJ8i") or header("Location: /database_down.php");
$connect=mysql_connect("localhost","exerciseuiop34","opt123ewq6y") ;
$link = $connect;
if(isset($_POST) && is_array($_POST) && count($_POST)){
$subject='2ndwind Corporate Promo Request';
$headers="From: <>\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .="Content-type: text/html;charset:iso-8859-1\n";
$message =
"This email was automatically generated by ".$_SERVER['SERVER_NAME'].". " .
"Below are all of the fields of the submitted form. ";
$message .= "<br /><br /><table border=0>\n";
foreach($_POST as $key => $value)
* Construct the actual email message, but filter all of the user input in a way that
* mitigates phishing (strip_tags).
$message .= '<tr><td>' . strip_tags($key) . '</td><td>' . strip_tags($value) ."</td>\n";
$companyPromoId = mysql_real_escape_string($_POST['corporate_promo_id']);
$query = "SELECT name FROM `corporate_promo` WHERE id = $companyPromoId LIMIT 1";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$companyName = $row[0];
$message .= "<tr><td>Company Name</td><td>$companyName</td></tr>";
$message .= "</table>\n";
//$message= strip_tags($message) ;
// we will use this array to pass to the createFDF function
// This displays all the data that was submitted. You can
// remove this without effecting how the FDF data is generated.
//echo'<pre>POST '; print_r($_POST);echo '</pre>';
// I wanted to add the date to the submissions
// if we got here, the data should be valid,
// time to create our FDF file contents
// need the function definition
require_once 'createFDF.php';
// some variables to use
// file name will be <the current timestamp>.fdf
// the directory to write the result in
// need to know what file the data will go into
$name = mysql_escape_string($_POST["name"]);
$data['topmostSubform[0].Page1[0].EmployeeName[0]'] = $name;
$address1 = mysql_escape_string($_POST["address1"]);
$data['topmostSubform[0].Page1[0].Address[0]'] = $address1;
$address2 = mysql_escape_string($_POST["address2"]);
if($address2 != "")
$data['topmostSubform[0].Page1[0].Address[0]'] .= " ".$address2;
$city = mysql_escape_string($_POST["city"]);
$data['topmostSubform[0].Page1[0].City[0]'] = $city;
$state = mysql_escape_string($_POST["state"]);
$data['topmostSubform[0].Page1[0].State[0]'] = $state;
$zipcode = mysql_escape_string($_POST["zip"]);
$data['topmostSubform[0].Page1[0].Zipcode[0]'] = $zipcode;
$email = mysql_escape_string($_POST["email"]);
$data['topmostSubform[0].Page1[0].Email[0]'] = $email;
$workphone = mysql_escape_string($_POST["work_phone"]);
$data['topmostSubform[0].Page1[0].WorkPhone[0]'] = $workphone;
$cellphone = mysql_escape_string($_POST["cell_phone"]);
$data['topmostSubform[0].Page1[0].CellPhone[0]'] = $cellphone;
$jobtitle = mysql_escape_string($_POST["job_title"]);
$data['topmostSubform[0].Page1[0].JobTitle[0]'] = $jobtitle;
$corporatePromoId = mysql_escape_string($_POST["corporate_promo_id"]);
$data['topmostSubform[0].Page1[0].Company[0]'] = $companyName;
$uniqId = substr(md5(uniqid(rand(), true)),0,10);
$data['topmostSubform[0].Page1[0].Uniqid[0]'] = $uniqId;
// generate the file content
// this is where you'd do any custom handling of the data
// if you wanted to put it in a database, email the
// FDF data, push ti back to the user with a header() call, etc.
$query = "INSERT INTO `corporate_promo_user` (`uniqid`, `corporate_promo_id`, `name`, `address1`, `address2`, `city`, `state`, `zipcode`, `email`, `phone`, `cellphone`, `job_title`) VALUE ('$uniqId', '$corporatePromoId', '$name', '$address1', '$address2', '$city', '$state', '$zipcode', '$email', '$workphone', '$cellphone', '$jobtitle')";
//echo $query;
// Insert a row of information into the "category" table
mysql_query($query) or die(mysql_error());
// write the file out
//echo $fdf_file,' written successfully.';
die('Unable to create file: '.$fdf_dir.'/'.$fdf_file);
header( 'Content-type: application/pdf' );
header( 'Content-disposition: attachment; '.'filename=2ndwindpromo.pdf' );
passthru( 'pdftk rebateform4.pdf fill_form '. $fdf_dir.'/'.$fdf_file.
' output - flatten' );
unlink( $fdf_dir.'/'.$fdf_file ); // delete temp file
// header('Location: /corporatewellness/thankyou.php');
echo 'You did not submit a form.';
Jump to Line
Something went wrong with that request. Please try again.