Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 22 Aug 2019, 18:10
doc55 doc55 is offline
 
Join Date: Aug 2019
Custom Logout Button

I want to create a custom logout button for my vB 5.3.3.
I'm using the following code from the core/vb/user.php file but it is not working. Can someone help me troubleshoot this code, please?
Thank you


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #2  
Old 02 Sep 2019, 16:39
doc55 doc55 is offline
 
Join Date: Aug 2019
What do you think about the following method to logout users?
Is it OK or does it cause any issues or security concerns?


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #3  
Old 02 Sep 2019, 17:01
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
Use the official vBulletin API. /core/vb/api/user.php has a logout method.

I believe something like:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #4  
Old 03 Sep 2019, 02:14
doc55 doc55 is offline
 
Join Date: Aug 2019
Thank you Dave for your helpful reply.
Here is the final and functioning code for others, if they need one:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

One question, with the above code, the user is logged out then redirected to the forum home. My forum is installed in mydomain.com/forum. How can I redirect users after logout to mydomain.com?

--------------- Added 03 Sep 2019 at 16:58 ---------------

Maybe I should ask the question differently.
Is it possible to execute the as a function or in the background, instead of redirecting to it as a URL?

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by doc55; 03 Sep 2019 at 16:58.
Reply With Quote
  #5  
Old 04 Sep 2019, 06:09
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Did you try to call the API user logout?

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
vBulletin-Forum.de closed!
Reply With Quote
  #6  
Old 05 Sep 2019, 02:45
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by delicjous View Post
Did you try to call the API user logout?

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Thank you for your reply. I did try the API, but I can't make it work.
Here is my code when I use the API:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

With this, I get the following general error from vB:
That action could not be completed. Please try again, and if this occurs again please contact the system administrator and tell them how you got this message.

Maybe you could help me find what I'm doing wrong.
Thanks again.
Reply With Quote
  #7  
Old 26 Sep 2019, 01:07
doc55 doc55 is offline
 
Join Date: Aug 2019
Anyone could help with this script? I really appreciate anu help I can get.
Reply With Quote
  #8  
Old 26 Sep 2019, 01:36
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
I'm pretty sure you must put define('CSRF_PROTECTION', false); on top of the file.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #9  
Old 26 Sep 2019, 12:25
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by Dave View Post
I'm pretty sure you must put define('CSRF_PROTECTION', false); on top of the file.
Thank you for your reply.
I tried adding this line on top:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I also tried this line on top:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Both are giving me the same error message and the user is not logged out.

Here is the my final code so far:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #10  
Old 26 Sep 2019, 16:37
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
Works fine if I do

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

instead.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #11  
Old 26 Sep 2019, 16:45
doc55 doc55 is offline
 
Join Date: Aug 2019
Originally Posted by Dave View Post
Works fine if I do

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

instead.
Thank you Dave. With that change, The script redirects to the index.php as it is expected and I'm not getting any error messages, but the user is not logged out.
Reply With Quote
  #12  
Old 26 Sep 2019, 17:06
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
I used the same script on my vBulletin 5 test forum and it logged me out properly. Maybe try clearing your cookies > login again > try the script.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #13  
Old 26 Sep 2019, 18:12
doc55 doc55 is offline
 
Join Date: Aug 2019
Thank you for your reply.
I just tested it again after clearing the cookies, but still didn't log out the user.
Could this be because I have the option "Remember me" enabled on log-in?

I did var_dump($logoutInfo); and this is what I got:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I'm not sure if this would help.
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Logout Button replacing Logout text TheMusicMan vBulletin 3.5 Template Modifications 14 25 Dec 2007 18:33
Logout Button Burning_Ice vBulletin 2.x Template Modifications 10 19 Aug 2002 18:13


Tags
custom, logout, php


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 12:48.

Layout Options | Width: Wide Color: