All pastes #261696 Raw Edit

Miscellany

public php v1 · immutable
#261696 ·published 2006-11-29 20:07 UTC
rendered paste body
<?function UpFile($ufile,$upload_dir){          		    // dosya biçimleri            $file_types = array('application/zip','text/plain','image/gif','image/jpeg','image/jpeg','image/png','application/x-tar','application/x-gzip','audio/mpeg','video/quicktime','application/msword','application/vnd.ms-excel','text/xml','video/x-msvideo','text/css','application/vnd.oasis.opendocument.presentation','application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.spreadsheet','application/x-bittorrent','application/pdf','application/x-shockwave-flash','audio/x-wav');                         // dosya uzant&#305;lar&#305;            $file_exts  = array('.zip','.txt','.gif','jpeg','.jpg','.png','tar','.gz','.mp3'.'.mov','.doc','.xls','.xml','.avi','.css','.odp','.odt','.ods','.torrent','.pdf','.swf','.wav');                         // upload dizini yoksaif (!is_dir($upload_dir)) { return 4;}$file_name = $_FILES[$ufile]['name'];  // gönderilen dosyan&#305;n ad&#305;$file_type = $_FILES[$ufile]['type']; // gönderilen dosyan&#305;n tipi$file_ext  = strtolower(substr($file_name,strrpos($file_name,"."))); // dosya uzant&#305;s&#305;n&#305; alal&#305;mif (!empty($file_name) &&  !empty($file_type))  { // dosya ad&#305; ve tipi bo&#351; de&#287;ilseif (!in_array($file_type, $file_types) && !in_array($file_ext, $file_exts)) { // dosya tipleri ve dosya uzant&#305;s&#305; birbirine uygun mu ?return 6;} else { // upload file$tempname  = $_FILES[$ufile]['tmp_name'];  // dosyan&#305;n geçici adresi$file_name = str_replace("\\","",$file_name); // $file_name = str_replace("'","",$file_name);  // $file_path = $upload_dir.md5(time())."_".$file_name; // dosyan&#305;n yeni adresi//  dosyan&#305;n yüklenmi&#351; oldu&#287;unu kontrol edelim,if(is_uploaded_file($tempname)){ // dosya yüklenmi&#351; iseif(!move_uploaded_file($tempname,$file_path)){ // dosya ta&#351;&#305;namaz isereturn 7;                            }    else {if(!chmod($file_path, 0755)){// dosya izinleri verilemedireturn 8;} else {// dosya yüklendi ve kullan&#305;ma haz&#305;rreturn $file_path;               }        }     } else {// dosya yükleme ile ilgili bir sorun var, bu bir sald&#305;r&#305; olabilir                        return 9;                                            }                }                } else { // içerik bo&#351;                    return 5;                                }        }?>		<?$ufile = $_FILES['userfile'];$upload_dir = "dosyalar/";UpFile($ufile,$upload_dir);		?>												Warning: Illegal offset type in c:\program files\easyphp1-8\www\dosyagonder2\yukle.php on line 23Warning: Illegal offset type in c:\program files\easyphp1-8\www\dosyagonder2\yukle.php on line 24