Re: Session IP address matching

From: Date: Sat, 25 Jan 2014 02:21:42 +0000
Subject: Re: Session IP address matching
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message


On 25/01/14 01:11, Andrey Andreev wrote:
Yes, one can write a custom session handler, but there's a number of problems with that:
Correct me if I'm wrong, but why would you need to do that? Surely, this would suffice:
    if (!isset($_SESSION['ip'])) {
        $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
    } else if ($_SERVER['REMOTE_ADDR'] !== $_SESSION['ip']) {
        session_destroy();
    }
-- Andrea Faulds http://ajf.me/

Thread (29 messages)

« previous php.internals (#71545) next »