Esempio n. 1
0
function Fath_ctrl($cont)
{
    try {
        $ret = array();
        if (0 === strcmp($cont, DATH_CONT_LGI)) {
            if (true === Fath_login()) {
                $ret["ret"] = true;
            } else {
                $ret["ret"] = false;
                $ret["ret_msg"] = "authorization failed";
            }
        } else {
            if (0 === strcmp($cont, DATH_CONT_LGO)) {
                Frot_resetSession();
                $ret["ret"] = true;
            } else {
                if (0 === strcmp($cont, DATH_CONT_USR)) {
                    $user = Frot_getSession("user");
                    $ret["ret"] = true;
                    $ret["ret_msg"] = $user;
                }
            }
        }
        return $ret;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Esempio n. 2
0
function Flgn_iniSrc($url)
{
    try {
        global $Grot_path;
        # Fcom_setLogInfo( "debug" , "Flgn_iniSrc:".$Grot_path );
        $cont = Frot_getConts($url["type"], $url["cont"], $tgt);
        if (null === $cont) {
            Frot_jumpFirst();
            return;
        }
        Frot_setSession($tgt, true, false);
        $conts_lst = Frot_getContsList(array(DROT_STT_LGN, DROT_SUBSTT_INI));
        $chk_flg = true;
        foreach ($conts_lst as $key => $val) {
            $chk_flg = Frot_getSession($val);
            if (null === $chk_flg) {
                # Fcom_setLogInfo( "debug" , "null session:".$val );
                break;
            }
        }
        if (true === $chk_flg) {
            Frot_resetSession();
            Frot_setSession(DROT_SESROT_STT, DROT_STT_LGN);
            Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_RDY);
            Fcom_setLogInfo("debug", "ready");
        }
        echo $cont;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Esempio n. 3
0
function Frot_jumpFirst()
{
    try {
        global $Grot_pathl;
        Fcom_setLogInfo("debug", "jump first:" . $Grot_path);
        Frot_resetSession();
        Frot_setSession(DROT_SESROT_STT, DROT_STT_LGN, true);
        Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_FST, true);
        header('Location: http://' . DROT_HOST . '/' . DROT_APP_NAME . '/');
        exit;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Esempio n. 4
0
function Fath_login()
{
    try {
        if (true === Fath_chkLogin($_POST["userid"], $_POST["passwd"])) {
            Frot_resetSession();
            Frot_setSession(DROT_SESROT_STT, DROT_STT_APP);
            //Frot_setSession( DROT_SESROT_SUBSTT ,  );
            Frot_setSession(DROT_LGDIN_USER, $_POST["userid"]);
            //echo json_encode( array( 'ret' => true ) );
            return true;
        } else {
            // echo json_encode( array( 'ret' => false ) );
            return false;
        }
    } catch (Exception $e) {
    }
}
Esempio n. 5
0
function Frot_setSession($s_idx, $val, $flg = true)
{
    try {
        if (false === $flg) {
            #session_regenerate_id( false );
            $_SESSION[$s_idx] = $val;
            return;
        }
        $lst_buf = array();
        foreach ($_SESSION as $key => $buf) {
            $lst_buf[$key] = $buf;
        }
        Frot_resetSession();
        foreach ($lst_buf as $idx => $buf2) {
            $_SESSION[$idx] = $buf2;
        }
        $_SESSION[$s_idx] = $val;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '(' . $s_idx . ',' . $val . ',' . $flg . ')' . PHP_EOL . $e->getMessage());
    }
}
Esempio n. 6
0
function Fapp_jumpFirst()
{
    try {
        global $Grot_path;
        Fcom_setLogInfo(DCOM_LOGLV_DBG, "app jump first:" . $Grot_path);
        $user = Frot_getSession("user");
        # Frot_logSession();
        Frot_resetSession();
        if (null === $user) {
            header('Location: http://' . DROT_HOST . '/' . DROT_APP_NAME);
            exit;
        }
        Frot_setSession(DROT_SESROT_STT, DROT_STT_APP, false);
        Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_FST, false);
        Frot_setSession(DROT_LGDIN_USER, $user, false);
        header('Location: http://' . DROT_HOST . '/' . DROT_APP_NAME . '/');
        exit;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Esempio n. 7
0
function Fapp_iniSrc($url)
{
    try {
        global $Grot_path;
        $cont = Frot_getConts($url["type"], $url["cont"], $tgt);
        if (null === $cont) {
            Fcom_setLogInfo("debug", "app null conts:" . $Grot_path);
            #Fapp_jumpFirst();
            return;
        }
        Frot_setSession($tgt, true, false);
        # Frot_logSession();
        $conts_lst = Frot_getContsList(array(DROT_STT_APP, DROT_SUBSTT_INI));
        # Fcom_logObj( "conts_lst" , $conts_lst );
        $chk_flg = true;
        # Fcom_setLogInfo( "debug" , "check ready start" );
        foreach ($conts_lst as $key => $val) {
            $chk_flg = Frot_getSession($val);
            # Fcom_setLogInfo( "debug" , $key.":".$chk_flg );
            if (null === $chk_flg) {
                # Fcom_setLogInfo( "debug" , "null session:".$val );
                break;
            }
        }
        #    Fcom_setLogInfo( "debug" , "end check ready" );
        if (true === $chk_flg) {
            $user = Frot_getSession("user");
            Frot_resetSession();
            Frot_setSession(DROT_SESROT_STT, DROT_STT_APP);
            Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_RDY);
            Frot_setSession("user", $user, false);
            Fcom_setLogInfo("debug", "app ready:" . $user);
        }
        echo $cont;
        return;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Esempio n. 8
0
function Frlg_jumpFirst()
{
    try {
        Fcom_setLogInfo(DCOM_LOGLV_DBG, 'jump first');
        $idx = array(DROT_SESIDX_STT => DROT_STT_LGN, DROT_SESIDX_SUBSTT => "");
        Frot_resetSession($idx);
        header('Location: http://' . DROT_HOST . ':' . DROT_PORT . '/' . DROT_APP_NAME);
        exit;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}