Ok for a file editor thing i got i have it get the location of the file im editing/viewing vie get file so it unsafe as could potentionally view and edit any file on system. i have a defined thing which has the allowed path so like for example on my testing server thats M:/server/xampp/htdocs/calm/ i have this defined and is PHP_FILE_TREE_PATH i made a really bad and sleepy attempt with this :P PHP:---------$file_path = "/".PHP_FILE_TREE_PATH."^/";if(preg_match($file_path, $file_edit, $matches)){if($matches > 1){readfile($file_edit);}}else{ echo 'Hack attempt detected'; }} #edit file_edit isset--------- So basically my idea being i want to check that the first part of the path matched the allowed, which mean sthey are only accessing a file above the allowed dir Got me? So how do i do this?
More...