当前位置: 首页>>代码示例>>PHP>>正文


PHP astercrm::insertAccountLog方法代码示例

本文整理汇总了PHP中astercrm::insertAccountLog方法的典型用法代码示例。如果您正苦于以下问题:PHP astercrm::insertAccountLog方法的具体用法?PHP astercrm::insertAccountLog怎么用?PHP astercrm::insertAccountLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在astercrm的用法示例。


在下文中一共展示了astercrm::insertAccountLog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAccountData


//.........这里部分代码省略.........
    $objResponse = new xajaxResponse();
    $bError = false;
    $loginError = false;
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        if ($_SERVER["HTTP_CLIENT_IP"]) {
            $proxy = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $proxy = $_SERVER["REMOTE_ADDR"];
        }
    } else {
        if (isset($_SERVER["HTTP_CLIENT_IP"])) {
            $ip = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            $ip = $_SERVER["REMOTE_ADDR"];
        }
    }
    $log = array();
    $log['action'] = 'login';
    $log['ip'] = $ip;
    $log['username'] = $aFormValues['username'];
    $log['usertype'] = 'clid';
    $query = "SELECT * FROM account_log WHERE ip='" . $ip . "' AND action='login' ORDER BY id DESC LIMIT 1";
    $res = $db->query($query);
    if ($res->fetchInto($this_ip_log)) {
        $failedtimes = $this_ip_log['failedtimes'];
    }
    if ($failedtimes >= $config['system']['max_incorrect_login'] && $config['system']['max_incorrect_login'] > 0) {
        $objResponse->addAlert($locate->Translate("login failed,your ip is locked for login"));
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
        return $objResponse;
    }
    if (!$bError) {
        $query = "SELECT * from clid where clid ='" . $aFormValues['username'] . "'";
        $res = $db->query($query);
        if ($res->fetchInto($clid)) {
            $log['account_id'] = $clid['id'];
            if ($clid['pin'] == $aFormValues['password']) {
                $log['status'] = 'success';
                $log['failedtimes'] = 0;
                if ($aFormValues['rememberme'] == "forever") {
                    // set cookies for three years
                    setcookie("username", $aFormValues['username'], time() + 94608000);
                    setcookie("password", $aFormValues['password'], time() + 94608000);
                    setcookie("language", $aFormValues['locate'], time() + 94608000);
                } else {
                    // destroy cookies
                    setcookie("username", "", time() - 3600);
                    setcookie("password", "", time() - 3600);
                    setcookie("language", "", time() - 3600);
                    $username = '';
                    $password = '';
                    $language = 'en_US';
                    $checked = false;
                }
                $_SESSION['curuser']['username'] = trim($aFormValues['username']);
                $_SESSION['curuser']['usertype'] = "clid";
                $_SESSION['curuser']['clidid'] = $clid['id'];
                $_SESSION['curuser']['groupid'] = $clid['groupid'];
                list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
                $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
                if ($configstatus == -2) {
                    $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
                    return $html;
                } else {
                    $billingfield = trim($asterccConfig['system']['billingfield']);
                    if ($billingfield == 'accountcode') {
                        $_SESSION['curuser']['billingfield'] = $billingfield;
                    }
                }
                //$objResponse->addAlert($locate->Translate("login_success"));
                $objResponse->addScript('window.location.href="cdr.php";');
            } else {
                $log['failedtimes'] = $failedtimes + 1;
                $log['status'] = 'failed';
                $log['failedcause'] = 'incorrect password';
                $loginError = true;
            }
        } else {
            $log['failedtimes'] = $failedtimes + 1;
            $log['account_id'] = 0;
            $log['status'] = 'failed';
            $log['failedcause'] = 'notexistent clid';
            $loginError = true;
        }
        astercrm::insertAccountLog($log);
        if (!$loginError) {
            return $objResponse;
        } else {
            $objResponse->addAlert($locate->Translate("login_failed"));
            $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
            $objResponse->addAssign("loginButton", "disabled", false);
            return $objResponse;
        }
    } else {
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
    }
    return $objResponse;
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:login.server.php

示例2: processAccountData


//.........这里部分代码省略.........
                $_SESSION['curuser']['userid'] = $list['id'];
                $_SESSION['curuser']['groupid'] = $list['groupid'];
                $_SESSION['curuser']['resellerid'] = $list['resellerid'];
                $_SESSION['curuser']['limittype'] = $list['limittype'];
                $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
                if ($configstatus == -2) {
                    $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)";
                    return $html;
                } else {
                    $billingfield = trim($asterccConfig['system']['billingfield']);
                    if ($billingfield == 'accountcode') {
                        $_SESSION['curuser']['billingfield'] = $billingfield;
                    }
                }
                $res = astercrm::getCalleridListByID($list['groupid']);
                while ($res->fetchInto($row)) {
                    $_SESSION['curuser']['extensions'][] = $row['clid'];
                }
                if (!is_array($_SESSION['curuser']['extensions'])) {
                    $_SESSION['curuser']['extensions'] = array();
                }
                if ($list['usertype'] == 'reseller') {
                    $_SESSION['curuser']['allowcallback'] = $list['allowcallbackreseller'];
                } else {
                    $_SESSION['curuser']['allowcallback'] = $list['allowcallbackgroup'];
                }
                $_SESSION['curuser']['accountcode'] = $list['accountcode'];
                //				if ($list['extensions'] != ''){
                //					$_SESSION['curuser']['extensions'] = split(',',$list['extensions']);
                //				}
                //				else{
                //				}
                list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
                /*
                	if you dont want check manager status and show device status when user login 
                	please uncomment these three line
                */
                //				$objResponse->addAlert($locate->Translate("login_success"));
                if ($_SESSION['curuser']['usertype'] == 'groupadmin' || $_SESSION['curuser']['usertype'] == 'operator') {
                    if ($aFormValues['pagestyle'] == 'classic') {
                        $objResponse->addScript('window.location.href="systemstatus.php";');
                    } else {
                        $objResponse->addScript('window.location.href="systemstatus_simple.php";');
                    }
                } else {
                    $objResponse->addScript('window.location.href="account.php";');
                }
                astercrm::insertAccountLog($log);
                return $objResponse;
                //check AMI connection
                $myAsterisk = new Asterisk();
                $myAsterisk->config['asmanager'] = $config['asterisk'];
                $res = $myAsterisk->connect();
                $html .= $locate->Translate("server_connection_test");
                if ($res) {
                    $html .= '<font color=green>' . $locate->Translate("pass") . '</font><br>';
                    $html .= '<b>' . $_SESSION['curuser']['extension'] . ' ' . $locate->Translate("device_status") . '</b><br>';
                    $html .= asterisk::getPeerIP($_SESSION['curuser']['extension']) . '<br>';
                    $html .= asterisk::getPeerStatus($_SESSION['curuser']['extension']) . '<br>';
                } else {
                    $html .= '<font color=red>' . $locate->Translate("no_pass") . '</font>';
                }
                if ($aFormValues['pagestyle'] == 'classic') {
                    $html .= '<input type="button" value="' . $locate->Translate("continue") . '" id="btnContinue" name="btnContinue" onclick="window.location.href=\'systemstatus.php\';">';
                } else {
                    $html .= '<input type="button" value="' . $locate->Translate("continue") . '" id="btnContinue" name="btnContinue" onclick="window.location.href=\'systemstatus_simple.php\';">';
                }
                $objResponse->addAssign("formDiv", "innerHTML", $html);
                $objResponse->addClear("titleDiv", "innerHTML");
                $objResponse->addScript("xajax.\$('btnContinue').focus();");
            } else {
                //$log['account_id'] = 0;
                $log['failedtimes'] = $failedtimes + 1;
                $log['status'] = 'failed';
                $log['failedcause'] = 'incorrect password';
                $loginError = true;
            }
        } else {
            $log['failedtimes'] = $failedtimes + 1;
            $log['account_id'] = 0;
            $log['usertype'] = 'manager_login';
            $log['status'] = 'failed';
            $log['failedcause'] = 'notexistent user';
            $loginError = true;
        }
        astercrm::insertAccountLog($log);
        if (!$loginError) {
            return $objResponse;
        } else {
            $objResponse->addAlert($locate->Translate("login failed"));
            $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
            $objResponse->addAssign("loginButton", "disabled", false);
            return $objResponse;
        }
    } else {
        $objResponse->addAssign("loginButton", "value", $locate->Translate("submit"));
        $objResponse->addAssign("loginButton", "disabled", false);
    }
    return $objResponse;
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:manager_login.server.php


注:本文中的astercrm::insertAccountLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。