paulonline2501 Posted September 3, 2013 Share Posted September 3, 2013 (edited) hi everyone, im having a problem spotting whats wrong with this code. what im doing is checking some input from a user of type 'folder'. if its got slashes on the front i remove. if its got slashes on the end i remove. and add one slash. it works up to here. then i check to see if the actually input a value for folder. they dont have to. in this case the value will just be '/'. as i added the slash eailier. if i leave folder blank this works too. if i input something i get a fail. i dont beleive the pregmatch is failing as i've used the same pregmatch on other types of variables. ......im stomped??????? code below: case "folder":$clean_folder_step01 = htmlentities($thisValue, ENT_QUOTES); $clean_folder_step02 = ltrim($clean_folder_step01, "/");$clean_folder_step03 = rtrim($clean_folder_step02, "/")."/";if($clean_folder_step03=='/'){$GLOBALS['totally_clean_folder'] = '';}elseif(preg_match("/^[a-zdws-/]{1,90}$/i",$clean_hostDir_step03)) {$GLOBALS['totally_clean_folder'] = $clean_folder_step03;}else{//otherwise add error details$GLOBALS['error']++;$GLOBALS['errmsg'] .= 'Invalid folder. ';}break; Edited September 3, 2013 by as_bold_as_love Link to comment Share on other sites More sharing options...
paulonline2501 Posted September 3, 2013 Author Share Posted September 3, 2013 sorry!!! i spotted the problem: my elseif is referencing the wrong variable: clean_hostDir_step03 it should be $clean_folder_step03 opps!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now