Jump to content


Photo

Dont allow html and PHP


  • Please log in to reply
4 replies to this topic

#1 RTS

RTS
  • Members
  • PipPipPip
  • Advanced Member
  • 66 posts

Posted 19 August 2006 - 06:18 AM

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

#2 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 19 August 2006 - 06:27 AM

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...
Why doesn't anyone ever say hi, hey, or whad up world?

#3 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 19 August 2006 - 06:29 AM

Oh, crap... Sorry I mis-read the OP's question. Removed the post.

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 19 August 2006 - 08:27 AM

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


Infact it should be:
$filename_array = explode(".", $filename);
$c = count($filename_array)-1;
if($filename_array[$c] == "php") { die("error message"); }
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.

#5 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 19 August 2006 - 08:30 AM

Hehe yeah forgot it starts with 0...
Why doesn't anyone ever say hi, hey, or whad up world?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users