tomfmason Posted August 7, 2006 Share Posted August 7, 2006 I have a script that is a work in progress.This script is for when I purchase a new domain or add a subdomain. So far I the following functions working [b]Functions[/b][list][*]updates ISC Bind's named.conf and creates a zone file[*]reloads bind[*]updates apache's httpd.conf and if need be sets some rewrite rules[*]creates a directory for the new domain[*]places a temporary index.php file in the new directory[/list]Well now what I am wanting to do is when I add a new domain or sub domain I want to create two three directorys. Frist is the man directory then two subdirectorys say test.mysite.com and two sub dirs like private and public Any suggestions on how to do this would be great. here is the createDir function.[code=php:0]function createDir() { global $domain; global $sub_domain; if (!$sub_domain) { $NewDir = mkdir("C:/home/admin/$domain"); if (!$NewDir) { $result = "Unable to create the directory. Ether the permissions are not set or the directory already exits"; } }else{ $NewDir = mkdir("C:/home/admin/$domain/$sub_domain"); if (!$NewDir) { $result = "Unable to create the directory. Ether the permissions are not set or the directory already exits"; } } return $result;}[/code]Now you can see my simple function at the same time I create the domain or sub domain I want to creat two other directorys. Should I just repeat the mkdir three times or is there a better way of doing this?Any suggestions would be great.Thanks,Tom Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 7, 2006 Author Share Posted August 7, 2006 here is the fix[code=php:0]function createDir() { global $domain; global $sub_domain; if (!$sub_domain) { $NewDir = mkdir("C:/home/admin/$domain"); if (!$NewDir) { $result = "false"; }else{ $private = mkdir("C:/home/admin/$domain/private"); $public = mkdir("C:/home/admin/$domain/public"); $subs = mkdir("C:/home/admin/$domain/sub_domains"); if ((!$private) || (!$public) || (!$subs)) { $result = "false"; }else{ $result = "true"; } } }else{ $NewDir = mkdir("C:/home/admin/$domain/sub_domains/$sub_domain"); if (!$NewDir) { $result = "false"; }else{ $private = mkdir("C:/home/admin/$domain/sub_domains/$sub_domain/private"); $public = mkdir("C:/home/admin/$domain/sub_domains/$sub_domain/public"); if ((!$private) || (!$public)) { $result = "false"; }else{ $result = "true"; } } } return $result;}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.