Subdomain maker and file writer

10 posts Page 1 of 1
Contributors
User avatar
alex6848
VIP - Donator
VIP - Donator
Posts: 201
Joined: Sat Jan 16, 2010 10:26 pm

Subdomain maker and file writer
alex6848
Does anybody know how to let a user input a word in a text bx which the by flcking submit would create a subdomain with that name in the .htAccess and then write a few files to that folder.

Thanks Alex
Free Facebook Page Likes - http://fbliker.tk/?ref=gillis
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Subdomain maker and file writer
mandai
Its definitely possible but if you want a script to do it then it depends on which web/dns servers you are using.
User avatar
Zulf
Serious Programmer
Serious Programmer
Posts: 441
Joined: Fri Jun 11, 2010 7:46 am

Re: Subdomain maker and file writer
Zulf
Yeh, pretty much anything is possible, you just have to know how to do it.
Image
User avatar
rocky4126
VIP - Donator
VIP - Donator
Posts: 258
Joined: Mon Nov 16, 2009 7:39 pm

make sure your host allows you to do it first. Because if you are violating the ToS then you could well be suspended/banned. PS: Who are you with?
Image
User avatar
alex6848
VIP - Donator
VIP - Donator
Posts: 201
Joined: Sat Jan 16, 2010 10:26 pm

thanks for the replies!
I am with 000webhost.
and i would need the script to write files to a new folder then but that folder in the .htacsess to make it a subdomain.

PS does anybody know how to make a quota limiter?
Free Facebook Page Likes - http://fbliker.tk/?ref=gillis
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Subdomain maker and file writer
mandai
Writing the files should be the easy part.
Code: Select all
<?php
$folder = "test";
if (!file_exists($folder))
	mkdir($folder);

$file = $folder . "\.htaccess";

$text = "allow from all";

 $fw = fopen($file, "w") or die("Could not open or create $file.");
 fwrite($fw, $text) or die("Could not write to $file.");
 fclose($fw);
?>
If you have a wildcard domain with 000webhost then you can tweak this script to make a folder from getenv("HTTP_HOST").

Edit: I think you might need to put in a few security checks before you decide to use this on your site.
User avatar
alex6848
VIP - Donator
VIP - Donator
Posts: 201
Joined: Sat Jan 16, 2010 10:26 pm

Ya probebly a bad idea 000 will probebly shut down my site if I did this.
Free Facebook Page Likes - http://fbliker.tk/?ref=gillis
User avatar
rocky4126
VIP - Donator
VIP - Donator
Posts: 258
Joined: Mon Nov 16, 2009 7:39 pm

lol 000webhost won't allow this... Just use http://www.x10hosting.com and buy a paid domain... I will just check with the owner that this is allowed though first.
Image
User avatar
alex6848
VIP - Donator
VIP - Donator
Posts: 201
Joined: Sat Jan 16, 2010 10:26 pm

how could i do this I have an account
Free Facebook Page Likes - http://fbliker.tk/?ref=gillis
User avatar
rocky4126
VIP - Donator
VIP - Donator
Posts: 258
Joined: Mon Nov 16, 2009 7:39 pm

x10 hosting allows this sorta stuff.
Image
10 posts Page 1 of 1
Return to “Help & Support”