php - How to go back to previous page after successful login -


i working login system. here code redirect other page after successful login. want go previous page instead of redirect specific page.

code: login.php

<?php require_once("./include/membersite_config.php");  if(isset($_post['submitted'])) { if($fgmembersite->login()) {     $fgmembersite->redirecttourl("login-home.php"); } }  ?> 

in previous page
add these:

session_start(); require_once("./include/membersite_config.php"); if (!$fgmembersite->checklogin()) {     $_session['redirect_url'] = $_server['php_self'];      header('location: login.php');     exit; } 


login page

    session_start();      require_once("./include/membersite_config.php");      if(isset($_post['submitted']))     {         if($fgmembersite->login())         {             $redirect_url = (isset($_session['redirect_url'])) ? $_session['redirect_url'] : '/';             unset($_session['redirect_url']);             header("location: $redirect_url", true, 303);             exit;         }     } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -