RTS Posted August 19, 2006 Share Posted August 19, 2006 how do I make it so html, and php are not accepted on my upload form? Link to comment https://forums.phpfreaks.com/topic/18016-dont-allow-html-and-php/ Share on other sites More sharing options...
corbin Posted August 19, 2006 Share Posted August 19, 2006 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 https://forums.phpfreaks.com/topic/18016-dont-allow-html-and-php/#findComment-77137 Share on other sites More sharing options...
hostfreak Posted August 19, 2006 Share Posted August 19, 2006 Oh, crap... Sorry I mis-read the OP's question. Removed the post. Link to comment https://forums.phpfreaks.com/topic/18016-dont-allow-html-and-php/#findComment-77139 Share on other sites More sharing options...
Daniel0 Posted August 19, 2006 Share Posted August 19, 2006 [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 https://forums.phpfreaks.com/topic/18016-dont-allow-html-and-php/#findComment-77157 Share on other sites More sharing options...
corbin Posted August 19, 2006 Share Posted August 19, 2006 Hehe yeah forgot it starts with 0... Link to comment https://forums.phpfreaks.com/topic/18016-dont-allow-html-and-php/#findComment-77158 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.