Jump to content

Dont allow html and PHP


RTS

Recommended Posts

Im not very good with upload script but it would look something like

$filename_array = explode(".", $filename);
$c = count($filename_array);
if($filename_array[$c] == "php") { die("error message"); }

Oh... hostfreak posted while i was typing this hmmm... Im not sure if RTS meant a script to upload files or submit data...
[quote author=corbin link=topic=104840.msg418403#msg418403 date=1155968836]
Im not very good with upload script but it would look something like

$filename_array = explode(".", $filename);
$c = count($filename_array);
if($filename_array[$c] == "php") { die("error message"); }

Oh... hostfreak posted while i was typing this hmmm... Im not sure if RTS meant a script to upload files or submit data...
[/quote]

Infact it should be: [code]$filename_array = explode(".", $filename);
$c = count($filename_array)-1;
if($filename_array[$c] == "php") { die("error message"); }[/code] since the keys start with 0 and not 1. This will only check the extension. If you wan't to check if it actually contains PHP codes, then it would be more difficult.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.