Location: PHPKode > projects > SnortCenter 2.x > snortcenter-release/login.inc.php
<?php
    /*
    ** SnortCenter Copyright (C) 2001,2002,2003 Stefan Dens
    **
    ** Author: Stefan Dens <hide@address.com>
    **
    ** This program is free software; you can redistribute it and/or modify
    ** it under the terms of the GNU General Public License as published by
    ** the Free Software Foundation; either version 2 of the License, or
    ** (at your option) any later version.
    **
    ** This program is distributed in the hope that it will be useful,
        ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ** GNU General Public License for more details.
    **
    ** You should have received a copy of the GNU General Public License
    ** along with this program; if not, write to the Free Software
    ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    */
?>
<?php
    $phpUserLogin_leader_email = $webmaster_email;
    $phpUserLogin_hidden_key_num = $hidden_key_num;
    $phpUserLogin_hidden_key = $REMOTE_ADDR.$phpUserLogin_hidden_key_num; // Adding users IP to hidden key.
    $phpUserLogin_lost_func = "0"; // Do you want to use the lost password function, 1 for yes, 0 for no. It would be a good idea to turn it off if it does not work (eg, your server wont send mails).
     
    if (isset($phpUserLogin_logout) && $phpUserLogin_cookie["user_name"] && $phpUserLogin_cookie["id_hash"]) {
        setcookie("phpUserLogin_cookie[user_name]");
        setcookie("phpUserLogin_cookie[id_hash]");
        header("Refresh: 0; url=login.php");
        echo "Loading Page...<p><font size=\"1\">Or click <a href=\"login.php\">here</a> if page does not change.</font>";
        exit;
    }
    elseif ($phpUserLogin_cookie["user_name"] & $phpUserLogin_cookie["id_hash"]) {
         
        $phpUserLogin_user_name_hash = md5($phpUserLogin_cookie["user_name"].$phpUserLogin_hidden_key);
         
        if ($phpUserLogin_cookie["id_hash"] == $phpUserLogin_user_name_hash) {
             
            $db_login = NewACIDDBConnection($DBlib_path, $DBtype);
            $db_login->acidConnect($DB_dbname, $DB_host, $DB_port, $DB_user, $DB_password);
            if ($result = $db_login->acidExecute("SELECT * FROM users".$phpUserLogin_join_sql." WHERE username = '$phpUserLogin_cookie[user_name]'")) {
                $phpUserLogin_userinfo = $result->acidFetchRow();
            }
             
            if (empty($phpUserLogin_userinfo)) {
                setcookie("phpUserLogin_cookie[user_name]");
                setcookie("phpUserLogin_cookie[id_hash]");
                setcookie("phpUserLogin_cookie[error]", "TRUE");
                header("Refresh: 0; url=login.php");
                echo "Loading Page...<p><font size=\"1\">Or click <a href=\"login.php\">here</a> if page does not change.</font>";
                exit;
            }
             
            if (strpos($phpUserLogin_userinfo[acl], 'sensor') === false) {
                echo '<SCRIPT language=javascript>setTimeout("location.href=\'login.php\'",0);</SCRIPT>';
                echo "Loading Page...<p><font size=\"1\">Or click <a href=\"login.php\">here</a> if page does not change.</font>";
                exit;
            }
             
             
        } else {
            setcookie("phpUserLogin_cookie[user_name]");
            setcookie("phpUserLogin_cookie[id_hash]");
            setcookie("phpUserLogin_cookie[error]", "TRUE");
            header("Refresh: 0; url=login.php");
            echo "Loading Page...<p><font size=\"1\">Or click <a href=\"login.php\">here</a> if page does not change.</font>";
            exit;
        }
    } else {
        header("Refresh: 0; url=login.php");
        echo "Loading Page...<p><font size=\"1\">Or click <a href=\"login.php\">here</a> if page does not change.</font>";
        exit;
    }
     
?>
Return current item: SnortCenter 2.x