Zubrag.com
January 16, 2018, 05:16:11 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4
  Print  
Author Topic: Adding Logout link  (Read 110367 times)
nikwit
Newbie
*
Posts: 1


« Reply #14 on: November 13, 2007, 09:20:57 AM »

Hello and thank you for such a great piece of code to add to my site.

I hope you'll forgive my ignorance, but this is the very first piece of php code I've written (I've developed other code - but that was 3 years ago)!

In the link for the logout you have the user redirected to page.php

<a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a>

I'm not sure what to do with the parameter
logout=1
in order to actually log them out.  Do you have an example of this page as well?

Thanks a bunch!

Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #15 on: November 14, 2007, 04:23:58 AM »

Hi. You do not need to add code. Protected page will logout automatically when "logout=1" parameter passed (as logout functionality is implemented in protection script).
Logged
dandrianjafy
Newbie
*
Posts: 10


« Reply #16 on: November 22, 2007, 07:55:48 PM »

Hi, I am trying to add th elogout link as per your instruction at the top of this thread, but cannot find the line you indicated in point 1.  All I can find within password_protect.php is // User will be redirected to this page after logout
define('LOGOUT_URL_ADMIN', isset($_SERVER['HTTP_REFERER']) ? str_replace('?logout=1','',$_SERVER['HTTP_REFERER']) : '');  Is this the right one, and where would I add the redirect URL?

Cheers
Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #17 on: November 23, 2007, 03:53:04 AM »

Hi. You have to place logout url on your page (where you want it to appear). For example, if you protected members.php then you have to add logout url to members.php.

Lets say page contents was
<?php

echo "<p>This is protected page</p>";
echo "<p>Some more text here</p>";
....

?>

then you can add url as follows

<?php
echo '<a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a>';
echo "<p>This is protected page</p>";
echo "<p>Some more text here</p>";
....

?>

So you have to put it anywhere on your page.
Logged
dandrianjafy
Newbie
*
Posts: 10


« Reply #18 on: November 23, 2007, 06:01:26 AM »

Thanks for your quick support.  I have added the link as you instructed, but when clicked on it takes me to this - You have reached this web page by typing "example.com", "example.net", or "example.org" into your web browser.

These domain names are reserved for use in documentation and are not available for registration. See RFC 2606, Section 3.

How can I redirect to my logout confirmation page?

cheers
Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #19 on: November 23, 2007, 06:09:49 AM »

I provided this link just for example
<a href="http://www.example.com/path/to/protected/page.php?logout=1">Logout</a>

Change url to match your protected page url.
Logged
dandrianjafy
Newbie
*
Posts: 10


« Reply #20 on: November 23, 2007, 06:18:00 AM »

Sorry, I think I must be a little thick when it comes to this.  I have copied your example link and added the path as per my protected page and it still goes to the same place as I mentioned above.  The protected page you mention...is that the logout confirmation page or the page on which the logout link is on?  I have put the same address as the lougout link is on.

Chhers
Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #21 on: November 23, 2007, 06:26:55 AM »

Protected page stands for any page protected using password protector. You could also link to login.php instead of protected page.
For example you have login.php in http://www.example.com/members/login.php
Logout url could be <a href="http://www.example.com/members/login.php?logout=1">

When user click on that url, password protector will automatically check parameter, and if it is logout=1 then it will redirect to url specified in the settings.php as logout url (from what you posted you seems to be using advanced password protector). Simple password protector has logout url defined in the script code (password_protect.php).

Advanced password protector has its own section as it differs from simple one: http://www.zubrag.com/forum/index.php/board,17.0.html
Logged
dandrianjafy
Newbie
*
Posts: 10


« Reply #22 on: November 23, 2007, 06:30:29 AM »

Damn you're quick  Wink

Yes I am using Advanced Password Protect.  Does that mean I need to do anything differently?
Logged
zubrag
Administrator
Hero Member
*****
Posts: 785


WWW
« Reply #23 on: November 23, 2007, 06:34:35 AM »

They differ in user management (advanced has user management functionality, signup, etc) and settings (different files contain settings), but login/logout functionality is almost the same. So above info is good for both (except for you cannot link to login.php in simple protector as it does not have such program).
Updated my post above to be more descriptive.
Logged
dandrianjafy
Newbie
*
Posts: 10


« Reply #24 on: November 23, 2007, 06:44:11 AM »

Thanks for all of your help.  The support for this script is excellent
Logged
anaz
Newbie
*
Posts: 1


« Reply #25 on: April 25, 2008, 03:39:31 PM »

Hi:

I am using your script (its wonderful) however I have a question. If a user logsout more then once in the same session (same browser), the logout does not work (it takes the user to the redirected page) but the user is not actually "logged" out. Next time user clicks on the link it doesnt ask for the password...(again this only occurs if user logsout more then once in the same session/same browser). I am guessing it might have to do with logout=1 in the script...is there a way to reset the logout variable after its=1.

Thanks
Logged
testmen
Newbie
*
Posts: 1


« Reply #26 on: September 20, 2008, 01:50:20 PM »

Has anyone got this logout link to work yet??

I have the no cache lines in the document head, ?logout=1 in the logout link, etc, etc. But like many others, my browser back button brings me right back onto the protected page again.

Logged
dgow
Newbie
*
Posts: 2


« Reply #27 on: December 02, 2008, 02:55:14 PM »

The password protect script works great. No problem there.  I even added the login to my own login.php page.  Looks great in the web editor, (expression web 2), but never shows up on the website.  When I added the logout link to the password protect page some strange things start to happen.  I am not adding something in right.

I click to enter the password protected page and it takes me to the login page, not the login.php page I created.  I login and I get the password protected page as designed.  But when I click the logout text it takes me back to the page I setup, but without any of the graphics.  Furthermore when I click any of the links from that page, all the pages have NO graphics on them anymore.

What am I not adding in correctly?

Link:   http://www.mbiweb13.com/customer_accounts.php

Click on "Sincerely Yours" & use the "zubrag & root" as password.
Logged
Pages: 1 [2] 3 4
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC