Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1]   Go Down
Print
Author Topic: Logout to specific page  (Read 568 times)
0 Members and 1 Guest are viewing this topic.
haldera
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: December 04, 2005, 11:17:00 PM »

How can I make the logout button be redirected to a specific page?  I have the calendar being used off of a website that I created, and would like anyone who logs out of the calendar to be forced back to the home page of the website, instead of the anonymous calendar page.  I don't know enough about CGI to do that.  Could someone help me out?
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: December 05, 2005, 12:10:00 PM »

** How can I make the logout button be redirected to a specific page? **

One way might be to make a new template containing an HTML meta refresh or JavaScript code on it to direct users where you want them to go. You'd then have to modify the 'Logout' link on the calendar template to point to the new template by adding "&template=Template_Name_Here" (without the quotes) to its URL.

JMO

Dan O.

------------------

Logged
haldera
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: December 05, 2005, 12:23:00 PM »

I've tried that.  Unfortunately, it doesn't actually log them out.  If they hit the back button or re-enter the direct link, they are back into the calendar.  The logout CGI link that comes with the calendar destroys the cookies.  I would like to have it destroy the cookies as well as redirect to a page of my choice.

Does that make sense?

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: December 05, 2005, 04:45:00 PM »

** The logout CGI link that comes with the calendar destroys the cookies. **

And is what I suggested you continue use when I said "You'd then have to modify the 'Logout' link on the calendar template to point to the new [CalendarScript] template".

I didn't say to completely replace the link altogether. The way I suggested would still go through CalendarScript which should delete the cookies.

Dan O.

------------------

Logged
haldera
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: December 05, 2005, 05:12:00 PM »

Ok, I tried that, utilizing a different template that had a meta refresh tag in it.  When the logout script ran, it did actually log out the user.  However, it merely moved the user back to the login screen (which is where they are forced to start from) instead of going to the template page.  I thought that if I pointed the link to the calendar.pl?template=newtemplate.html&command=logout page, it would both logout, and go to the newtemplate.html page.  Did I think about this wrong?

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #5 on: December 05, 2005, 08:25:00 PM »

** I thought that if I pointed the link to the calendar.pl?template=newtemplate.html&command=logout page, it would both logout, and go to the newtemplate.html page. **

It is suppose to.

I'm afraid without being able to see it for myself, I couldn't say what is occurring.

Dan O.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: December 05, 2005, 08:29:00 PM »

** it merely moved the user back to the login screen **
Just a thought, do you have the calendar set to 'require log-in'?

If so, what I suggested above will probably not work since the new template is part of the calendar which they would need to be logged into to see.

Dan O.

------------------

Logged
haldera
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #7 on: December 05, 2005, 10:41:00 PM »

Yes, I actually used the login script from much2.com, which worked wonders by the way.  I have it so when you click over to the logon script, it immediately takes you to the login page.  After you enter your login information, it automatically takes you to the correct calendar.  Unfortunately, after you click logout, it takes you back to the login screen, instead of the main site.  I would be more than happy to email you screen shots, if that would help.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #8 on: December 06, 2005, 01:55:00 AM »

Let me think about the problem and I'll get back to you in a couple of days.

Dan O.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #9 on: December 06, 2005, 01:07:00 PM »

All I can think of is putting a conditional in the login.html template something like:

<% if($main::in{command} eq "logout") %>

# meta redirect or JavaScript here

<% } else { %>

# current template code

<% } %>


Something similar should probably be used to remove the log-IN form from the page and also display a message about the redirect and also provide a manual link for browser which won't automatically forward users.

JFYI

Dan O.

------------------

Logged
haldera
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #10 on: December 06, 2005, 02:42:00 PM »

Excellent!  Thanks so much for that, it worked wonders!  Your idea about the second page is definitely a good one, I will be putting that in today.  But in the mean time, it just flashes the login page really quick, then refreshes back to the opening page of the website, as I wanted.  I have to leave the logIN page, because I need customers to login.  It works perfectly as I needed it to, thanks.

Also, I needed to add a { on the first line, at the end, just so you know.  Like this:

<% if($main::in{command} eq "logout") { %>

------------------

[This message has been edited by haldera (edited December 06, 2005).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #11 on: December 06, 2005, 04:59:00 PM »

** Your idea about the second page is definitely a good one **

I never suggested a second page. All changes I suggested are in the very same template, just in separate places.

** I have to leave the logIN page, because I need customers to login. **

Yes but they don't need to do it when they just logged out (which is what the if($main::in{command} eq "logout") condition tests for) and are being redirected elsewhere. It will just limit what is seen by the user in between, hopefully reducing the possibility of them thinking they missed something (and maybe trying to go back... again and again and again, etc.). But it's up to you.

** I needed to add a { on the first line **

Good catch.

Dan O.


------------------

Logged
Pages: [1]   Go Up
Print
Jump to: