function guard issue

Posted in CategoryGeneral Discussion
  • Terry Ogbemudia 7 months ago

    Ok cool, good to hear that 

  • Will 7 months ago

    yes i removed header("Cache-Control: max-age=300, must-revalidate");  from my forms

     

  • Terry Ogbemudia 7 months ago

    Have you resolved the issue?

  • Will 7 months ago

    I think its because im using

    header("Cache-Control: max-age=300, must-revalidate"); 

    in my forms

     

  • Will 7 months ago

    after a few minutes of inactivity if someone click register the function guard says Notice: Undefined index: ID in C:\Program Files (x86)\Zend\Apache24\htdocs\db\functions.php on line 643

     

    this is line 643

    }else if((isset($_SESSION['last_active']) && (time() - $_SESSION['last_active']) > $InActive) && $_SESSION['ID']){

    but if i reload the page its fine

     

    function guard(){
       
        $IsValid = true;
        $InActive = 60 * 15; //15 mins
        $fingerprint = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
       
        if((isset($_SESSION['fingerprint']) && $_SESSION['fingerprint'] != $fingerprint)){
            $IsValid = false;
            Signout();
        }else if((isset($_SESSION['last_active']) && (time() - $_SESSION['last_active']) > $InActive) && $_SESSION['ID']){
            $IsValid = false;
            Signout();
        }else{
            $_SESSION['last_active'] = time();
        }
       
        return $IsValid;
    }

Please login or register to leave a response.