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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.