Help - Search - Members - Calendar
Full Version: multiple users, 1 domain
The Planet Forums > Control Panels > cPanel/WHM
tgavin
There's usually a difference between what I want to do, and what I can do.

The gist:
I am developing a web-based application that uses php and mysql. I want to be able to offer 30 day trials. I have one domain that I want to use for this. Each instance of the app requires it's own mysql db.

What I want to do:
1. User signs up at form
2. An account is created for the user
3. A mysql db is created and populated
4. The app is copied from a skeleton dir
5. User is able to login to their admin cp and have at it

I can write the scripts that handle the installations, copying, etc. I actually have something right now that does all of the above EXCEPT that instead of creating a user account, it creates a dir in the public_html dir of the domain. This works, but it's not as secure as each user having their own account.

Is there any way that I can write my own php script, or have modernbill (or similar) create an account for each user, all under one domain? Perhaps, user.mydomain.com?
James Jhurani
QUOTE (tgavin @ Jun 14 2007, 10:35 PM) *
There's usually a difference between what I want to do, and what I can do.

The gist:
I am developing a web-based application that uses php and mysql. I want to be able to offer 30 day trials. I have one domain that I want to use for this. Each instance of the app requires it's own mysql db.

What I want to do:
1. User signs up at form
2. An account is created for the user
3. A mysql db is created and populated
4. The app is copied from a skeleton dir
5. User is able to login to their admin cp and have at it

I can write the scripts that handle the installations, copying, etc. I actually have something right now that does all of the above EXCEPT that instead of creating a user account, it creates a dir in the public_html dir of the domain. This works, but it's not as secure as each user having their own account.

Is there any way that I can write my own php script, or have modernbill (or similar) create an account for each user, all under one domain? Perhaps, user.mydomain.com?



You could set it up as virtualhosts in your httpd.conf, to give each user user.domain.com. The only downfall is every time someone signs up apache would have to be restarted to allow the new virtualhost data to take effect.

If your php can run exec, you can simply run /usr/sbin/adduser, but that would require some crafty work since only root can add users, and I believe the exec() function is disabled by default. But ultimately this method would have to restart apache as well to add the virtualhost info for the new account.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.