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:
Login Page ...!</ title>
<br />
<br /><form action="index.php" method="post">
<br /><table bcolor="#DFDFDF" border="0"> <tbody> <tr> <td> username </ td> <td> <input name="username" type="text"> </ td> </ tr>
<br /><tr> <td> password </ td> <td> <input name="password" type="password"> </ td> </ tr>
<br /><tr> <td>
<br /></ td> <td> <input name="submit" value="submit" type="submit"> </ td> </ tr>
<br /></ tbody> </ table>
<br /></ form> </ span> <span class="fullpost"> </ span> <span class="fullpost"> </ span> <span class="fullpost">
<br />
<br />
<br />
<br />Clearly visible on the line to 4 above, the login page has a page action, go to index.php, which then generate 2 POST variable, ie $ _POST [ 'username'] and $ _POST [ 'password']. This is the second variable, which was then checked on the page index.php.
<br />
<br />And the last is logout.php:
<br />
<br />
<br />
<br />
<br />How it works on the source code is quite simple, see index.php line code,
<br />
<br />......
<br />if (($ _POST [ 'username'] == 'admin') & & ($ _POST [ 'password'] == 'admin'))
<br />(
<br />$ _SESSION [ 'User'] = $ _POST [ 'username'];
<br />login_validate ();
<br />header ( "location: admin.php");
<br />)
<br />
<br />else if (empty ($ _POST [ 'username']) & & empty ($ _POST [ 'password']))
<br />(
<br />header ( "location: login.php");
<br />)
<br />....
<br />
<br />Explanation is as follows, If a user enter a username and password that match (in this case a username and password is admin) then the user will be given a session variable, ie $ _SESSION [ 'user'], and will be added a new variable that this variable will function as a timer, ie,
<br />
<br />$ timeout = 30;
<br />
<br />Variable is located in login_validate function () in functions.php script. While still in the login_validate, jump to the code underneath the line that is:
<br />
<br />$ _SESSION [ "Expires_by"] = time () + $ timeout;
<br />
<br />Is the actual location of the timer, intensity of the session is able to value passing though the page is different. Details, $ _SESSION [ "expires_by"] take the value from the time when user login the first time () in 30 seconds with the added kedepannya, that is, the contents of the variable $ timeout.
<br />
<br />Well, from there, to see which have the function below it, in functions.php:
<br />
<br />...
<br />login_check function () (
<br /> $ exp_time = $ _SESSION [ "expires_by"];
<br /> if (time () <$ exp_time) (login_validate (); return true;) else (unset ($ _SESSION [ "expires_by"]); return false;)) .... Yes, see the line: $ exp_time = $ _SESSION [ "expires_by"]; Varibale $ exp_time that have a value of $ _SESSION [ "expires_by"], author kejelesannya To give an example like this, if the user logged in at the time of 5 hours, then $ _SESSION [ "expires_by"] contains 5 hours, 0 minutes, and seconds to 30. And naturally also note that the time will certainly continue to grow. But because it is in the function, variable $ _SESSION [ "expires_by"] this will not be increased, although the time () berlanjutnya continue. Jump to the next line: if (time () <$ exp_time) (login_validate (); return true; In line sederhananya is, if the time is now running small value from the value in the $ _SESSION [ "expires_by"], then add 30 seconds more, and if at the time time () equal to the value $ _SESSION [ "expires_by"] then the user will be automatically logged out more ... ... else (unset ($ _SESSION [ "expires_by"]); return false;) ... If the time is now running more than the value in the $ _SESSION [ "expires_by"], then do the logout. </span></p>
<div style='clear: both;'></div>
</div>
<div class='itemhead'>
<p class='post-footer-line post-footer-line-1'>
<span class='post-backlinks post-comment-link'>
</span>
<span class='post-icons'>
<span class='item-control blog-admin pid-183722760'>
<a href='https://www.blogger.com/post-edit.g?blogID=1142436348637559032&postID=4286794423428810132&from=pencil' title='Edit Entri'>
<span class='quick-edit-icon'> </span>
</a>
</span>
</span>
</p>
<p class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
Label:
<a href='https://nipenkku.blogspot.com/search/label/Script%20Organizer%20Session%20Time' rel='tag'>Script Organizer Session Time</a>
</span>
</p>
<p class='post-footer-line post-footer-line-3'></p>
</div></div>
<div class='comments' id='comments'>
<a name='comments'></a>
<h4>
0
komentar:
</h4>
<dl id='comments-block'>
</dl>
<P class='comment-footer'>
<div class='comment-form'>
<a name='comment-form'></a>
<h4 id='comment-post-message'>Posting Komentar</h4>
<p>
</p>
<a href='https://www.blogger.com/comment/frame/1142436348637559032?po=4286794423428810132&hl=id&saa=84935' id='comment-editor-src'></a>
<iframe allowtransparency='true' class='blogger-iframe-colorize blogger-comment-from-post' frameborder='0' height='410px' id='comment-editor' name='comment-editor' src='' width='100%'></iframe>
<script src='https://www.blogger.com/static/v1/jsbin/681870030-comment_from_post_iframe.js' type='text/javascript'></script>
<script type='text/javascript'>
BLOG_CMT_createIframe('https://www.blogger.com/rpc_relay.html');
</script>
</div>
</P>
<div id='backlinks-container'>
<div id='Blog1_backlinks-container'>
</div>
</div>
</div>
<!--Can't find substitution for tag [adEnd]-->
</div>
<div class='blog-pager' id='blog-pager'>
<span id='blog-pager-newer-link'>
<a class='blog-pager-newer-link' href='https://nipenkku.blogspot.com/2009/03/internet-hemat-dengan-wajan-dan-panci.html' id='Blog1_blog-pager-newer-link' title='Posting Lebih Baru'>Posting Lebih Baru</a>
</span>
<span id='blog-pager-older-link'>
<a class='blog-pager-older-link' href='https://nipenkku.blogspot.com/2009/03/membuat-password-generator-alasan.html' id='Blog1_blog-pager-older-link' title='Posting Lama'>Posting Lama</a>
</span>
<a class='home-link' href='https://nipenkku.blogspot.com/'>Beranda</a>
</div>
<div class='clear'></div>
<div class='post-feeds'>
<div class='feed-links'>
Subscribe to:
<a class='feed-link' href='https://nipenkku.blogspot.com/feeds/4286794423428810132/comments/default' target='_blank' type='application/atom+xml'>Posting Komentar (Atom)</a>
</div>
</div>
</div></div>
</div>
<!-- sidebar right -->
<DIV id='sidebarright'>
<div class='sidebar section' id='sidebar'><div class='widget HTML' data-version='1' id='HTML2'>
<h2 class='title'>C A L E N D A R</h2>
<div class='widget-content'>
<script src="http://www.gmodules.com/ig/ifr?url=http://artistcampaign.googlepages.com/tezuka_calendar.xml&synd=open&w=150&h=55&title=Mushi-Mushi&lang=all&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>
</div>
<div class='clear'></div>
</div><div class='widget HTML' data-version='1' id='HTML1'>
<h2 class='title'>C L O C K</h2>
<div class='widget-content'>
<script src="http://www.clocklink.com/embed.js"></script><script language="JavaScript" type="text/javascript">obj=new Object;obj.clockfile="5010-blue.swf";obj.TimeZone="JOG";obj.width=180;obj.height=50;obj.wmode="transparent";showClock(obj);</script>
</div>
<div class='clear'></div>
</div></div>
<div class='diana'>
<p>
By :
<br/>
<a href='http://www.skincorner.com' title='SkinCorner'><img alt='Free Blog Templates' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF1J3Fmb252-CMmBS4anXOptXu7Jq7qE4tPTKMR6oeL_2ukrJ5Xa_iQA9qyc4EQh7LlxwXpOdwjX6BPAp_1_a_wvLTcnCt_ZnUumJjTRnqL09nl1EDt6asPJJlyVnAogKSc1eeW8Fg5lU/s1600/sclogo.jpg' style='border: 0;'/></a>
</p>
</div>
<!-- end credits -->
</DIV>
<!-- bagian antara-->
<div class='clear'></div>
</div>
<div id='footer-wrapper'>
</div><!-- end footer-wrapper -->
<div id='lower-footer'>
<div class='footer no-items section' id='footer'></div>
<div class='credits'>
<!-- Appreciate me by NOT REMOVE OR CHANGE MY LINK.Thank You. Please DO NOT REMOVE MY LINKS! -->
<a href='https://nipenkku.blogspot.com/'>All About IT ( Information Technology )</a> | Design by <a href='http://skincorner.com'> SkinCorner</a>
</div></div>
</div></div>
<script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/3551516202-widgets.js"></script>
<script type='text/javascript'>
window['__wavt'] = 'AOuZoY6Sg_fjBzNOg4pSlEyDO2I3reZEcg:1744128372574';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d1142436348637559032','//nipenkku.blogspot.com/2009/03/script-pengatur-waktu-session-logout.html','1142436348637559032');
_WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '1142436348637559032', 'title': 'All About IT ( Information Technology )', 'url': 'https://nipenkku.blogspot.com/2009/03/script-pengatur-waktu-session-logout.html', 'canonicalUrl': 'http://nipenkku.blogspot.com/2009/03/script-pengatur-waktu-session-logout.html', 'homepageUrl': 'https://nipenkku.blogspot.com/', 'searchUrl': 'https://nipenkku.blogspot.com/search', 'canonicalHomepageUrl': 'http://nipenkku.blogspot.com/', 'blogspotFaviconUrl': 'https://nipenkku.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'id', 'localeUnderscoreDelimited': 'id', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22All About IT ( Information Technology ) - Atom\x22 href\x3d\x22https://nipenkku.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22All About IT ( Information Technology ) - RSS\x22 href\x3d\x22https://nipenkku.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22All About IT ( Information Technology ) - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/1142436348637559032/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22All About IT ( Information Technology ) - Atom\x22 href\x3d\x22https://nipenkku.blogspot.com/feeds/4286794423428810132/comments/default\x22 /\x3e\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/51ad58472e92bd27', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Dapatkan link', 'key': 'link', 'shareMessage': 'Dapatkan link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Bagikan ke Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Bagikan ke X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Bagikan ke Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27id\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Baca selengkapnya', 'pageType': 'item', 'postId': '4286794423428810132', 'pageName': 'Pegaturan Session Time and Automatic Logout', 'pageTitle': 'All About IT ( Information Technology ): Pegaturan Session Time and Automatic Logout'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Tautan disalin ke papan klip!', 'ok': 'Oke', 'postLink': 'Tautan Pos'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Khusus', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'Pegaturan Session Time and Automatic Logout', 'description': 'Script timer Session, Automatic Logout \r \r Many things happen if someone has successfully logged in as user, login and of course this is wh...', 'url': 'https://nipenkku.blogspot.com/2009/03/script-pengatur-waktu-session-logout.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 4286794423428810132}}]);
_WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', document.getElementById('Navbar1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_LabelView', new _WidgetInfo('Label2', 'sidebar-left', document.getElementById('Label2'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-left', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Memuat\x26hellip;'}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_ProfileView', new _WidgetInfo('Profile1', 'sidebar-left', document.getElementById('Profile1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/549359800-lbx.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/3681588378-lightbox_bundle.css'}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'sidebar', document.getElementById('HTML2'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML1', 'sidebar', document.getElementById('HTML1'), {}, 'displayModeFull'));
</script>
</body>
</html>