开发者

How to create an account system like 37Signals?

How can I create an account system like 37signals, which is:

Each user gets an independent URL. user.domain.com Each user gets to add a certain amount of users:

And when they allocate resources for accounts开发者_如何学Go, do you think its all in one database or they create a separate database for each account?


you could use one of two methods for the user sub domains - you could either use an HTAccess rewrite rule to divert the subdomain back into a .php?sub=user page that loads their account - htaccess redirect subdomain to domain or (providing you are on CPanel Hosting) there are examples around of how to automatically create and point sub domains using just PHP and cURL - http://www.zubrag.com/scripts/cpanel-subdomains-creator.php

Although I am unsure of how the 37signals DB works I doubt that they create a new DB for every user - more like they simply link multiple tables on indexes. If the fields are not going to be previously known then you use a simple EAV scheme to allow users to define their own data fields.


I know that with nginx, you can set a default 'server' (All subdomains redirect to one document root if they don't actually exist). Then, it's up to the PHP script to parse the host header. With this kind of virtual host setup, you would use the databases already in existence.

NginX Server and Server_Name Reference

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜