hello every one, quite stucked with mihalism multi host i am on dream host and they are not opening allow_url_fopen. now i want my image host to upload images via url but no luck i tried converting upload.php to curl from allow_url_fopen myself but could't do that because of lack of knowledge. need help can some please convert allow_url_fopen to curl of the following? <?php // ======================================== \ // Package: Mihalism Multi Host // Version: 4.0.0 // Copyright (c) 2007, 2008 Mihalism, Inc. // License: http://www.gnu.org/licenses/gpl.txt GNU Public License // ======================================== / require_once "./source/includes/data.php"; $mmhclass->templ->page_title = "{$mmhclass->info->config['site_name']} » Upload"; if ($mmhclass->funcs->is_null($mmhclass->input->get_vars['url']) == true) { for ($i = 0; $i <= 15; $i++) { if ($mmhclass->input->file_vars['userfile']['error'][$i] != 4 && $mmhclass->funcs->is_null($mmhclass->input->file_vars['userfile']['name'][$i]) == false) { $total_file_uploads++; if ($total_file_uploads <= 15) { $mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr />" : NULL); $extension = $mmhclass->image->file_extension($mmhclass->input->file_vars['userfile']['name'][$i]); $filename = ($mmhclass->funcs->random_string(20).".{$extension}"); $thumbnail = $mmhclass->image->thumbnail_name($filename); $filetitle = strip_tags((strlen($mmhclass->input->file_vars['userfile']['name'][$i]) > 20) ? (substr($mmhclass->input->file_vars['userfile']['name'][$i], 0, 20)."...") : $mmhclass->input->file_vars['userfile']['name'][$i]); if (in_array($extension, $mmhclass->info->config['file_extensions']) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> extension <b>.{$extension}</b> is not allowed.", false); } elseif ($mmhclass->input->file_vars['userfile']['size'][$i] > $mmhclass->info->config['max_filesize']) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false); } elseif ($mmhclass->image->is_image($mmhclass->input->file_vars['userfile']['tmp_name'][$i]) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> does not appear to be a real image.", false); } elseif ($mmhclass->input->file_vars['userfile']['error'][$i] != 0) { $file_errors = array( 1 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <a href=\"http://us2.php.net/manual/en/ini.core.php#ini.upload-max-filesize\">upload_max_filesize</a> directive in php.ini.", 2 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <b><i>MAX_FILE_SIZE</i></b> directive that was specified in the HTML form.", // <- Never will be outputted as an error but still an option 3 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> was only partially uploaded.", 6 => "<b>PHP Engine Error</b>: Missing a temporary folder.", 7 => "<b>PHP Engine Error</b>: Failed to write image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> to disk.", 8 => "<b>PHP Engine Error</b>: Upload stopped by extension." ); $mmhclass->templ->html .= $mmhclass->templ->error($file_errors[$mmhclass->input->file_vars['userfile']['error'][$i]], false); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) { $mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false); } elseif (move_uploaded_file($mmhclass->input->file_vars['userfile']['tmp_name'][$i], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> failed to upload because of an unknown problem.", false); } else { chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644); $mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); "); $mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->input->file_vars['userfile']['size'][$i]}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->input->file_vars['userfile']['name'][$i])."'); "); $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); $mmhclass->image->create_thumbnail($filename); $mmhclass->templ->html .= $mmhclass->templ->file_results($filename); } } } } } else { for ($i = 0; $i <= 15; $i++) { if (strtolower(ini_get("allow_url_fopen")) == "on" || $mmhclass->funcs->is_null(ini_get("allow_url_fopen")) == true) { $mmhclass->templ->error("<b>PHP Engine Error:</b> The <b>allow_url_fopen</b> directive must be enabled in php.ini in order to use URL upload.", true); } else { if ($mmhclass->funcs->is_null($mmhclass->input->post_vars['userfile'][$i]) == false) { $total_file_uploads++; if ($total_file_uploads <= 15) { $mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr>" : NULL); $mmhclass->info->file_data = array( "http" => $mmhclass->input->post_vars['userfile'][$i], "name" => array_shift(explode("?", basename($mmhclass->input->post_vars['userfile'][$i]))), "size" => strlen(implode("", file($mmhclass->input->post_vars['userfile'][$i]))), ); $extension = $mmhclass->image->file_extension($mmhclass->info->file_data['name']); $filename = ($mmhclass->funcs->random_string(20).".{$extension}"); $thumbnail = $mmhclass->image->thumbnail_name($filename); $filetitle = strip_tags((strlen($mmhclass->info->file_data['name']) > 20) ? (substr($mmhclass->info->file_data['name'], 0, 20)."...") : $mmhclass->info->file_data['name']); if (preg_match("/(https|http|ftp):\/\/[^\"\s']+/", $mmhclass->info->file_data['http']) == false || preg_match("/\.([a-zA-Z0-9])/", $mmhclass->info->file_data['name']) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> contains an invalid URL.", false); } elseif ($mmhclass->info->file_data['size'] == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> could not be opened.", false); } elseif (in_array($extension, $mmhclass->info->config['file_extensions']) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> extension <b>.{$extension}</b> is not allowed.", false); } elseif ($mmhclass->info->file_data['size'] > $mmhclass->info->config['max_filesize']) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) { $mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false); } elseif (copy($mmhclass->info->file_data['http'], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> failed to upload because of an unknown problem.", false); } else { chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644); $mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); "); $mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->info->file_data['size']}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->info->file_data['name'])."'); "); $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); $mmhclass->image->create_thumbnail($filename); $mmhclass->templ->html .= $mmhclass->templ->file_results($filename); unset($mmhclass->info->file_data); } } } } } } if ($total_file_uploads < 1) { $mmhclass->templ->error("Please go back and select at least one image file to upload.", true); } $mmhclass->templ->output(); ?> Code (markup):
umm joffer there is no php.ini in dreamhost they say i have to install php version myself to get along this and there is no cpanel they best i can get is to convert it to curl there is someone on these forums who got his upoad.php converted successfully i am going to find link and give you for refrence but he was using older version of mihalism multi host script. edit:heres some got his script converted by someone but old version http://forums.digitalpoint.com/showthread.php?t=705778&highlight=mihalism+multi+host Code (markup):
Try this: <?php // ======================================== \ // Package: Mihalism Multi Host // Version: 4.0.0 // Copyright (c) 2007, 2008 Mihalism, Inc. // License: http://www.gnu.org/licenses/gpl.txt GNU Public License // ======================================== / function curl_copy( $url, $copyto ) { if( function_exists( 'curl_init' ) ) { $ch = curl_init( ); $fp = fopen( $copyto, 'w+' ); if( !$fp || !$ch ) return false; curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_HEADER, 0 ); curl_setopt( $ch, CURLOPT_USERAGENT, 'User-Agent: ImageGetter/1.0' ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); fwrite( $fp, curl_exec( $ch ) ); curl_close( $ch ); fclose( $fp ); return true; } else return false; } require_once "./source/includes/data.php"; $mmhclass->templ->page_title = "{$mmhclass->info->config['site_name']} » Upload"; if ($mmhclass->funcs->is_null($mmhclass->input->get_vars['url']) == true) { for ($i = 0; $i <= 15; $i++) { if ($mmhclass->input->file_vars['userfile']['error'][$i] != 4 && $mmhclass->funcs->is_null($mmhclass->input->file_vars['userfile']['name'][$i]) == false) { $total_file_uploads++; if ($total_file_uploads <= 15) { $mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr />" : NULL); $extension = $mmhclass->image->file_extension($mmhclass->input->file_vars['userfile']['name'][$i]); $filename = ($mmhclass->funcs->random_string(20).".{$extension}"); $thumbnail = $mmhclass->image->thumbnail_name($filename); $filetitle = strip_tags((strlen($mmhclass->input->file_vars['userfile']['name'][$i]) > 20) ? (substr($mmhclass->input->file_vars['userfile']['name'][$i], 0, 20)."...") : $mmhclass->input->file_vars['userfile']['name'][$i]); if (in_array($extension, $mmhclass->info->config['file_extensions']) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> extension <b>.{$extension}</b> is not allowed.", false); } elseif ($mmhclass->input->file_vars['userfile']['size'][$i] > $mmhclass->info->config['max_filesize']) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false); } elseif ($mmhclass->image->is_image($mmhclass->input->file_vars['userfile']['tmp_name'][$i]) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> does not appear to be a real image.", false); } elseif ($mmhclass->input->file_vars['userfile']['error'][$i] != 0) { $file_errors = array( 1 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <a href=\"http://us2.php.net/manual/en/ini.core.php#ini.upload-max-filesize\">upload_max_filesize</a> directive in php.ini.", 2 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <b><i>MAX_FILE_SIZE</i></b> directive that was specified in the HTML form.", // <- Never will be outputted as an error but still an option 3 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> was only partially uploaded.", 6 => "<b>PHP Engine Error</b>: Missing a temporary folder.", 7 => "<b>PHP Engine Error</b>: Failed to write image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> to disk.", 8 => "<b>PHP Engine Error</b>: Upload stopped by extension." ); $mmhclass->templ->html .= $mmhclass->templ->error($file_errors[$mmhclass->input->file_vars['userfile']['error'][$i]], false); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) { $mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false); } elseif (move_uploaded_file($mmhclass->input->file_vars['userfile']['tmp_name'][$i], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> failed to upload because of an unknown problem.", false); } else { chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644); $mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); "); $mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->input->file_vars['userfile']['size'][$i]}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->input->file_vars['userfile']['name'][$i])."'); "); $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); $mmhclass->image->create_thumbnail($filename); $mmhclass->templ->html .= $mmhclass->templ->file_results($filename); } } } } } else { for ($i = 0; $i <= 15; $i++) { if ($mmhclass->funcs->is_null($mmhclass->input->post_vars['userfile'][$i]) == false) { $total_file_uploads++; if ($total_file_uploads <= 15) { $mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr>" : NULL); $mmhclass->info->file_data = array( "http" => $mmhclass->input->post_vars['userfile'][$i], "name" => array_shift(explode("?", basename($mmhclass->input->post_vars['userfile'][$i]))), "size" => strlen(implode("", file($mmhclass->input->post_vars['userfile'][$i]))), ); $extension = $mmhclass->image->file_extension($mmhclass->info->file_data['name']); $filename = ($mmhclass->funcs->random_string(20).".{$extension}"); $thumbnail = $mmhclass->image->thumbnail_name($filename); $filetitle = strip_tags((strlen($mmhclass->info->file_data['name']) > 20) ? (substr($mmhclass->info->file_data['name'], 0, 20)."...") : $mmhclass->info->file_data['name']); if (preg_match("/(https|http|ftp):\/\/[^\"\s']+/", $mmhclass->info->file_data['http']) == false || preg_match("/\.([a-zA-Z0-9])/", $mmhclass->info->file_data['name']) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> contains an invalid URL.", false); } elseif ($mmhclass->info->file_data['size'] == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> could not be opened.", false); } elseif (in_array($extension, $mmhclass->info->config['file_extensions']) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> extension <b>.{$extension}</b> is not allowed.", false); } elseif ($mmhclass->info->file_data['size'] > $mmhclass->info->config['max_filesize']) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) { $mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false); } elseif (curl_copy($mmhclass->info->file_data['http'], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> failed to upload because of an unknown problem.", false); } else { chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644); $mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); "); $mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->info->file_data['size']}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->info->file_data['name'])."'); "); $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); $mmhclass->image->create_thumbnail($filename); $mmhclass->templ->html .= $mmhclass->templ->file_results($filename); unset($mmhclass->info->file_data); } } } } } if ($total_file_uploads < 1) { $mmhclass->templ->error("Please go back and select at least one image file to upload.", true); } $mmhclass->templ->output(); ?> PHP:
I think I know what it is. I think it's trying to check that the URL image exists but it can't check that because of url_fopen not being allowed. It might not be that but I'm trying to find the part of it that is causing the error. Sky22
Try this: <?php // ======================================== \ // Package: Mihalism Multi Host // Version: 4.0.0 // Copyright (c) 2007, 2008 Mihalism, Inc. // License: http://www.gnu.org/licenses/gpl.txt GNU Public License // ======================================== / function curl_copy( $url, $copyto ) { if( function_exists( 'curl_init' ) ) { $ch = curl_init( ); $fp = fopen( $copyto, 'w+' ); if( !$fp || !$ch ) return false; curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_HEADER, 0 ); curl_setopt( $ch, CURLOPT_USERAGENT, 'User-Agent: ImageGetter/1.0' ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); fwrite( $fp, curl_exec( $ch ) ); curl_close( $ch ); fclose( $fp ); return true; } else return false; } function curl_filesize( $url ) { $ch = curl_init( ); if( !$ch ) return false; curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_HEADER, 0 ); curl_setopt( $ch, CURLOPT_USERAGENT, 'User-Agent: ImageGetter/1.0' ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $content = curl_exec( $ch ); $response_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); if( $response_code == '404' ) return false; curl_close( $ch ); return strlen( $content ); } require_once "./source/includes/data.php"; $mmhclass->templ->page_title = "{$mmhclass->info->config['site_name']} » Upload"; if ($mmhclass->funcs->is_null($mmhclass->input->get_vars['url']) == true) { for ($i = 0; $i <= 15; $i++) { if ($mmhclass->input->file_vars['userfile']['error'][$i] != 4 && $mmhclass->funcs->is_null($mmhclass->input->file_vars['userfile']['name'][$i]) == false) { $total_file_uploads++; if ($total_file_uploads <= 15) { $mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr />" : NULL); $extension = $mmhclass->image->file_extension($mmhclass->input->file_vars['userfile']['name'][$i]); $filename = ($mmhclass->funcs->random_string(20).".{$extension}"); $thumbnail = $mmhclass->image->thumbnail_name($filename); $filetitle = strip_tags((strlen($mmhclass->input->file_vars['userfile']['name'][$i]) > 20) ? (substr($mmhclass->input->file_vars['userfile']['name'][$i], 0, 20)."...") : $mmhclass->input->file_vars['userfile']['name'][$i]); if (in_array($extension, $mmhclass->info->config['file_extensions']) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> extension <b>.{$extension}</b> is not allowed.", false); } elseif ($mmhclass->input->file_vars['userfile']['size'][$i] > $mmhclass->info->config['max_filesize']) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false); } elseif ($mmhclass->image->is_image($mmhclass->input->file_vars['userfile']['tmp_name'][$i]) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> does not appear to be a real image.", false); } elseif ($mmhclass->input->file_vars['userfile']['error'][$i] != 0) { $file_errors = array( 1 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <a href=\"http://us2.php.net/manual/en/ini.core.php#ini.upload-max-filesize\">upload_max_filesize</a> directive in php.ini.", 2 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <b><i>MAX_FILE_SIZE</i></b> directive that was specified in the HTML form.", // <- Never will be outputted as an error but still an option 3 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> was only partially uploaded.", 6 => "<b>PHP Engine Error</b>: Missing a temporary folder.", 7 => "<b>PHP Engine Error</b>: Failed to write image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> to disk.", 8 => "<b>PHP Engine Error</b>: Upload stopped by extension." ); $mmhclass->templ->html .= $mmhclass->templ->error($file_errors[$mmhclass->input->file_vars['userfile']['error'][$i]], false); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) { $mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false); } elseif (move_uploaded_file($mmhclass->input->file_vars['userfile']['tmp_name'][$i], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> failed to upload because of an unknown problem.", false); } else { chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644); $mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); "); $mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->input->file_vars['userfile']['size'][$i]}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->input->file_vars['userfile']['name'][$i])."'); "); $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); $mmhclass->image->create_thumbnail($filename); $mmhclass->templ->html .= $mmhclass->templ->file_results($filename); } } } } } else { for ($i = 0; $i <= 15; $i++) { if ($mmhclass->funcs->is_null($mmhclass->input->post_vars['userfile'][$i]) == false) { $total_file_uploads++; if ($total_file_uploads <= 15) { $mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr>" : NULL); $mmhclass->info->file_data = array( "http" => $mmhclass->input->post_vars['userfile'][$i], "name" => array_shift(explode("?", basename($mmhclass->input->post_vars['userfile'][$i]))), "size" => curl_filesize($mmhclass->input->post_vars['userfile'][$i]), ); $extension = $mmhclass->image->file_extension($mmhclass->info->file_data['name']); $filename = ($mmhclass->funcs->random_string(20).".{$extension}"); $thumbnail = $mmhclass->image->thumbnail_name($filename); $filetitle = strip_tags((strlen($mmhclass->info->file_data['name']) > 20) ? (substr($mmhclass->info->file_data['name'], 0, 20)."...") : $mmhclass->info->file_data['name']); if (preg_match("/(https|http|ftp):\/\/[^\"\s']+/", $mmhclass->info->file_data['http']) == false || preg_match("/\.([a-zA-Z0-9])/", $mmhclass->info->file_data['name']) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> contains an invalid URL.", false); } elseif ($mmhclass->info->file_data['size'] == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> could not be opened.", false); } elseif (in_array($extension, $mmhclass->info->config['file_extensions']) == false) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> extension <b>.{$extension}</b> is not allowed.", false); } elseif ($mmhclass->info->file_data['size'] > $mmhclass->info->config['max_filesize']) { $mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) { $mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false); } elseif (curl_copy($mmhclass->info->file_data['http'], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) { $mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> failed to upload because of an unknown problem.", false); } else { chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644); $mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); "); $mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->info->file_data['size']}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->info->file_data['name'])."'); "); $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); $mmhclass->image->create_thumbnail($filename); $mmhclass->templ->html .= $mmhclass->templ->file_results($filename); unset($mmhclass->info->file_data); } } } } } if ($total_file_uploads < 1) { $mmhclass->templ->error("Please go back and select at least one image file to upload.", true); } $mmhclass->templ->output(); ?> PHP: Sky22
OHHHHHHH its fixed thanks alooooooooot bro you dont know i was trying to fix it from days i am so happy rep+ for you