CodeIgniter Forums

Full Version: How to...Free trial...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am working on an application(Warehouse/Inventory management) that I want to market as a SAAS(Software as a service) application.

I am an old school programmer with reasonable skills(OPP, C# VB, etc...), but my only exposure to PHP has been through Codeigniter(I love it!)

I would like to allow potential client, when visiting my website to be able to "sign up" for a free trial(30 days) so that they can try the product out.

However, I have no clue how to set that up. I am thinking of sub domains like newclient.myWebsite.com

Obviously each client would need his own database, but aside from that I am open to any idea. Has anyone here did it before and kindly point me to the right direction?
personally i would make a column on the database `disabled` and set it be default to be 1 or true (probably ENUM() with true, false, trial). Because i like working with MySQL Routines (procedures) i would make it so every 1 hour updates all the rows (users) where the `disabled` is trial and the date joined (datetime) is greater than 30 days. Not sure if this is the best way.
Free trials are simple to implement.

You insert into the users table their join date. You log them in and have a session with that same join date. Extend the controller to see whether the date is greater than 30 days. If not, proceed as normal. If so, then display a trial expired page.

I wouldn't setup subdomains, keep it simple like http://www.domain.com/clientA for example.

Each client doesnt need its own database. You can have 1 database, with a clients table and then have a client_id column in the other tables.

This is pretty simple stuff.
Thanks to both for your replies.

I was looking for something more in the line of what no1youknowz answered.

I am not sure that I like the fact that all users will use the same database. But I guess it is fine for the trial period, and if the client wants to continue, I can always transfer him to his own installation or something.

Thanks.

P.S. If anyone else has other ideas, I am opened to them, but not withstanding any other I will go with that one.
Really if you do custom domains per user. you could also just have logic built in. So you have a row with an expire_date and when that subdomain is accessed you just compare today's date to the expire date. Smile Just another option. Smile I know it is simular to above, but you could set it up so a user can register, but they have control over when to start the trail period. In this row you could technically include say a dbname. so that the application only relies on that row to gather information for the sub website. in your routine you create the database tables needed, and then use a connect to the dbname. Which you could auto generate when the user starts the trail.

I have done this, but not with multiple db's. But I was planning on a doing an application using multiple dbs later as when I did the first one it was really a learning process that I did about 4 years ago. To extract data and write a lot of logic so only that user can only access they're data and not someone elses. It does add a lot of complexity to the logic. Where if you do a db per user you have less logic required in the user access rights side of things. Also from a performance stand point multiple db's is the best way to go as well. especially if you have a lot of data.
I would also extend the idea of the expire date to go beyond trials. If someone has paid for a year of service, the expire date would be set to one year after their payment (or one year beyond the existing expire date, if set and that behavior is preferred).

Additionally, a given user might want multiple domains, so the date should be tied to the domain, rather than the user.

As for the database setup for one database vs. multiple databases, I really just think that data for the domains setup for users should be separate from your site's user/domain information. A lot of this depends on what you're actually allowing them to do in the database, though.
(10-31-2014, 07:53 AM)LeMec Wrote: [ -> ]I am not sure that I like the fact that all users will use the same database. But I guess it is fine for the trial period, and if the client wants to continue, I can always transfer him to his own installation or something.

I guess it depends on your sales model.  Are you going to be selling this to a few large companies, maybe installing it on their servers?  In that case then maybe multiple databases makes sense.  Are you going to be selling (hopefully) to many different users/companies?  If so, you are probably going to want one database.