Location: PHPKode > projects > Pindorama > pindorama/active/components/login.php
<?php

/**
*                                                          
* @name        pin_login
* @deprecated  
* @version     0.11
*
* @author      Guilherme Capilé <hide@address.com>
*
* @global      $arg
* @global      $param
* @global      $c
* 
* @see         pin_check_user()
* @see         pin_clean_xml()
* @see         pin_error()
*
* @return      
*/
function pin_login($arr="", $str="")
{
    global $c, $param, $arg;
    if (!isset($param["auth"]) || $param["auth"] == "") {
        $param["auth"] = TRUE;
        $param["user"] = "";
        $user = "";
        require ($c["users"]."permissions.php");
        if ($_SERVER["REMOTE_USER"] != "") {
            $param["auth-user"] = $_SERVER["REMOTE_USER"];
        } else if ($_SERVER["PHP_AUTH_USER"] != "") {
            if (pin_check_user(htmlspecialchars($_SERVER["PHP_AUTH_USER"]), $_SERVER["PHP_AUTH_PW"])) {
                $param["auth-user"] = $_SERVER["PHP_AUTH_USER"];
            }
        } else if ($_SERVER["SSL_CLIENT_S_DN_Email"] != "") {
            $param["auth-user"] = $_SERVER["SSL_CLIENT_S_DN_Email"];
        }
        $param["user"] = pin_clean_xml($param["auth-user"]);
        if ($c["require_valid_user"]) {
            if ($param["user"] == "") {
                $param["auth"] = FALSE;
                pin_error("401");
                exit();
            }
        }
        if (is_array($p)) {
            foreach($p as $perm) {
                if (preg_match( "/".$perm["url"]."/", $param["script-name"])) {
                    $param["auth"] = FALSE;
                    if ($perm["grp"] != "" && $param["auth-user"] != "") {
                        foreach($g as $gname=>$gusers) {
                            if (in_array($param["auth-user"], explode(" ", $gusers))
                             && in_array($gname, explode(" ", $perm["grp"]))) {
                                $param["auth"] = TRUE;
                            }
                        }
                    } else if ($perm["usr"] != "" && $param["auth-user"] != "") {
                        if (in_array($param["auth-user"], explode(" ", $perm["usr"]))) {
                            $param["auth"] = TRUE;
                        }
                    }
                }
            }
        }
    }
    if ($param["auth"] != TRUE) {
        pin_error("401");
        exit();
    } else {
        return true;
    }
} // login


/**
*                                                          
* @name        pin_logout
* @deprecated  
* @version     0.11
*
* @author      Guilherme Capilé <hide@address.com>
*
* @see         pin_error()
*
* @return      
*/
function pin_logout()
{
    pin_error("401");
    exit("");
} // logout

/**
*                                                          
* @name        pin_check_user
* @deprecated  
* @version     0.11
*
* @author      Guilherme Capilé <hide@address.com>
*
* @param       $user
* @param       $pass
*
* @see         pin_read_xpath()
*
* @return      
*/
function pin_check_user ($user, $pass)
{
    global $c;
    $xmlpass = pin_read_xpath ("/xpml/resource[@name='users']/user[login = '".$user."']/password", "index:users");
    $xmlpass = $xmlpass[0];
    if (crypt($pass, $xmlpass) == $xmlpass) {
        return true;
    } else {
        return false;
    }
} // check_pass
?>
Return current item: Pindorama