PDA

View Full Version : code



hidden
05-22-2009, 02:03 PM
hello,

i found this this code for my upload buttons but when i try to change the code for multiple uploads i get this error:

arse error: syntax error, unexpected $end in /home/zxsbuqjd/public_html/members/uploadaction.php on line 142

hereby the code i used:

<?php

// Receiving variables

@$email = addslashes($_POST['email']);
@$upload_Name = $_FILES['upload']['name'];
@$upload_Size = $_FILES['upload']['size'];
@$upload_Temp = $_FILES['upload']['tmp_name'];
@$upload1_Name = $_FILES['upload1']['name'];
@$upload1_Size = $_FILES['upload1']['size'];
@$upload1_Temp = $_FILES['upload1']['tmp_name'];
@$upload2_Name = $_FILES['upload2']['name'];
@$upload2_Size = $_FILES['upload2']['size'];
@$upload2_Temp = $_FILES['upload2']['tmp_name'];
@$upload3_Name = $_FILES['upload3']['name'];
@$upload3_Size = $_FILES['upload3']['size'];
@$upload3_Temp = $_FILES['upload3']['tmp_name'];
@$upload4_Name = $_FILES['upload4']['name'];
@$upload4_Size = $_FILES['upload4']['size'];
@$upload4_Temp = $_FILES['upload4']['tmp_name'];

if ($upload_Size>0)
{
if( $upload_Size >1000000)
{
//delete file
unlink($upload_Temp);
header("Location: error.html");
exit;
}
}

if ($upload1_Size>0)
{
if( $upload1_Size >1000000)
{
//delete file
unlink($upload1_Temp);
header("Location: error.html");
exit;
}
}

if ($upload2_Size>0)
{
if( $upload2_Size >1000000)
{
//delete file
unlink($upload2_Temp);
header("Location: error.html");
exit;
}
}

if ($upload3_Size>0)
{
if( $upload3_Size >1000000)
{
//delete file
unlink($upload3_Temp);
header("Location: error.html");
exit;
}
}

if ($upload4_Size>0)
{
if( $upload4_Size >1000000)
{
//delete file
unlink($upload4_Temp);
header("Location: error.html");
exit;
}
}

if ($upload_Size>0)
{
$uploadFile = "uploads/".$upload_Name ;
@move_uploaded_file( $upload_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload_URL = "http://www.euro-gulfalliance.com/uploads/".$upload_Name ;

if ($upload1_Size>0)
{
$uploadFile = "uploads/".$upload1_Name ;
@move_uploaded_file( $upload1_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload1_URL = "http://www.euro-gulfalliance.com/uploads/".$upload1_Name ;
}

if ($upload2_Size>0)
{
$uploadFile = "uploads/".$upload2_Name ;
@move_uploaded_file( $upload2_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload1_URL = "http://www.euro-gulfalliance.com/uploads/".$upload2_Name ;
}

if ($upload3_Size>0)
{
$uploadFile = "uploads/".$upload3_Name ;
@move_uploaded_file( $upload3_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload1_URL = "http://www.euro-gulfalliance.com/uploads/".$upload3_Name ;
}

if ($upload4_Size>0)
{
$uploadFile = "uploads/".$upload4_Name ;
@move_uploaded_file( $upload4_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload1_URL = "http://www.euro-gulfalliance.com/uploads/".$upload4_Name ;
}

//Sending Email to form owner
$mailto = "euro-gulfalliance********.com";
$mailto = "info@euro-gulfalliance.com";
$mailsubj = "Product Registration";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Product registration :\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
$mailbody .= "File Link 1: $upload_URL\n"; //
$mailbody .= "File Link 2: $upload1_URL\n"; //
$mailbody .= "File Link 3: $upload2_URL\n"; //
$mailbody .= "File Link 4: $upload3_URL\n"; //
$mailbody .= "File Link 5: $upload4_URL\n"; //

$mailbody .= "If any link is broken, please copy and paste it in your browser's address bar\n";

mail($mailto, $mailsubj, $mailbody, $mailhead);

header("Location: thankyou_page.html");

?>please tell me what i did wrong

ty

Watdaflip
05-23-2009, 07:23 AM
Besides for the fact the code is logically wrong, the cause of the error is here (its about the half way point, I highlighted the code you need to add in blue, you can remove the red)

iif ($upload4_Size>0)
{
if( $upload4_Size >1000000)
{
//delete file
unlink($upload4_Temp);
header("Location: error.html");
exit;
}
}

if ($upload_Size>0)
{
$uploadFile = "uploads/".$upload_Name ;
@move_uploaded_file( $upload_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload_URL = "http://www.euro-gulfalliance.com/uploads/".$upload_Name ;
} // <--------- Missing a bracket here /////////////////////////////
////////////////////////////////////////////////////////////////////////
if ($upload1_Size>0)
{
$uploadFile = "uploads/".$upload1_Name ;
@move_uploaded_file( $upload1_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upload1_URL = "http://www.euro-gulfalliance.com/uploads/".$upload1_Name ;
}