Hello, I was wondering if this could be done. Say I have a url http://www.thewebsitedomnamehere.com/file.php?id= then the id value could be any value 1, 2, 3, 4 etc... Is there anyway I could automatically create a folder (named with that id value) with 777 chmod permissions when the page loads, and if the folder already exists then do nothing? ie a folder named '1' for example Thanks
<?php mkdir($_GET['id'], 0777); ?> Code (markup): If you want to only allow numbers to create a dir use: <?php if (is_numeric($_GET['id'])) mkdir($_GET[id], 0777); ?> Code (markup): I hope that helps!
<?php mkdir($_GET['id'], 0777); ?> Code (markup): Should already set the permissions. Also, it should be 0777 not 077
Don`t forget to run sanity checks on $_GET['id'], you don`t want to end up trying to create a folder called /etc/passwd or something