Login with redirect

1

I have a login form running with JQuery + PHP, I am imploding the option to redirect based on the url I want to receive via GET, as below:

https://pt-br.example.com/?redirect=https://blog.example.com/

Problem is that I do not get receive via GET the variable redirect

Login Method

    private function Login() {

$Session -> session_token  = (string) $Functions -> ClearVariable($_POST['tokenForm']); 
$Session -> CheckSessionTokenForm();

$this->Email = (string) mb_strtolower($Functions -> ClearVariable($_POST['loginEmail']));
$this->Password = (string) $Functions -> ClearVariable($_POST['loginPsw']);

if(isset($_GET['redirect']))
{
    $this->Location = $Functions -> ClearVariable($_GET['redirect']);
}
else
{
    $this->Location = 'dashboard/'; 
}

... }

JQuery Post

$('button[type="submit"]').click(function(event){
    event.preventDefault();
    var url = $(this).closest('form').attr('data-url');
    var formId = $(this).closest('form').attr('id');
    var iBtn = $(this).children('i').attr('id');

    $.ajax({            
        url: url,           
        data: $('#'+formId).serialize(),
        dataType:"json",
        type:"post",
        success: function(data){
            switch(data.status) {
                case 'location':  
                    window.location.href = data.flag;
                    break;  
            }
        }
    }); 
});

Using PHP with JQuery post, can it be because of JQuery post?

    
asked by anonymous 28.06.2017 / 22:53

1 answer

1

get the page passed by the url with $ _SERVER ['PHP_SELF'] stores in a variable, if it passes your conditions you take the user to the page you want

    
28.06.2017 / 22:58