Hello Friends, I got a prob in my site.when i give uploader to upload pic to user,they can easily upload shell in their. actually i did it in my own site.i think its an major problem, as because any one can easily hack my site. hackers now convert the shell into gif or jpg format and then upload it. how can i stop these kinda execution.❗ how can i secure my uploader.i used accept only gif and jpeg .htaccess. but its not working. Help Me please.:(
Uploading Problem Help Please
Started on the old forum in February 2010 · view the original in the archive · old links redirect here
/*** $filename = the filename of the uploaded image ***
*** $file = the actual uploaded image file ***/
//=== Check name extension
$allow = array("gif","jpg","jpeg","png","bmp");
$ext = substr(strpos($filename, ".")+1);
if(!in_array($ext,$allow))
die("not allowed");
//=== check mimetype
$allowmime = array("image/jpeg","image/gif","image/png");
if(function_exists("mime_content_type"))
$mime = mime_content_type($file);
else {
$imgres = getimagesize($file);
$mime = image_type_to_mime_type($imgres[2]);
}
if(!$mime || !in_array($mime,$allowmime))
die("not allowed again");
khan89 wrote: noobs should not reply this
and noobs are...? i mean.. who the F... are you to judge who can and who cannot reply? you got question.. post it and wait... and dont judge ppl by their replies sometimes so called noob can post simple yet effective solution... on the other hand.. even pro's make mistakes... and noob will never learn.. if he doesnt post his idea eventhough they might be wrongly coded... but usually after... some pro can/will fix posted code for his idea...😳
It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!