Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2004, 04:08 PM
WebProWorld Member
 

Join Date: Apr 2004
Location: East Peoria
Posts: 36
tfinch RepRank 0
Default script for timed website

Hello, I really enjoy reading the messages posted here. I am wondering if someone can help me. I have a password protect area on a web site (created with Front Page) and I want this site to close all windows after a certain amount of time. I now have a redirect after 5 minutes but someone can easily hit the back button and get right back to the "secured" area.
What I want to do is close the site after so much inactivity... like 2 minutes. But I can't find a script for that. I think closing the window will work just as well but the browser always asks if I want to close using a javascript (window.close). Any assistance is much appreciated.
Reply With Quote
  #2 (permalink)  
Old 04-07-2004, 06:51 AM
sijpie's Avatar
WebProWorld Pro
 

Join Date: Sep 2003
Location: Scotland
Posts: 108
sijpie RepRank 0
Default

If you use asp or php, then you can access the server session. On one of my sites I login, and I set a session variable. The server will time out the session, and delete the set variable after a certain amount of time (default is usually between 7-10 minutes) which you can set.

Note though that if you set it short (2 min) there is a penalty for any user on the site, as after two minutes, a new connection needs to be made to the site, costing some traffic and a short delay, nothing serious though.

The only other not using php or asp would be thorugh javascript set cookies, where you can read the time the cookie was updated, but I am not sure if that is an elegant method either. And I find it very hard to work with cookies...
__________________
Jaap

PalmVenue
Broekhuizen Paintings
MacSijp

You've done it all
You've broken every code (Steve Harley)
Reply With Quote
  #3 (permalink)  
Old 04-07-2004, 05:33 PM
swstyles's Avatar
WebProWorld Pro
 

Join Date: Aug 2003
Location: Phoenix, AZ
Posts: 167
swstyles RepRank 0
Default

I have been asked this question before.
bank of america uses a javascript timer. I you stay on a page longer than 10 minutes, you get a javascript pop message that asks you if you want to continue your session. If you don't reply within a certain time, like 1 minute, then you are redirected to a page that kills the session and logs you out.

Very simple.
__________________
Daniel M: South West Styles/STEELid
daniel@steelid.com
http://www.steelid.com
http://www.thephototool.com
Reply With Quote
  #4 (permalink)  
Old 04-08-2004, 04:56 PM
Nargule's Avatar
WebProWorld Member
 

Join Date: Nov 2003
Location: Gainesville, FL, USA, Earth, MilkyWay
Posts: 84
Nargule RepRank 0
Default

There are lots of ways to do this with server side scripting, but I am assuming you want a client side solution. I will mention that I am not sure how Frontpage password protection works.

When someone accesses your password protected pages, set a cookie with a time of 120 seconds. Make the cookie renew everytime the page is reloaded within the 120 seconds. Put a meta refresh tag on the page to redirect in 120 seconds. Write some JavaScript on the secure pages that redirects to a "Session Timed Out" page if the cookie is expired.
__________________
Tom Corwine

Please review my site at http://www.santaslane.com?source=WebPro
and be sure to check out http://www.corwine.tv <--- It's fixed now.
Reply With Quote
  #5 (permalink)  
Old 06-22-2004, 02:25 AM
WebProWorld New Member
 

Join Date: Jun 2004
Posts: 1
joshnabbott RepRank 0
Default Try this code

If you just want a window that will close itself after a set amount of time, place this code someplace in the <head></head> tags:

<script>
var closeAfter = 300000;
t = null;
function closeWin(){
t = setTimeout("self.close()",closeAfter);
}
</script>

and instead of the <body> tag, use this:

<body onload="closeWin();self.focus()">

howLong is the time in milliseconds so 30000 is actually 30 seconds and I guess 300000 would be five mintues... I was never much good for math.

Hope this helps.[/b]
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0