Jump to content

php ifelse or pregmatch not working


paulonline2501

Recommended Posts

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 by as_bold_as_love
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...