Jump to content

errors in my script?


ponies3387

Recommended Posts

I created a simple form in dreamweaver with an email text field, file upload, 3 checkboxes, and a submit button.

 

This script is supposed to send me their email address, checkbox results, and a link to the picture they uploaded onto my server in a folder called uploads.

 

As of right now the script is sending me an email with no checkbox results, and the link takes me to the uploads folder to view the image but its not found.

 

Heres the script, hopefully someone can help me.

Oh and did I mention, this is my first script ever. I used a tutorial to make it  ???

 

<?php

 

@$email = addslashes($_POST['email']);

@$upload_Name = $_FILES['upload']['name'];

@$upload_Size = $_FILES['upload']['size'];

@$upload_Temp = $_FILES['upload']['tmp_name'];

@$upload_Mime_Type = $_FILES['upload']['type'];

@$check1 = $_REQUEST['1'] ;

@$check2 = $_REQUEST['2'] ;

@$check3 = $_REQUEST['3'] ;

 

function RecursiveMkdir($path)

{

  if (!file_exists($path))

  {

      RecursiveMkdir(dirname($path));

      mkdir($path, 0777);

    }

  }

 

 

if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))

{

die("<p align='center'><b><font face='Arial Black' size='5' color='#FF0000'>Please enter a valid email</font></b></p>");

}

 

if( $upload_Size == 0)

{

die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>");

}

 

 

// CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS

if( $upload_Size >2000000)

//--------

{

unlink($upload_Temp);

die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>");

}

if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" )

{

unlink($upload_Temp);

die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>");

}

$uploadFile = "uploads/".$upload_Name ;

if (!is_dir(dirname($uploadFile)))

  {

    @RecursiveMkdir(dirname($uploadFile));

  }

else

  {

  @chmod(dirname($uploadFile), 0777);

  }

@move_uploaded_file( $upload_Temp , $uploadFile);

chmod($uploadFile, 0644);

 

//CHANGE THIS TO THE YOUR DOMAIN

$upload_URL = "http://changedforprivacy/uploads/".$upload_Name ;

//------------

 

$pfw_header = "From: $email";

$pfw_subject = "NEW SENT PHOTO";

 

// CHANGE THIS TO YOUR EMAIL ADDRESS

$pfw_email_to = "info@changedforprivacy.COM";

//------------

$pfw_message = "email: $email\n"

 

. "Name: $Name\n"

. "upload: $upload_URL\n";

@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 

echo("<p align='center'><b><font face='Arial Black' size='2' color='#0000FF'><br></font></b></p>");

include("SendSuccess.html");

?>

 

 

 

Link to comment
Share on other sites

ok, sorry I dont know how to to edit my original post, but I removed all the @s and still got an e-mail without the checkbox results, and a link that goes to "server not found" when its supposed to show the uploaded image.

 

<?php


$email = addslashes($_POST['email']);
$upload_Name = $_FILES['upload']['name'];
$upload_Size = $_FILES['upload']['size'];
$upload_Temp = $_FILES['upload']['tmp_name'];
$upload_Mime_Type = $_FILES['upload']['type'];
$check1 = $_REQUEST['1'] ;
$check2 = $_REQUEST['2'] ;
$check3 = $_REQUEST['3'] ;

function RecursiveMkdir($path)
{
   if (!file_exists($path)) 
   { 
      RecursiveMkdir(dirname($path));
      mkdir($path, 0777);
    }
  }


if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
die("<p align='center'><b><font face='Arial Black' size='5' color='#FF0000'>Please enter a valid email</font></b></p>");
}

if( $upload_Size == 0)
{
die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>");
}


// CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS
if( $upload_Size >2000000)
//--------
{
unlink($upload_Temp);
die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>");
}
if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" )
{
unlink($upload_Temp);
die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>YOUR FILE WAS NOT UPLOADED<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>");
}
$uploadFile = "uploads/".$upload_Name ;
if (!is_dir(dirname($uploadFile)))
  {
    RecursiveMkdir(dirname($uploadFile)); 
  }
else
  {
  chmod(dirname($uploadFile), 0777);
  }
move_uploaded_file( $upload_Temp , $uploadFile); 
chmod($uploadFile, 0644);

//CHANGE THIS TO THE YOUR DOMAIN
$upload_URL = "http://private/uploads/".$upload_Name ;
//------------

$pfw_header = "From: $email";
$pfw_subject = "NEW SENT PHOTO";

// CHANGE THIS TO YOUR EMAIL ADDRESS
$pfw_email_to = "info@private.COM";
//------------
$pfw_message = "email: $email\n"

. "Name: $Name\n"
. "upload: $upload_URL\n";
mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

echo("<p align='center'><b><font face='Arial Black' size='2' color='#0000FF'><br></font></b></p>");
include("SendSuccess.html");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.