Home » Developer & Programmer » JDeveloper, Java & XML » How to logoff user automatically when his time finishes?
How to logoff user automatically when his time finishes? [message #162415] Fri, 10 March 2006 02:24
sreek_s
Messages: 45
Registered: May 2005
Location: Andaman Nikobar
Member
Hi,
I am developing a web application. 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.


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.

LOGIN_TABLE:
-----------
USER_NAME VARCHAR2(100)
PASSWORD VARCHAR2(100)
AMOUNT NUMBER(10)
DURATION NUMBER(10)

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.

USER_NAME 'A'
PASSWORD '****'
AMOUNT 100
DURATION 6000000 milli seconds i,e (60 minutes)

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.

Regds,
Sreek
Previous Topic: invalid user.table.column when run Jdeveloper
Next Topic: JDeveloper not starting
Goto Forum:
  


Current Time: Fri Nov 22 04:49:43 CST 2024