TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 675
  • Total: 675

Self made logout button in a PHP block help.

Started by Stroopy, January 22, 2009, 07:35:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Stroopy

Hey all,

I've edited my layout and all so the bottons that are on top are gone.
Now the only problem I have is that there's no logout botton.

Can someone please tell me how to make one?

I've tried to make a link that goes to http://(website).com/index.php?action=logout but then I get Session verification failed. Please try logging out and back in again, and then try again.

Please help.


IchBin

You get a session verification error because the session ID is passed in the URL when you logout. If you look at the logout button that you took out, you can see how the ID is passed into the URL.

Stroopy

Quote from: IchBinâ„¢ on January 22, 2009, 08:25:19 PM
You get a session verification error because the session ID is passed in the URL when you logout. If you look at the logout button that you took out, you can see how the ID is passed into the URL.

I kept trying that but I just cant work it out how it work.
What I want is a text hyperlink that logs you out when you click it in a PHP block but I cant get it. :(

IchBin

Show me how you are passing the session id into the link in your code then, so I can show you whats wrong.

Stroopy

Quote from: IchBinâ„¢ on January 22, 2009, 09:08:17 PM
Show me how you are passing the session id into the link in your code then, so I can show you whats wrong.

<a href="(website).com/index.php?action=logout;sesc=session_id">Logout</a>
Thats the best I can get, I also tried too edit the normal logout PHP code but without luck.

JPDeni


<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">Logout</a>


Be sure that you've included $scripturl and $context in your global command at the beginning of your code.

IchBin

Quote from: Stroopy on January 22, 2009, 09:15:47 PM
Quote from: IchBinâ„¢ on January 22, 2009, 09:08:17 PM
Show me how you are passing the session id into the link in your code then, so I can show you whats wrong.

<a href="(website).com/index.php?action=logout;sesc=session_id">Logout</a>
Thats the best I can get, I also tried too edit the normal logout PHP code but without luck.

As you can see by Deni's code you were not including the actual session ID. The word session_id does not hold any value. If you hover your mouse over the link after using Deni's code you will see there is an actual ID number that is like 40 characters long that is necessary to login and logout.

Thanks Deni! :up:

JPDeni

:) I knew right where it was and happened to have an index.template.php file open on my computer. It was just a matter of doing a search for the text and copying it. :)

Prophecyrising

How can you do this using tpmenu link?
I've tried "index.php?action=logout;sesc=session_id" (no quotes), but I get "Session verification failed. Please try logging out and back in again, and then try again."
I can't use "', $scripturl, '?action=logout;sesc=', $context['session_id'], '" either, or I get mysql fits.
Any suggestions?

TinyPortal 1.0 beta 5-1
SMF 2.0 RC3

This website is proudly hosted on Crocweb Cloud Website Hosting.