Selasa, 24 Maret 2009
Script timer Session, Automatic Logout
Many things happen if someone has successfully logged in as user, login and of course this is when users will use the services of a website, not due for another, such as the level of bad securities. Always have idle time. Idle here means the user does not do anything at all on the website, the page does not move, do not enter any input on the form, and it does not have any cause a website page terrefresh, in other words the user does not do anything on the website while he visited. Indeed strange that user.
Script timer Session, Automatic Logout
Many things happen if someone has successfully logged in as user, login and of course this is when users will use the services of a website, not due for another, such as the level of bad securities. Always have idle time. Idle here means the user does not do anything at all on the website, the page does not move, do not enter any input on the form, and it does not have any cause a website page terrefresh, in other words the user does not do anything on the website while he visited. Indeed strange that user. : D ~ ~. But things like this can happen if users are cool to visit the other, and forget that he will visit the website before. Of course the situation on the website the user visited previously regarded as the idle condition by website. No matter whatever happens in the previous website. Or other conditions, where a user who has 10 minutes left in the pc to its circumstances forget melogout accounts. Too seriously. Here is the function of the session really needed.
There are two ways to set the session time, the first is a configuration change session timeout in the php.ini, the last way is to use the function time () and variable session that have been registered, in other words this is the last line is to design code that can be set the session time. Akan author does not explain how the first one. But the author will explain is how the second. The author will take an example case, this is to facilitate the logical explanation, and explanation of how work flows from the script that will be made.
Case like this, "When the user has successfully logged in, there will be a session that is used as a benchmark to compare how long the user has been on the website page. When the time () that runs more than the value of session variable that will serve as the benchmark then the user will automatically terlogout ".
The structure, algoritmanya akan like this:
1. Provide a variable x, and now contains the added 30 seconds.
2. Make a variable x as a session, which will membypass valuenya on each page, in other words, the contents of a variable x can be displayed on any page.
3. Compare the present with the value of x is a variable.
4. If the time is now less than the value of variable x, then the user is logged in the circumstances.
5. If the time is now greater than the value of variable x, the condition of the user is logging out.
6. If users do refresh the page, move the page, fill out the form, sessionnya before the time runs out then log on to the next 10 minutes.
Yes, for the algorithm on the author for a 2 function, ie function login_validate () and login_check (). Simply provide the required script:
Index.php file:
The next file that is essentially,
functions.php:
Then admin.php, the line code in admin.php ibaratkan this author as a condition of the admin login has been successful. If more than 30 seconds then the user will be automatically logged out. Value of 30 seconds is taken from the $ timeout variable in the functions.php.
Admin.php file:
Then the login page usernya, login.php: