Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 19th, 2006, 06:02 AM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cookie Identifier & Redirect

Hi,

I have a webpage that members login to. I want the initial page of my website to go directly to the login page, but once members have logged in once the site doesn't ask them to log in again unless they logout. However, is there a javascript (or other form of code) that I can put on the login page so that when an already logged in user returns to the site, it wont show the log in page but another page.

Any help would be much apreciated!

Pete
  #2 (permalink)  
Old September 19th, 2006, 07:21 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter,

Try a search on Google for "Cookie Redirect" scripts.

Cheers
Joe

'sync' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
  #3 (permalink)  
Old September 22nd, 2006, 11:04 AM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, found one that works!

One problem though, the site I added it to needs to have a logout page, is there some 'onload' code that I can use in the header of my logout page that will delete the cookie that was created upon login?
  #4 (permalink)  
Old September 23rd, 2006, 05:25 AM
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No I dont think so, you won't be able to delete files on the users machine as thats a security risk. I think what happens on most sites like this is that they "reset" the cookie, ie issue a new one that says "This user is logged out" probably using unique ids and timestamping or some such thing. The site probably then checks for the existence of this cookie (also against the date and time) when the user returns. If it doesn't find the cookie, then it will look for the existence of the "Logged in today" cookie. If it doesn't find that either then the user hasn't logged in today.

Bit vague I know, but thats my understanding of it.

Cheers
Joe

'sync' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Identifier expected andriy JSP Basics 0 November 1st, 2006 11:28 PM
identifier expected errors ali582 Java Basics 3 September 2nd, 2006 09:10 PM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM
Identifier Expected syncmaster VB.NET 2002/2003 Basics 1 September 2nd, 2004 03:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.