Hi, I have the following scenario. But i am not getting any idea how to implement it. please help me . I would be very thankful if anyone can send code samples.
Following is my problem.
I will be having some users who can access my web site. To access my web site they have to pay some money . Based on the money that users paid to me i will allocate a time limit to them (and it will be stoed in DB)to access my web site. Once they exceeds the time limit they should get a alert message saying that your time is over and please recharge your account.
I mean , Suppose a user paid 100Rs to me. Then say i allocated 100minutes to him. So he can access my site for 100 minutes. Once he crosses 100 min i should not allow the user to access my site any more . And i have to display an alert message to the user saying that his time is exceeded.
Also if he logs in and logs out in 20 min (say) , then i have to update the time limit in DB to 80 minutes.
I have to implement this using java,jsp,java script and servlets. So please help me out if you have any ideas.
Hi , I do not have any applets in my application. Is it not possible using JSP , Servlets ? If not possible , Can you please advise me how can i do this using applets. As i am new to these technologies , please help me with code samples.
posted 13 years ago
Well without Applet also it is achievable.
Tell me the business requirements so that I can suggest according to that.
It should be better done on server-side. You can always apply some logic.
Well, i am listing down some steps
- Get the time alloted for that particular user from DB while authenticating user. - Record the current time just after a successful authentication and call it login time - Take difference between the current and login time upon each request and compare that with the time alloted - invalidate the session accordingly and redirect the user to some message page
Are you getting me??
posted 13 years ago
Hi, Following are my business requirements.
1. Initially users pay money to me to access my website. Then i will create a entry in Database for that user. Based on the money he paid to me i will allocate duration to him. Typically my database table looks as follows.
Upon registration administrator populates this table.
2. After payment, he is eligible to access my website. He can logon to my site by entering username and password which has been created at login time.
3. Take the scenario now. Suppose user 'A' has paid 100Rs to me. Then i will register him into the system. Username, Password, Amount, Duration will be populated in the database. Now say following is the entry present in Database.
4. Now user 'A' can log into the system by entering username and password. If he logout the system in 1000000 milli seconds then database has to be updated accordingly. That means DURATION field in the database has to be updated to 5900000 milli seconds. He can come next time and use the remaining time.
5. When user is left with 3 minutes , then he has to be displayed with a alert saying that only 3 minutes left and to recharge again.
6. If he continue to use my website more than 60 minutes without recharging , then he has to be disconnected and should not be allowed to login again until he recharges again.
I am not getting how to proceed. Do we need to access the database indefinitely to get the duration every second? What could be the best way in these kind of scenarios.
Please help me with code samples. Also please let me know if there is any confusion in the requirements.