All pastes #44346 Raw Edit

gabrielone

public php v1 · immutable
#44346 ·published 2006-03-03 16:01 UTC
rendered paste body
function check_auth() {    try {        $cookie = new Cookie();        $level = $cookie->validate();        return $level;//       echo "The cookie is there....";    }    catch (AuthException $e) {        header("Location: /index.php?originating_uri=".$_SERVER['REQUEST_URI']);        exit;    }}This is the section from the class that is called....    public function validate() {        if(!$this->version || !$this->created || !$this->loginid) {            throw new AuthException("Malformed Cookie");        }               if($this->version != self::$myversion) {            throw new AuthException("Version Mismatch");        }               if(time() - $this->created > self::$expiration) {            throw new AuthException("Cookie Expired");        } else if(time() - $this->created > self::$warning) {            $this->set();            $level = $this->loginid;            return $level;         }           }