149 lines
4.3 KiB
PHP
149 lines
4.3 KiB
PHP
<?php
|
|
ini_set('display_errors', 0); // disable error display
|
|
ini_set('log_errors', 0); // disable error logging
|
|
require("../functions.php");
|
|
// Define variables for file names
|
|
$pdf_name = "RTG-SAGESTREAM-LETTER-for-FREEZE-REQUEST-1_FORMAT.pdf";
|
|
$html_format_name = "RTG-SAGESTREAM-LETTER-for-FREEZE-REQUEST-1_FORMAT.html";
|
|
|
|
//collect required POST form's input
|
|
/* $affiant = $_POST["affiant"];
|
|
$month = $_POST["month"];
|
|
$day = $_POST["day"];
|
|
$year = $_POST["year"];
|
|
$time = $_POST["time"];
|
|
$addressee = nl2br($_POST["addressee"]);
|
|
$tracking_number = $_POST["tracking_number"];//getPersonalTrackingNumber(); */
|
|
$first_name = $_POST["first_name"];
|
|
$last_name = $_POST["last_name"];
|
|
$street_no = $_POST["street_no"];
|
|
$street_name = $_POST["street_name"];
|
|
$city = $_POST["city"];
|
|
$state = $_POST["state"];
|
|
$current_ssn = $_POST["current_ssn"];
|
|
$current_dob = $_POST["current_dob"];
|
|
$country = $_POST["country"];
|
|
//$appeared_text = $_POST["appeared_text"];
|
|
$signature_affiant = $_POST["signature_affiant"];
|
|
//$commission_expires = $_POST["commission_expires"];
|
|
//$credit_bureau_name_address = nl2br($_POST["credit_bureau_name_address"]);
|
|
//$sincerely = $_POST["sincerely"];
|
|
|
|
// the unique pdf filename which will be saved on server
|
|
$file_name = mt_rand(0, 1000).time().'_'.$pdf_name;
|
|
|
|
if(isset($first_name)){
|
|
|
|
//get html content from pre defined format
|
|
$today = date("d M, Y");
|
|
$html = file_get_contents($html_format_name);
|
|
if(empty($_POST['clientId'])){
|
|
$varList = array(
|
|
'__FIRST_NAME__','__LAST_NAME__','__STREET_NO__','__STREET_NAME__',
|
|
'__CITY__','__STATE__','__TODAY__',
|
|
'__CURRENT_SSN__', '__CURRENT_DOB__', '__COUNTRY__',
|
|
'__SIGNATURE_AFFIANT__',
|
|
);
|
|
$valueList = array(
|
|
$first_name,$last_name,$street_no,$street_name,
|
|
$city,$state,$today,
|
|
$current_ssn, $current_dob, $country,
|
|
$signature_affiant,
|
|
);
|
|
|
|
|
|
|
|
}
|
|
include("../common_image_file.php");
|
|
if(empty($_POST['clientId'])){
|
|
$k=0;
|
|
|
|
for($i=1;$i<= 5;$i++){
|
|
if(isset($_FILES["image".$i]["name"]) && !empty($_FILES["image".$i]["name"])){
|
|
$k++;
|
|
if($k > 2){
|
|
$from = strpos($html, "__STARTM".$i."__");
|
|
$to = strpos($html, "__ENDM".$i."__");
|
|
|
|
$html = str_replace(substr($html,$from,($to-$from)+8+strlen($i)),"",$html);
|
|
continue;
|
|
}
|
|
|
|
$imagefilename[$i] = mt_rand(0, 1000).time().'_'.$_FILES["image".$i]["name"];
|
|
upload_media($imagefilename[$i],$_POST['image'.$i]);
|
|
$deletionArray[] = $imagefilename[$i];
|
|
|
|
|
|
|
|
$varList[] = "__image".$i."__";
|
|
$valueList[] = $imagefilename[$i];
|
|
|
|
$start = "__STARTM".$i."__";
|
|
$end = "__ENDM".$i."__";
|
|
|
|
$html = str_replace(array($start,$end),array("",""),$html);
|
|
|
|
// $serialLineHTML = $serialLineHTML.$fileNameArray[$i-1]."<br/>";
|
|
|
|
|
|
} else {
|
|
|
|
$from = strpos($html, "__STARTM".$i."__");
|
|
$to = strpos($html, "__ENDM".$i."__");
|
|
|
|
$html = str_replace(substr($html,$from,($to-$from)+8+strlen($i)),"",$html);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if(empty($_POST['clientId'])){
|
|
$kk=0;
|
|
|
|
for($i=1;$i<= 5;$i++){
|
|
if(isset($_FILES["image".$i]["name"]) && !empty($_FILES["image".$i]["name"])){
|
|
$kk++;
|
|
if($kk > 2){
|
|
$from = strpos($html, "__STARTL".$i."__");
|
|
$to = strpos($html, "__ENDL".$i."__");
|
|
|
|
$html = str_replace(substr($html,$from,($to-$from)+8+strlen($i)),"",$html);
|
|
continue;
|
|
}
|
|
|
|
/* $imagefilename[$i] = mt_rand(0, 1000).time().'_'.$_FILES["image".$i]["name"];
|
|
move_uploaded_file($_FILES["image".$i]["tmp_name"], $imagefilename[$i]);
|
|
$deletionArray[] = $imagefilename[$i]; */
|
|
|
|
|
|
|
|
/* $varList[] = "__image".$i."__";
|
|
$valueList[] = $imagefilename[$i]; */
|
|
|
|
$start = "__STARTL".$i."__";
|
|
$end = "__ENDL".$i."__";
|
|
|
|
$html = str_replace(array($start,$end),array("",""),$html);
|
|
|
|
// $serialLineHTML = $serialLineHTML.$fileNameArray[$i-1]."<br/>";
|
|
|
|
|
|
} else {
|
|
|
|
$from = strpos($html, "__STARTL".$i."__");
|
|
$to = strpos($html, "__ENDL".$i."__");
|
|
|
|
$html = str_replace(substr($html,$from,($to-$from)+8+strlen($i)),"",$html);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
require("../common_file.php");
|
|
|
|
} else {
|
|
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."RTG-SAGESTREAM-LETTER-for-FREEZE-REQUEST-1.html";
|
|
header("Location:".$url);
|
|
}
|
|
|
|
?>
|