User Image Gallery

Please submit your personal fruit images to be placed in our online image gallery (coming soon)! JPG or JPEG image files only, size limit of 2 MB.

" method="post" enctype="multipart/form-data" name="uploader"> Upload:
"/") { //Check to see if the last character is a slash $upload_dir = $upload_dir."/"; //Add a backslash if not present } else { $upload_dir = $upload_dir; //If backslash is present, do nothing } //Figure if last character for the upload log directory is a back slash $udl_len = strlen($upload_log_dir); //Get upload log directory size $last_slash = substr($upload_log_dir,$udl_len-1,1); //Get Last Character if ($last_slash <> "/") { //Check to see if the last character is a slash $upload_log_dir = $upload_log_dir."/"; //Add a backslash if not present } else { $upload_log_dir = $upload_log_dir; //If backslash is present, do nothing } //Validate the extension array foreach ($ext_array as $key => $value) { //Start extension loop $first_char = substr($value,0,1); //Get first character if ($first_char <> ".") { //If not a period, $extensions[] = ".".strtolower($value); //Write value with a period to a new array } else { //Else $extensions[] = strtolower($value); //Write the value to a new array } } //Get Counts $ext_count = count($extensions); //Count the number of extensions $banned_count = count($banned_array); //Count the number of banned users //Figure if anyone is banned if ($banned_count >= 1) { //If number of banned users if 1 or greater $banned_users = "TRUE"; //Set banned_users to TRUE } //Get server constants $ip = $_SERVER['REMOTE_ADDR']; //Get IP address $self = $_SERVER['PHP_SELF']; //Get PHP Self $site = $_SERVER['HTTP_HOST']; //Get Start of Web URL $ip = $_SERVER['REMOTE_ADDR']; //Get IP Address //Set file size variables $kb = 1024; //Set KB $mb = 1024 * $kb; //Set MB $gb = 1024 * $mb; //Set GB $tb = 1024 * $gb; //Set TB //Get The File's Extension $extension = strtolower(strrchr($file_name,".")); //Get the file extension //Validate Extension foreach ($extensions as $key => $value) { //Start extract loop of valid extensions if ($value == $extension) { //If extension is equal to any in the array $valid_extension = "TRUE"; //Set valid extension to TRUE } $all_ext .= $value.", "; //Get all the extensions } $all_ext_len = strlen($all_ext); //Get the number of characters $all_ext = substr($all_ext,0,$all_ext_len-2); //Extract all text except the last (2) characters //Validate the file's size $size = filesize($temp_file_name); //Get the size of the file if ($size > $max_file_size) { //Set over limit statement $over_limit = "TRUE"; //Set over_limit to TRUE } //Get the size of the uploaded file in other than bytes if ($size < $kb) { $screen_size = "$size Bytes"; //Set screen_size in bytes, if applicable } elseif ($size < $mb) { $final = round($size/$kb,2); $screen_size = "$final KB"; //Set screen_size in kilo-bytes, if applicable } elseif ($size < $gb) { $final = round($size/$mb,2); $screen_size = "$final MB"; //Set screen_size in mega-bytes, if applicable } else if($size < $tb) { $final = round($size/$gb,2); $screen_size = "$final GB"; //Set screen_size in giga-bytes, if applicable } else { $final = round($size/$tb,2); $screen_size = "$final TB"; //Set screen_size in tera-bytes, if applicable } //Get the size of the max file size in other than bytes if ($max_file_size < $kb) { //Set screen_max in bytes, if applicable $screen_max = "$max_file_size Bytes"; } elseif ($max_file_size < $mb) { $final = round($max_file_size/$kb,2); $screen_max = "$final KB"; //Set screen_max in kilo-bytes, if applicable } elseif ($max_file_size < $gb) { $final = round($max_file_size/$mb,2); $screen_max = "$final MB"; //Set screen_max in mega-bytes, if applicable } else if($max_file_size < $tb) { $final = round($max_file_size/$gb,2); $screen_max = "$final GB"; //Set screen_max in giga-bytes, if applicable } else { $final = round($max_file_size/$tb,2); $screen_max = "$final TB"; //Set screen_max in tera-bytes, if applicable } //Validate the banned users list if ($banned_users) { //If banned users are present foreach($banned_array as $key => $value) { //Start extraction of banned users from the array if ($value == $ip) { //If the user's IP address is found in list, continue $banned_ip = "TRUE"; //and set the banned_ip to TRUE } } } //Start the validation process if ($banned_ip) { $result = "You have been banned from uploading any files to this directory!"; $log = $upload_log_dir."banned.txt"; //Log Banned File Name $fp = fopen($log,"a+"); //Set File Pointer fwrite($fp," $ip tried to upload on $date at $time."); //Write File fclose($fp); //Close File Pointer } elseif (!$valid_extension) { $result = "Unacceptable file extension."; echo $result; return FALSE; } elseif ($over_limit) { $result = "File too large."; echo $result; return FALSE; } else { if (is_uploaded_file($temp_file_name)) { if (move_uploaded_file($temp_file_name,$upload_dir . $file_name)) { $log = $upload_log_dir.$y."_".$m."_".$d.".txt"; //Log File Name $fp = fopen($log,"a+"); //Set File Pointer fwrite($fp," $ip | $file_name | $screen_size | $date | $time"); //Write File fclose($fp); $result = "Success!"; echo $result; //Close File Pointer return TRUE; } else { $result = "Your file could not be uploaded, please try again."; echo $result; return FALSE; } } else { $result = "Your file could not be uploaded, please try again."; echo $result; return FALSE; } } } $self = $_SERVER['PHP_SELF']; $submit = $_POST['Submit']; $temp_file_name = trim($_FILES['upload']['tmp_name']); $file_name = trim($_FILES['upload']['name']); $upload_dir = "uploads/"; $upload_log_dir = "uploads/upload_logs/"; $max_file_size = 2200000; $banned_array = array(""); $ext_array = array(".jpg",".jpeg"); if (($submit) AND ($temp_file_name)) { print upload_files($temp_file_name,$file_name,$upload_dir,$upload_log_dir,$max_file_size,$banned_array,$ext_array); } ?>
Contact Webmaster | ©2005 North American Fruit Explorers, Inc.