Mys 1.3.4 Seamless Login/Logout Redirect to Index

Forum
Last Post
Threads / Messages

Kyttias

Super Moderator
Super Mod
Joined
Jan 26, 2014
Messages
849
Points
18
Mysidian Dollar
58,199
login/logout redirect
I can't believe I didn't figure this one out sooner! Inside view/loginview.php, inside each of the functions, add in this line before the $mysidia variable is set:
PHP:
header( "Location: /" );
help_by_kyttias-d8e0rq1.gif

(The online users count won't update until you visit another page, btw?)

  Spoiler: loginview.php 
In case anyone needs my final version of the file (you shouldn't), here it is, for reference:
PHP:
<?php

class LoginView extends View{
	
	public function index(){
		header( "Location: /" );
	    $mysidia = Registry::get("mysidia");
		$document = $this->document;

	    if($mysidia->input->post("submit")){
            $document->setTitle($this->lang->success_title);
		    $document->addLangvar("Welcome back {$mysidia->input->post("username")}. {$this->lang->success}");
			return;
		}
		
		$document->setTitle($this->lang->title);
	    $document->addLangvar($this->lang->login);

		# $loginForm = $mysidia->frame->getSidebar()->getLoginBar();
        # $document->add($loginForm);	
	}
	
	public function logout(){
		header( "Location: /" );
	    $mysidia = Registry::get("mysidia");
		$document = $this->document;		
        $document->setTitle($this->lang->logout_title);
        $document->addLangvar($this->lang->logout);	
	}
}
?>
 
Very interesting! Might make a use of this in my script!

Also, what do you use to make your gif's when you display your webpages? Ive seen some things like this on tumblr and was very interested in finding out!
 
It doesn't seem to work for me. The logout button seems to still take me to a "/login/logout" page
 
In the original post I left a spoiler tag. Open it up and paste the entire contents to replace the entire file? It appears I forgot to mention one also needs to place a header redirect inside the logout function a few lines down, as well. No one else mentioned this because they probably just replaced their entire file, I guess. :veeee:
 
I think I might just be an idiot. Or tired.
All fixed and working now. :D
Doesn't even take me to that pointless /index page either.
 
Does anyone know what the proper way to write the location when your site is installed into a subfolder?

header( "Location: /" ); will redirect me to the root of my site. (Which is not where my install of mysidia is located.)

I tried header( "Location: subfolder/" ); but it only half works. When I login, it takes me to the correct page, but the url duplicates the subfolder. www.mysite.com/subfolder/subfolder When I logout, it duplicates the subfolder in the url so many times it breaks everything.
 
Just wanted to say thanks for this! Something I wanted that I didn't know I wanted. LOL
 
Thank you for putting this up. Was looking for something like this. Works perfectly!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top