Welcome Guest, Not a member yet? Register   Sign In
Software Design Problem: VPN Accounts
#1

[eluser]parham90[/eluser]
Hi there,

My client has requested me to make him a website through which people could sign up for a VPN account, choose a service they want to buy (E.G. a monthly service for 30 days and for $30, etc), enter their bank payment information, and he could approve the information, causing their service to be active since that moment. However, no matter how I think, I haven't been able to figure out any solutions for implementing parts of this system.

Since he wants to add/remove/edit current available VPN services and their prices and the number of days each of them would be active for, I thought, well, I could put the services in one table (containing id, name, price, and days (I.E. the days this service would be active for)), and then put the approved ones in the requests table (containing service_id, user_id, and approval_date). the approval_date would be the date the service has been approved, and to figure out the service remaining time (he needs it to be displayed to the user), I would just deduct the approval_date from the current date, and deduct the result from the services.days. In other words:

$remaining_days = $services->days - ($todays_date - $requests->approval_date)

All fine so far. However, the user can, at any time, login and purchase another service to be appended to his current one. In other words, if he has a service that lasts for 30 days, he can buy another that lasts 30 days too, effectively making it 60 days for him. Now the problem is evident; where does the service that is newly bought go? Would I need a cron job to swap values around every day? Since I do not like this nasty cron-oriented approach, I thought of another thing.

I thought I could just store the days that he has paid for (E.G. 30), and every time he logs in, I'd do the same I did before; get the approval date of his request, deduct it from today, and then deduct the result from the number of days in the database. When he wants to purchase another service to be added to his current one, sure, I'd just increase the users.days (the days he has paid for) by the services.days value of the new service. And the flaw in this strategy is also evident now; what if the admin wants to have, say, different names but the same days? Or different prices and the same days?

So, I'm stuck. I would really appreciate it a lot if you could help a beginning programmer relieve his headaches. Smile

Thanks a lot, for the help offered in the past. I'm sorry if I have forgotten to say "thank you" at times; if this has happened, it was because I was too happy about my problem being solved that I just pressed alt+f4 and began coding. *smiles*


Messages In This Thread
Software Design Problem: VPN Accounts - by El Forum - 08-04-2010, 05:32 AM
Software Design Problem: VPN Accounts - by El Forum - 08-04-2010, 06:07 AM
Software Design Problem: VPN Accounts - by El Forum - 08-04-2010, 06:26 AM
Software Design Problem: VPN Accounts - by El Forum - 08-04-2010, 06:43 AM
Software Design Problem: VPN Accounts - by El Forum - 08-04-2010, 07:02 AM
Software Design Problem: VPN Accounts - by El Forum - 08-04-2010, 07:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB