html - PHP Error - All Files or Directories created are 0 -
i coding registration script , wanted create folder inside folder called "users". somehow, folder created in root path (where php script located) , files, supposed written inside folder in file called 0. here's code:
if (!isset($_post["method"])){ die("error"); } if (!isset($_post["usernamefld"])){ die("error"); } if (!isset($_post["passwordfld"])){ die("error"); } if ($_post["method"] == "register"){ if (!isset($_post["emailfld"])){ die("error"); } if(is_dir("./users/"+$_post["usernamefld"])){ die("taken"); } mkdir("/users/"+$_post["usernamefld"]); echo "test"; }
the folder "0" empty when created.
as @u_mulder has stated, in php concat strings , variables "." , not "+" symbol. based on that, should particular issue.
if (!isset($_post["method"])){ die("error"); } if (!isset($_post["usernamefld"])){ die("error"); } if (!isset($_post["passwordfld"])){ die("error"); } if ($_post["method"] == "register"){ if (!isset($_post["emailfld"])){ die("error"); } if(is_dir("./users/". $_post["usernamefld"])){ die("taken"); } mkdir("/users/". $_post["usernamefld"]); echo "test"; }
Comments
Post a Comment