Jump to content

Archived

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

RTS

Dont allow html and PHP

Recommended Posts

how do I make it so html, and php are not accepted on my upload form?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
[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.

Share this post


Link to post
Share on other sites

×

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.