Domcsore Posted March 23, 2010 Share Posted March 23, 2010 What I am trying to do is include all file in a folder. This works fine, however, it also tries to include a whole load of other folder? and I cant stop it. Basically here it is: public function engineload(){ if ($handle = opendir('classes/subclasses')) { while (false !== ($file = readdir($handle))) { include('classes/subclasses/'.$file); } } closedir($handle); } **EDIT** Sorry, I fixed this.: public function engineload(){ if ($handle = opendir('classes/subclasses')) { while (false !== ($file = readdir($handle))) { if($file == "."){ return false; }elseif($file == ".."){ return false; }else{ include('classes/subclasses/'.$file); } } } closedir($handle); } Link to comment https://forums.phpfreaks.com/topic/196245-having-a-little-trouble/ Share on other sites More sharing options...
andrewgauger Posted March 23, 2010 Share Posted March 23, 2010 Just remeber to look into the PHP include vulnerability. Make sure the variable is not accessible through your _GET and _POST globals otherwise someone could include malicious code on your site. http://en.wikipedia.org/wiki/Include_vulnerability Link to comment https://forums.phpfreaks.com/topic/196245-having-a-little-trouble/#findComment-1030605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.