require_once( ABSPATH . 'wp-admin/includes/file.php' );
$SITE_PATH = "http://boltonblinds.co.uk/custom_blind/";
//define("SITE_PATH", "http://www.dubaiblinds.com/custom_blind/");
define("SITE_PATH", "http://boltonblinds.co.uk/custom_blind/");
mysql_connect("localhost","boltonbl_siteusr","M0\$zT3$#xs*L") or die("mysql connect123 :: ".mysql_error());
mysql_select_db("boltonbl_site") or die("mysql select db ::". mysql_error());
if(isset($_POST["sub"])){
$width =$_POST["width1"];
$height =$_POST["height1"];
$height_pixcel = (640*$height)/$width + 10;
$mount_type= $_POST["mount_type"];
$roll_style=$_POST["roll_style"];
$winder =$_POST["winder"];
$img_src = $_POST["img_src"];
$img_bacground_width = $_POST["img_bacground_width"];
$img_bacground_height = $_POST["img_bacground_height"];
$img_bacground_left = $_POST["img_bacground_left"];
$img_bacground_top =$_POST["img_bacground_top"];
$dyb_blind_fabric = $_POST["dyb_blind_fabric"];
$price = $_POST["price_hidden"];
$rotate_value = $_POST["rotate_degree"];
$rotate_matrix ="";
switch($rotate_value){
case "0deg" : $rotate_matrix = "matrix(1, 0, 0, 1, 0, 0)"; break;
case "90deg" : $rotate_matrix = "matrix(0, 1, -1, 0, 0, 0)"; break;
case "180deg" : $rotate_matrix = "matrix(-1, 0, 0, -1, 0, 0)"; break;
case "270deg" : $rotate_matrix = "matrix(0, -1, 1, 0, 0, 0)"; break;
}
if($_FILES['user_file']['name'] !="" && strpos($img_src,'default_images')==false){
$uploadedfile = $_FILES['user_file'];
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
if ( $movefile ) {
$attachedfilelink=$movefile['url'];
$img_path = $attachedfilelink;
}
else{
echo "ERROR !!!";
}
}
else
{
$img_path=$img_src;
}
$qr = "INSERT INTO order_data SET mount_type = '$mount_type',
roll_style = '$roll_style',
winder = '$winder',
hardware_colour = '$hardware_colour',
image_path = '$img_path',
img_bacground_width = '$img_bacground_width',
img_bacground_height = '$img_bacground_height',
img_bacground_left ='$img_bacground_left',
img_bacground_top = '$img_bacground_top',
canvas_width = '$width',
canvas_height ='$height',
blind_fabric = '$dyb_blind_fabric',
price = '$price' ,
rotation = '$rotate_value'
";
$res = mysql_query($qr) or die("ERROR ON INSERT ".mysql_error());
if($res){
$qr ="SELECT MAX(id) AS max_id FROM order_data LIMIT 1";
$res1 = mysql_query($qr) or die("ERROR ON SELECT ".mysql_error());
$row = mysql_fetch_array($res1);
$max_id = $row["max_id"];
}
}
else if (isset($_POST["submit"])) {
//print_r($_POST);die();
$qr = "SELECT * FROM order_data WHERE id = (SELECT max(id) from order_data WHERE 1 ) LIMIT 1";
$res = mysql_query($qr) or die("ERROR ON SELECT ".mysql_error());
$row = mysql_fetch_array($res);
$width =$row["canvas_width"];
$height =$row["canvas_height"];
$price = $row["price"];
$height_pixcel = (640*$height)/$width + 10;
$mount_type= $row["mount_type"];
$roll_style=$row["roll_style"];
$winder =$row["winder"];
$img_path = $row["image_path"];
$img_bacground_width = $row["img_bacground_width"];
$img_bacground_height = $row["img_bacground_height"];
$img_bacground_left = $row["img_bacground_left"];
$img_bacground_top =$row["img_bacground_top"];
$blind_fabric =$row["blind_fabric"];
$rotation = $row["rotation"];
$full_name = $_POST["full_name"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$addr1 = $_POST["addr1"];
$addr2 = $_POST["addr2"];
$captcha = $_POST["captcha"];
$location = $_POST["location"];
$terms = $_POST["terms"];
$max_id = $row["id"];
if(trim($full_name)==""){
echo " alert ('Please enter full name')";
}
else if(trim($phone)==""){
echo " alert ('Please enter phone number')";
}
else if(trim($email)==""){
echo " alert ('Please enter email')";
}
else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
echo "";
}
else if(trim($addr1)==""){
echo " alert ('Please enter Address')";
}
else if(!is_numeric($phone)){
echo " alert ('Invalide phone number')";
}
else if($terms == ""){
echo " alert ('Please Agree the terms and Conditions')";
}
else {
//echo substr($img_src,0,7);
if(substr($img_path,0,7)=='http://'|| substr($img_path,0,8)=="https://" ){
$img_url =$img_path;
}
else{
$img_url =SITE_PATH.$img_path;
}
$date = date('Y-m-d H:i:s');
$qr = "INSERT INTO order_user_details SET order_data_id = '$max_id', full_name = '$full_name', phone = '$phone', email = '$email', addr1 = '$addr1', addr2 = '$addr2', location = '$location',date_of_submission = '$date'";
$res2 = mysql_query($qr) or die("ERROR ON INSERT ".mysql_error());
if($res2){
$captcha_message = "Valid captcha";
$style = "background-color: #CCFF99";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$to ="omrehman@illumin8blinds.co.uk, murshid@illumin8blinds.co.uk,sales@boltonblinds.co.uk,saeed@blindtex.co.uk,martin@boltonblinds.co.uk";
// $to ="omrehman@illumin8blinds.co.uk";
$subject ="roller blinds request";
$message = '';
$message .= '
';
$message .= "Name: " .$full_name . " ";
$message .= "phone: " . $phone. " ";
$message .= "Email: " .$email. " ";
$message .= "addr1: " .$addr1 . " ";
$message .= "addr2: " . $addr2 . " ";
$message .= "location: " . $location . " ";
$message .= " Blinds Details ";
$message .= " roller width: " . $width ."mm ";
$message .= " roller height: " . $height ."mm ";
$message .=" mount type: " . $mount_type . " ";
//$message .=" roller style: " . $roll_style . " ";
$message .=" winder: " . $winder . " ";
//$message .=" Hardware colour: " . $hardware_colour . " ";
$message .=" Blind Fabric: " . $blind_fabric . " ";
$message .="Price: " . $price . " ";
$message .=" Design image path: ". SITE_PATH."images_preview.php?id=".$row["id"]. " ";
$message .=" original image path: " . $img_url. " ";
$message .= "
";
mail($to, $subject, $message, $headers);
echo "";
echo "";
}
}
unset($_SESSION['captcha']);
}
echo "
Terms & Conditions
If you would like to get an online quote, you are going to need some measurements. So we have prepared a few instructions in preparation for measuring:
See whether there are any door or window handles, or other obstacles in the way of the area you want to fit your blind.
Decide if the product is being fitted inside or outside of the recess. If inside select \"Recess\", (we will reduce the size by 10mm on both the width and the drop to fit perfectly. Or on the wall overlapping the recess select \"Exact\". We will make no deductions. For bay windows select exact and use caution when measuring the angles as this will propably require a reduction to prevent overlapping you can call for advice. On doors best to select exact rember the blind will protrude so make sure if the door is next to a wall the blind will not cause an obstacle and prevent you from opening the door fully.
Take your measurements and enter them into our online pricing system.
Customize the roller blinds
";