FileUploader

Gestart doorHabgallery8 reacties45 weergaven

9 berichten · pagina 1 van 1

Habgallery

Lid · Topicstarter

Berichten
631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey, ik heb even een image script veranderd naar een mta mapuploader het probleem is als ik een map van 5mb upload krijgt hij hem niet in server, en als ik een bestand van 500bytes upload zit hij hem wel erin.
Spoiler tonen
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #FF8000]/*
//================================================================================
* phphq.Net Custom PHP Scripts *
//================================================================================
:- Script Name: phUploader
:- Version: 1.3
:- Release Date: June 23rd  2004
:- Last Updated: Jan 23 2010
:- Author: Scott Lucht <scott@phphq.net> http://www.phphq.net
:- Copyright (c) 2010 All Rights Reserved
:-
:- This script is free software; you can redistribute it and/or modify
:- it under the terms of the GNU General Public License as published by
:- the Free Software Foundation; either version 2 of the License, or
:- (at your option) any later version.
:-
:- This script is distributed in the hope that it will be useful,
:- but WITHOUT ANY WARRANTY; without even the implied warranty of
:- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
:- GNU General Public License for more details.
:- http://www.gnu.org/licenses/gpl.txt
:-
//================================================================================
* Description
//================================================================================
:- phUploader is a script for uploading single or multiple images or files to your website. You can specify your 
:- own file extensions that are accepted, the file size and naming options. This script was built and tested on 
:- IIS6/7 and Apache 2+. Its recommended to use php 5.1+ This script is very useful for temporary file
:- storage or simple sig and avatar hosting.
//================================================================================
* Setup
//================================================================================
:- To setup this script, upload phUploader.php to a folder on your server. Create a new folder named uploads
:- and chmod it to 777. Edit the variables below to change how the script acts. Please read the notes if you
:- dont understand something.
//================================================================================
* Change log
//================================================================================
:- Version 1.0
:-        1) Initial Release
:- Version 1.1
:-        1) Minor bug fixes
:-        2) Enabled multiple file uploads
:- Version 1.2
:-        1) Added CSS styling
:-        2) Removed automatic creation of file upload folder.
:-        3) Improved cookie security by hashing password and storing it within the cookie for authentication.
:-        4) Minor bug fixes    
:- Version 1.3
:-        1) Re-write of many core functions to increase security.
:-        2) Patched a vulnerability that allowed a remote attacker to upload a file with two extensions and then
:-            remotely execute the script on a vulnerable web server. <http://www.securityfocus.com/bid/25405>
:-        3) New feature allows files that pass validation to be uploaded while files that fail validation are not
:-            uploaded without rejecting to whole group of files.
:-        4) Fixed a flaw that allowed files with blank names or un-sanitized names to be uploaded which may
:-            cause issues for some users.
:-        5) Minor bug fixes    
//================================================================================
* Frequently Asked Questions
//================================================================================
:- Q1: I always get an error that the files were not uploaded. IE: GENERAL ERROR
:-        1) Make sure you have CHMOD your "uploads" folder to 777 using your FTP client or similar. If you do
:-             not know how to do this ask your hosting provider.
:-        2) Make sure the uploads folder actually exists. This is the second most common mistake aside from
:-             improper permissions.
:-        3) If you are having problems uploading after you have chmod the uploads folder 777, try using the
:-             full server path in $fullpath below. If you do not know this ask your host.
:-        4) Make sure "file_uploads" is set to ON in php.ini
:-
:- Q2: The page takes long to load and then gives me a page cannot be displayed or a blank page.
:-        1) This is usually due to a low value in php.ini for "max_execution_time". 
:-        2) A newer ini setting "max_file_uploads" in php 5.2.12 was added which may be limiting the number
            of simultaneous uploads.
:-        3) Your "upload_max_filesize" and "post_max_size" in php.ini might be set to low.
:-
:- Q3: How do I edit the colors of the form?
:-        1) You will need to edit the CSS near the bottom of the script to change the looks and colors of the form.
:-            Check http://www.w3schools.com/css/default.asp for more information on CSS.
:-
:- Q4: Can I remove your copyright link?
:-        1) I cant physically stop you. However, I really appreciate it when people leave it intact.
:-            Some people donate $5, $10, $20 to take it off.
:-
:- Q5: You never respond to my emails or to my questions in your forums!
:-        1) Im a very busy guy. Im out of town a lot, and at any given time I have several projects going on.
:-            I get a lot of emails about this script, not to mention my other ones.
:-        2) I only understand English. If your English is very bad please write in your native language and then
:-            translate it to English using <http://babelfish.altavista.com/babelfish/tr>.
:-        3) If you are going to contact me, describe the issue you are having as completly as possible.
:-            "dude me form dont work see it at blah.com whats wrong??!?!" will get no response, ever. Write
:-            in detail what the problem is. Spend a minute on it, and maybe Ill take some of my time to reply.
:-
/*
//================================================================================
* ! ATTENTION !
//================================================================================
:- Please read the above FAQ before giving up or emailing me. It may sort out your problems!
*/

// Max size PER file in KB[/COLOR]
[COLOR= #0000BB]$max_file_size[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"8000"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Max size for all files COMBINED in KB[/COLOR]
[COLOR= #0000BB]$max_combined_size[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"8000"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]//Maximum file uploades at one time[/COLOR]
[COLOR= #0000BB]$file_uploads[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"1"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]//The name of your website[/COLOR]
[COLOR= #0000BB]$websitename[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"Jelly"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Full browser accessable URL to where files are accessed. With trailing slash.[/COLOR]
[COLOR= #0000BB]$full_url[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"#"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Path to store files on your server If this fails use $fullpath below. With trailing slash.[/COLOR]
[COLOR= #0000BB]$folder[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"./MaPuPloAdeR/"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Use random file names? true=yes (recommended), false=use original file name.
// Random names will help prevent files being denied because a file with that name already exists.[/COLOR]
[COLOR= #0000BB]$random_name[/COLOR][COLOR= #007700]=[/COLOR]false[COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Types of files that are acceptiable for uploading. Keep the array structure.[/COLOR]
[COLOR= #0000BB]$allow_types[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"zip"[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]// Only use this variable if you wish to use full server paths. Otherwise leave this empty. With trailing slash.[/COLOR]
[COLOR= #0000BB]$fullpath[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]//Use this only if you want to password protect your upload form.[/COLOR]
[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR] 

[COLOR= #FF8000]/*
//================================================================================
* ! ATTENTION !
//================================================================================
: Dont edit below this line.
*/

// Initialize variables[/COLOR]
[COLOR= #0000BB]$password_hash[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$error[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$success[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$display_message[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$file_ext[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]// Function to get the extension a file.[/COLOR]
[COLOR= #007700]function[/COLOR] get_ext[COLOR= #007700]([/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]) {[/COLOR] 
    [COLOR= #0000BB]$key[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/strtolower"]strtolower[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strrchr"]strrchr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"."[/COLOR][COLOR= #007700]),[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]));[/COLOR]
    [COLOR= #0000BB]$key[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"jpeg"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]"jpg"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$key[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$key[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #FF8000]// Filename security cleaning. Do not modify.[/COLOR]
[COLOR= #007700]function[/COLOR] cln_file_name[COLOR= #007700]([/COLOR][COLOR= #0000BB]$string[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$cln_filename_find[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/.[^.]+$/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"/[^dws-]/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"/ss+/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"/[-]+/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"/[_]+/"[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$cln_filename_repl[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"-"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"_"[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$string[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/preg_replace"]preg_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$cln_filename_find[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$cln_filename_repl[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$string[/COLOR][COLOR= #007700]);
}[/COLOR]

[COLOR= #FF8000]// If a password is set, they must login to upload files.[/COLOR]
[URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]) {[/COLOR]
    
    [COLOR= #FF8000]//Verify the credentials.[/COLOR]
    [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]verify_password[/COLOR][COLOR= #007700]]==[/COLOR]true[COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]check_password[/COLOR][COLOR= #007700]])==[/COLOR][COLOR= #0000BB]$password_hash[/COLOR][COLOR= #007700]) {[/COLOR]
            [URL="http://www.php.net/setcookie"]setcookie[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"phUploader"[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$password_hash[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/sleep"]sleep[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//seems to help some people.[/COLOR]
            [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: http://"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]HTTP_HOST[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]]);[/COLOR]
            [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
        }
    }[/COLOR]

    [COLOR= #FF8000]//Show the authentication form[/COLOR]
    [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_COOKIE[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]phUploader[/COLOR][COLOR= #007700]]!=[/COLOR][COLOR= #0000BB]$password_hash[/COLOR][COLOR= #007700]) {[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"<form method="POST" action=""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]PHP_SELF[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"">
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<table align="center" class="table">
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<tr>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<td width="100%" class="table_header" colspan="2">Password Required</td>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"</tr>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<tr>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<td width="35%" class="table_body">Enter Password:</td>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<td width="65%" class="table_body"><input type="password" name="check_password" /></td>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"</tr>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<td colspan="2" align="center" class="table_body">
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<input type="hidden" name="verify_password" value="true">
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<input type="submit" value=" Verify Password " />
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"</td>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"</tr>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"</table>
"[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"</form>
"[/COLOR][COLOR= #007700];
    }
    
}[/COLOR] [COLOR= #FF8000]// If Password

// Dont allow submit if $password_form has been populated[/COLOR]
[URL="http://www.php.net/If"]If[/URL][COLOR= #007700](([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/COLOR][COLOR= #007700]]==[/COLOR]true[COLOR= #007700])[/COLOR] AND [COLOR= #007700]([/COLOR][COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])) {[/COLOR]

    [COLOR= #FF8000]//Tally the size of all the files uploaded, check if its over the ammount.    [/COLOR]
    [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/array_sum"]array_sum[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]size[/COLOR][COLOR= #007700]]) >[/COLOR] [COLOR= #0000BB]$max_combined_size[/COLOR][COLOR= #007700]*[/COLOR][COLOR= #0000BB]1024[/COLOR][COLOR= #007700]) {[/COLOR]
        
        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<b>FAILED:</b> All Files <b>REASON:</b> Combined file size is to large.<br />"[/COLOR][COLOR= #007700];[/COLOR]
        
    [COLOR= #FF8000]// Loop though, verify and upload files.[/COLOR]
    [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/Else"]Else[/URL] [COLOR= #007700]{[/COLOR]

        [COLOR= #FF8000]// Loop through all the files.[/COLOR]
        [URL="http://www.php.net/For"]For[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<=[/COLOR] [COLOR= #0000BB]$file_uploads[/COLOR][COLOR= #007700]-[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++) {[/COLOR]
            
            [COLOR= #FF8000]// If a file actually exists in this key[/COLOR]
            [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]) {[/COLOR]

                [COLOR= #FF8000]//Get the file extension[/COLOR]
                [COLOR= #0000BB]$file_ext[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]=[/COLOR]get_ext[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]);[/COLOR]
                
                [COLOR= #FF8000]// Randomize file names[/COLOR]
                [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$random_name[/COLOR][COLOR= #007700]){[/COLOR]
                    [COLOR= #0000BB]$file_name[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]=[/COLOR][URL="http://www.php.net/time"]time[/URL][COLOR= #007700]()+[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]100000[/COLOR][COLOR= #007700]);
                }[/COLOR] [URL="http://www.php.net/Else"]Else[/URL] [COLOR= #007700]{[/COLOR]
                    [COLOR= #0000BB]$file_name[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]=[/COLOR]cln_file_name[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]]);
                }[/COLOR]
    
                [COLOR= #FF8000]// Check for blank file name[/COLOR]
                [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$file_name[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]])==[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]) {[/COLOR]
                    
                    [COLOR= #0000BB]$error[/COLOR][COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"<b>FAILED:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" <b>REASON:</b> Blank file name detected.<br />"[/COLOR][COLOR= #007700];[/COLOR]
                
                [COLOR= #FF8000]//Check if the file type uploaded is a valid file type. [/COLOR]
                [COLOR= #007700]}[/COLOR]    [URL="http://www.php.net/ElseIf"]ElseIf[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$file_ext[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$allow_types[/COLOR][COLOR= #007700])) {[/COLOR]
                                
                    [COLOR= #0000BB]$error[/COLOR][COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"<b>FAILED:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" <b>REASON:</b> Invalide file type.<br />"[/COLOR][COLOR= #007700];[/COLOR]
                                
                [COLOR= #FF8000]//Check the size of each file[/COLOR]
                [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/Elseif"]Elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]size[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]] > ([/COLOR][COLOR= #0000BB]$max_file_size[/COLOR][COLOR= #007700]*[/COLOR][COLOR= #0000BB]8024[/COLOR][COLOR= #007700])) {[/COLOR]
                    
                    [COLOR= #0000BB]$error[/COLOR][COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"<b>FAILED:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" <b>REASON:</b> File to large.<br />"[/COLOR][COLOR= #007700];[/COLOR]
                    
                [COLOR= #FF8000]// Check if the file already exists on the server..
                //} Elseif(file_exists($folder.$file_name[$i].".".$file_ext[$i])) {
    
                    //$error.= "<b>FAILED:</b> ".$_FILES[file][name][$i]." <b>REASON:</b> File already exists.<br />";[/COLOR]
                    
                [COLOR= #007700]}[/COLOR] [URL="http://www.php.net/Else"]Else[/URL] [COLOR= #007700]{[/COLOR]
                    
                    [URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/move_uploaded_file"]move_uploaded_file[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]tmp_name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #0000BB]$folder[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$file_name[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"."[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$file_ext[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]])) {[/COLOR]
                        
                        [COLOR= #0000BB]$success[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<b>SUCCESS:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"<br />"[/COLOR][COLOR= #007700];
                        
                        
                    }[/COLOR] [URL="http://www.php.net/Else"]Else[/URL] [COLOR= #007700]{[/COLOR]
                        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<b>FAILED:</b> "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_FILES[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]file[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" <b>REASON:</b> General upload failure.<br />"[/COLOR][COLOR= #007700];
                    }
                    
                }
                            
            }[/COLOR] [COLOR= #FF8000]// If Files[/COLOR]
        
        [COLOR= #007700]}[/COLOR] [COLOR= #FF8000]// For[/COLOR]
        
    [COLOR= #007700]}[/COLOR] [COLOR= #FF8000]// Else Total Size[/COLOR]
    
    [URL="http://www.php.net/If"]If[/URL][COLOR= #007700](([/COLOR][COLOR= #0000BB]$error[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] AND [COLOR= #007700]([/COLOR][COLOR= #0000BB]$success[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])) {[/COLOR]
        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700].=[/COLOR][COLOR= #DD0000]"<b>FAILED:</b> No files selected<br />"[/COLOR][COLOR= #007700];
    }[/COLOR]

    [COLOR= #0000BB]$display_message[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$success[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$error[/COLOR][COLOR= #007700];

}[/COLOR] [COLOR= #FF8000]// $_POST AND !$password_form

/*
//================================================================================
* Start the form layout
//================================================================================
:- Please know what your doing before editing below. Sorry for the stop and start php.. people requested that I use only html for the form..
*/[/COLOR]
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$websitename[/COLOR][COLOR= #007700];[/COLOR] ?> - MapUploader</title>

<style type="text/css">
    body{
        background-color:#FFFFFF;
        font-family: Verdana, Arial, sans-serif;
        font-size: 12pt;
        color: #000000;
    }
    
    .message {
        font-family: Verdana, Arial, sans-serif;
        font-size: 11pt;
        color: #000000;
        background-color:#EBEBEB;
    }

    a:link, a:visited {
        text-decoration:none;
        color: #000000;
    }
    
    a:hover {
        text-decoration:none;
        color: #000000;
    }

    .table {
        border-collapse:collapse;
        border:1px solid #000000;
        width:450px;
    }
    
    .table_header {
        border:1px solid #000000;
        background-color:#C03738;
        font-family: Verdana, Arial, sans-serif;
        font-size: 11pt;
        font-weight:bold;
        color: #FFFFFF;
        text-align:center;
        padding:2px;
    }
    
    .upload_info {
        border:1px solid #000000;
        background-color:#EBEBEB;
        font-family: Verdana, Arial, sans-serif;
        font-size: 8pt;
        color: #000000;
        padding:4px;
    }

    .table_body {
        border:1px solid #000000;
        background-color:#EBEBEB;
        font-family: Verdana, Arial, sans-serif;
        font-size: 10pt;
        color: #000000;
        padding:2px;
    }

    .table_footer {
        border:1px solid #000000;
        background-color:#C03738;
        text-align:center;
        padding:2px;
    }

    input,select,textarea {
        font-family: Verdana, Arial, sans-serif;
        font-size: 10pt;
        color: #000000;
        background-color:#AFAEAE;
        border:1px solid #000000;
    }
    
    .copyright {
        border:0px;
        font-family: Verdana, Arial, sans-serif;
        font-size: 9pt;
        color: #000000;
        text-align:right;
    }
    
    form {
        padding:0px;
        margin:0px;
    }
</style>

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/If"]If[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700]) {[/COLOR]
    
    [URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #0000BB]$password_form[/COLOR][COLOR= #007700];

}[/COLOR] [URL="http://www.php.net/Else"]Else[/URL] [COLOR= #007700]{[/COLOR]
?>

<form action="<?=$_SERVER[PHP_SELF];?>" method="post" enctype="multipart/form-data" name="phuploader">
<table align="center" class="table">
    <tr>
        <td class="table_header" colspan="2"><b><?=$websitename;?></b> </td>
    </tr>

    <?If($display_message){?>
    <tr>
        <td colspan="2" class="message">
        <br />
            <?=$display_message;?>
        <br />
        </td>
    </tr>
    <?}?>
    
    <tr>
        <td colspan="2" class="upload_info">
            <b>Allowed Types:</b> <?=implode($allow_types, ", ");?><br />
            <b>Max size per file:</b> <?=$max_file_size?>kb.<br />
            <b>Max size for all files combined:</b> <?=$max_combined_size?>kb.<br />
        </td>
    </tr>
    <?For($i=0;$i <= $file_uploads-1;$i++) {?>
        <tr>
            <td class="table_body" width="20%"><b>Select File:</b> </td>
            <td class="table_body" width="80%"><input type="file" name="file[]" size="30" /></td>
        </tr>
    <?}?>
    <tr>
        <td colspan="2" align="center" class="table_footer">
            <input type="hidden" name="submit" value="true" />
            <input type="submit" value=" Upload File(s) " /> &nbsp;
            <input type="reset" name="reset" value=" Reset Form " onclick="window.location.reload(true);" />
        </td>
    </tr>
</table>
</form>

<?}//Please leave this here.. it really dosent make people hate you or make your site look bad.. ?>
<table class="table" style="border:0px;" align="center">
    <tr>
        <td><div class="copyright">&copy;<a href="#" target="_blank">phpHQ.net edited by Jellys (MapUploader)</a></div></td>
    </tr>
</table>
</body>
</html>
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Dat ligt eraan hoeveel MB upload je hoster toe laat redface
toevoeging op 10 augustus 2013, 00:53:13:
Dit kan je trouwens simpel dmv een htaccess file aanpassen wink
0
Habgallery

Lid · Topicstarter

Berichten
631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Dat ligt eraan hoeveel MB upload je hoster toe laat redface
toevoeging op 10 augustus 2013, 00:53:13:
Dit kan je trouwens simpel dmv een htaccess file aanpassen wink
Ik host hem tijdelijk op 000webhost tot me vriend betaalde host heeft gefixt.

Hoe kan ik deze limit dan aanpassen in htacces?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
php_value upload_max_filesize 40M
php_value post_max_size 42M
0
Habgallery

Lid · Topicstarter

Berichten
631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
php_value upload_max_filesize 40M
php_value post_max_size 42M
of

php_value upload_max_filesize 40MB
php_value post_max_size 42MB
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Hoe ik het zei dus M
0
Habgallery

Lid · Topicstarter

Berichten
631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Gewoon in je .htaccess doen?
Ja maar, krijg hem nog steeds niet uploaded bloos
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Dan ligt het aan je hoster
0
Habgallery

Lid · Topicstarter

Berichten
631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weetje ook hoe bv ik heb nu alle maps naar een bepaalde directory laten uploaden en deze uploaded maps kan laten zien op homepage van uploaded files waar alleen de naam komt van de maps.?

toevoeging op 10 augustus 2013, 14:54:51:
ik gebruik deze code
[COLOR= #0000BB]<?php
$dir[/COLOR]    [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]./MaPuPloAdeR/[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$files1[/COLOR] [COLOR= #007700]=[/COLOR] scandir[COLOR= #007700]([/COLOR][COLOR= #0000BB]$dir[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/print_r"]print_r[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$files1[/COLOR][COLOR= #007700]);[/COLOR]

?>


maar dan krijg ik hem niet onder elkaar en krijg ik ook array te staan en die moet weg blooszo staat hij er

Array ( [0] => -DM-Sweety-v1-Natural-Condition.zip [1] => . [2] => .. [3] => 1376083868.txt [4] => 1376147375.txt [5] => 1376174594.zip [6] => race-dm-sapphire ft pein-.zip [7] => readme.zip )


toevoeging op 10 augustus 2013, 21:24:09:
Heb deze probleem gefixt alleen moet ik nu nog de directory beveiligen tegen degenen die hem wel kunnen vinden aan de hand van htacces maar ik heb hier geen verstand van kan iemand me daarmee helpen hoe ik dat directory kan beveiligen met htacces ?
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren