Forum Moderators: coopster

Message Too Old, No Replies

How to code script to control DNS.

         

toeh

5:27 pm on Nov 18, 2007 (gmt 0)

10+ Year Member



I have seen free forum hosting like freeforums.org creates subdomain with register form on website.

I would like to generate subdomain using data from register form on my website (generate subdomain as soon as user complete registration form, no control panel login ) .

Someone tell me that I need shell scripting to control DNS.

How to do something like that?
or
Any exsample?

Thank you.

jdMorgan

6:07 pm on Nov 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You really don't need to control DNS. Just set up your DNS to point *.your-domain.com to your server.
When someone creates an account, all your script needs to do is to create a subdirectory to put their files in.
Then use mod_rewrite on Apache or ISAPI Rewrite on IIS to rewrite the subdomain requests to the subdirectory.

Be aware that your script must check the created account name to be sure that all characters are valid for use in a subdomain. I'd suggest allowing only letters, numbers, and hyphens in account names. The first character *must* be a letter, and the last character cannot be a hyphen.

Since hostnames are case-insensitive, while some filesystems are not, I'd suggest restricting account names to lowercase-only.

And of course, you must check to be sure that the requested account name is not "www" and that it does not already exist.

See RFC 2396 [faqs.org] for more information on valid HTTP URLs.

Jim

toeh

12:59 pm on Nov 19, 2007 (gmt 0)

10+ Year Member



Thank you very much.