<?php
// ---- Customized Multiupload script--------------------- // Receiving variables -----------------------------------
@$Name = addslashes($_POST['Name']);
@$Address = addslashes($_POST['Address']);
@$Town = addslashes($_POST['Town']);
@$Area_Code = addslashes($_POST['Area_Code']);
@$Payment = addslashes($_POST['Payment']);
@$Phone_Number = addslashes($_POST['Phone_Number']);
@$Email_Address = addslashes($_POST['Email_Address']);
@$Agreement = addslashes($_POST['Agreement']);
@$size = addslashes($_POST['size']);
$size1 = $size/1000;
//-------Loop for Image relevant variables----------------
for ($i = 1; $i <= 8; $i++)
{
$Image_Upload = "Image_Upload_$i";
@$Image_Upload_Size[$i]= $_FILES[$Image_Upload]['size'];
@$Image_Upload_Name[$i]= $_FILES[$Image_Upload]['name'];
@$Image_Upload_Temp[$i]= $_FILES[$Image_Upload]['tmp_name'];
@$Description[$i]= addslashes($_POST['Description_'.$i]);
@$Size[$i] = addslashes($_POST['Size_'.$i]);
@$Quantity[$i] = addslashes($_POST['Quantity_'.$i]);
@$Filter[$i] = addslashes($_POST['Filter_'.$i]);
}
function RecursiveMkdir($path)
{
if (!file_exists($path))
{
RecursiveMkdir(dirname($path));
mkdir($path, 0777);
}
}
// Validation for required field and email and error message creation ----
if (strlen($Name) == 0 )
{
$error .= "
The name is missing !\n";
}
if (strlen($Address) == 0 )
{
$error .= "
The address is missing !\n";
}
if (strlen($Town) == 0 )
{
$error .= "
The Town is missing !\n";
}
if (strlen($Area_Code) == 0 )
{
$error .= "
The Area Code is missing !\n";
}
if (strlen($Payment) == 0 )
{
$error .= "
The Payment Method is missing !\n";
}
if (strlen($Phone_Number) == 0 )
{
$error .= "
The Phone Number is missing !\n";
}
if (strlen($Agreement) == 0 )
{
$error .= "
You did not agree with the terms of service !\n";
}
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email_Address))
{
$error .= "
The Email seems incorrect !\n";
}
if (strlen($Email_Address) == 0 )
{
$error .= "
The Email is missing !\n";
}
for ($i = 1; $i <= 8; $i++)
{
if ($Image_Upload_Size[$i] > $size)
{
$error .= "
Size of Image $i is bigger than allowed ($size1 Kb). Please resize it !\n";
}
}
if ($error != "")
// Check if there are errors, if yes, load the Error screen
{
//------Include error screen template--------------
?>
<HTML>
<HEAD>
<STYLE type="text/css">
div#container
{
width: 800px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
}
</STYLE>
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000">
<DIV id="container">
<DIV style="position:absolute;left:42px;top:3px;width:7 30px;height:99px;z-index:0" align="left">
<IMG src="background.gif" align="top" alt="" border="0" width="730" height="99">
</DIV>
<DIV style="position:absolute;left:359px;top:24px;width :150px;height:55px;z-index:1" align="left">
<FONT style="font-size:48px" color="#FFFFFF" face="Arial">Error!</FONT>
</DIV>
<TEXTAREA name="Error window" style="position:absolute;left:143px;top:146px;widt h:551px;height:343px;z-index:2" rows=25 cols=66><?php echo $error; ?></TEXTAREA>
<DIV style="position:absolute;left:275px;top:115px;widt h:313px;height:22px;z-index:3" align="left">
<FONT style="font-size:19px" color="#FF0000" face="Arial">The following Errors have occured !</FONT>
</DIV>
<DIV style="position:absolute;left:42px;top:519px;width :730px;height:99px;z-index:4" align="left">
<IMG src="background.gif" align="top" alt="" border="0" width="730" height="99">
</DIV>
<DIV style="position:absolute;left:76px;top:555px;width :467px;height:22px;z-index:5" align="center">
<FONT style="font-size:19px" color="#FFFFFF" face="Arial">Please use the "Back" button and correct the error.</FONT>
</DIV>
<DIV style="position:absolute;left:586px;top:548px;widt h:150px;height:41px;z-index:6" align="center">
<BUTTON type="button" onClick="history.go(-1)" style="width:150px;height:41px"><P><FONT style="font-size:13px" color="#000000" face="Arial">Back to the form</FONT></P></BUTTON>
</DIV>
</DIV>
</BODY>
</HTML>
<?php
}
else
{
//---Upload the files if they exist---------------------------------
for ($i = 1; $i <= 8; $i++)
{
if ($Image_Upload_Size[$i] < $size and $Image_Upload_Size[$i] >0)
{
$uploadFile = "uploads/".$Image_Upload_Name[$i];
if (!is_dir(dirname($uploadFile)))
{
@RecursiveMkdir(dirname($uploadFile));
}
else
{
@chmod(dirname($uploadFile), 0777);
}
@move_uploaded_file( $Image_Upload_Temp[$i] , $uploadFile);
chmod($uploadFile, 0644);
$Image_URL[$i] = "
http://secure.getcanvased.co.nz/order/order.php/uploads/".$Image_Upload_Name[$i];
}
}
//--------------------------------------------------------------- // Find Server date and Time
$date = date("l jS F Y, g:i A");
// --------Find Browser and IPaddress----------------------------
$browser =$_SERVER['HTTP_USER_AGENT'];
$ip = $_SERVER['REMOTE_ADDR'];
//---------Sending Email to form owner ---------------------------
$nd_header = "From: $Email_Address\n"
. "Reply-To: $Email_Address\n";
$nd_subject = "
New submission from Order Page";
$nd_email_to = "
????????@????????.nz";
$nd_message = "
New order:\n"
. "-------------------------------------------\n"
. "Name : $Name\n"
. "Address : $Address\n"
. "Town : $Town\n"
. "Area_Code : $Area_Code\n"
. "Email Address: $Email_Address\n"
. "Phone Number : $Phone_Number\n"
. "Agreement : $Agreement\n"
. "-------------------------------------------\n"
. "Payment: $Payment\n"
. "-------------------------------------------\n";
for ($i = 1; $i <= 8; $i++)
{
if (@$Image_Upload_Size[$i] >0)
{
$nd_message .= "Link to image $i : $Image_URL[$i] \n"
. "Description of Image $i: $Description[$i] \n"
. "Size for Image $i : $Size[$i] \n"
. "Quantity for Image $i : $Quantity[$i] \n"
. "Filter for Image $i : $Filter[$i] \n"
. "-------------------------------------------\n";
}
}
$nd_message .= "Date of Submission : $date\n"
. "Browser : $browser\n"
. "IP address : $ip\n"
. "-------------------------------------------\n"
. "If the links are broken, please copy \n"
. "and paste in your browser's address bar \n"
. "-------------------------------------------\n";
*****($nd_email_to, $nd_subject ,$nd_message ,$nd_header ) ;
header("Location: thankyou_page.html");
}
?>