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


PHP logEvents函数代码示例

本文整理汇总了PHP中logEvents函数的典型用法代码示例。如果您正苦于以下问题:PHP logEvents函数的具体用法?PHP logEvents怎么用?PHP logEvents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: identifyUser


//.........这里部分代码省略.........
        if ($passwordOldEncryption == $data['pw'] && !empty($data['pw'])) {
            //update user's password
            $data['pw'] = bCrypt($passwordClear, COST);
            DB::update(prefix_table('users'), array('pw' => $data['pw']), "id=%i", $data['id']);
        }
        if (crypt($passwordClear, $data['pw']) == $data['pw'] && !empty($data['pw'])) {
            //update user's password
            $data['pw'] = $pwdlib->createPasswordHash($passwordClear);
            DB::update(prefix_table('users'), array('pw' => $data['pw']), "id=%i", $data['id']);
        }
        // check the given password
        if ($pwdlib->verifyPasswordHash($passwordClear, $data['pw']) === true) {
            $userPasswordVerified = true;
        } else {
            $userPasswordVerified = false;
        }
        if ($debugDuo == 1) {
            fputs($dbgDuo, "User's password verified: " . $userPasswordVerified . "\n");
        }
        // Can connect if
        // 1- no LDAP mode + user enabled + pw ok
        // 2- LDAP mode + user enabled + ldap connection ok + user is not admin
        // 3-  LDAP mode + user enabled + pw ok + usre is admin
        // This in order to allow admin by default to connect even if LDAP is activated
        if (isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 0 && $userPasswordVerified == true && $data['disabled'] == 0 || isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $ldapConnection == true && $data['disabled'] == 0 && $username != "admin" || isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 2 && $ldapConnection == true && $data['disabled'] == 0 && $username != "admin" || isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $username == "admin" && $userPasswordVerified == true && $data['disabled'] == 0) {
            $_SESSION['autoriser'] = true;
            // Generate a ramdom ID
            $key = $pwdlib->getRandomToken(50);
            if ($debugDuo == 1) {
                fputs($dbgDuo, "User's token: " . $key . "\n");
            }
            // Log into DB the user's connection
            if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) {
                logEvents('user_connection', 'connection', $data['id']);
            }
            // Save account in SESSION
            $_SESSION['login'] = stripslashes($username);
            $_SESSION['name'] = stripslashes($data['name']);
            $_SESSION['lastname'] = stripslashes($data['lastname']);
            $_SESSION['user_id'] = $data['id'];
            $_SESSION['user_admin'] = $data['admin'];
            $_SESSION['user_manager'] = $data['gestionnaire'];
            $_SESSION['user_read_only'] = $data['read_only'];
            $_SESSION['last_pw_change'] = $data['last_pw_change'];
            $_SESSION['last_pw'] = $data['last_pw'];
            $_SESSION['can_create_root_folder'] = $data['can_create_root_folder'];
            $_SESSION['key'] = $key;
            $_SESSION['personal_folder'] = $data['personal_folder'];
            $_SESSION['user_language'] = $data['user_language'];
            $_SESSION['user_email'] = $data['email'];
            $_SESSION['user_ga'] = $data['ga'];
            $_SESSION['user_avatar'] = $data['avatar'];
            $_SESSION['user_avatar_thumb'] = $data['avatar_thumb'];
            $_SESSION['user_upgrade_needed'] = $data['upgrade_needed'];
            // manage session expiration
            $serverTime = time();
            if ($dataReceived['TimezoneOffset'] > 0) {
                $userTime = $serverTime + $dataReceived['TimezoneOffset'];
            } else {
                $userTime = $serverTime;
            }
            $_SESSION['fin_session'] = $userTime + $dataReceived['duree_session'] * 60;
            /* If this option is set user password MD5 is used as personal SALTKey */
            if (isset($_SESSION['settings']['use_md5_password_as_salt']) && $_SESSION['settings']['use_md5_password_as_salt'] == 1) {
                $_SESSION['my_sk'] = md5($passwordClear);
                setcookie("TeamPass_PFSK_" . md5($_SESSION['user_id']), encrypt($_SESSION['my_sk'], ""), time() + 60 * 60 * 24 * $_SESSION['settings']['personal_saltkey_cookie_duration'], '/');
开发者ID:chansolo,项目名称:TeamPass,代码行数:67,代码来源:identify.php

示例2: stripslashes

                 $y = $pdf->GetY();
                 //Draw
                 $pdf->Rect($x, $y, $w, $h);
                 //Write
                 $pdf->MultiCell($w, 5, stripslashes($record[$table[$i]]), 0, $a);
                 //go to right
                 $pdf->SetXY($x + $w, $y);
             }
             //return to line
             $pdf->Ln($h);
         }
         $pdf_file = "print_out_pdf_" . date("Y-m-d", mktime(0, 0, 0, date('m'), date('d'), date('y'))) . "_" . generateKey() . ".pdf";
         //send the file
         $pdf->Output($_SESSION['settings']['path_to_files_folder'] . "/" . $pdf_file);
         //log
         logEvents('pdf_export', "", $_SESSION['user_id'], $_SESSION['login']);
         //clean table
         DB::query("TRUNCATE TABLE " . prefix_table("export"));
         echo '[{"text":"<a href=\'' . $_SESSION['settings']['url_to_files_folder'] . '/' . $pdf_file . '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]';
     }
     break;
     //CASE export in CSV format
 //CASE export in CSV format
 case "export_to_csv_format":
     $full_listing = array();
     $full_listing[0] = array('id' => "id", 'label' => "label", 'description' => "description", 'pw' => "pw", 'login' => "login", 'restricted_to' => "restricted_to", 'perso' => "perso");
     $id_managed = '';
     $i = 1;
     $items_id_list = array();
     foreach (explode(';', $_POST['ids']) as $id) {
         if (!in_array($id, $_SESSION['forbiden_pfs']) && in_array($id, $_SESSION['groupes_visibles'])) {
开发者ID:br0ziliy,项目名称:TeamPass,代码行数:31,代码来源:export.queries.php

示例3: array

         * UPDATE CAN CREATE ROOT FOLDER RIGHT
         */
        case "user_edit_login":
            // Check KEY
            if ($_POST['key'] != $_SESSION['key']) {
                // error
                exit;
            }
            DB::update(prefix_table("users"), array('login' => $_POST['login'], 'name' => $_POST['name'], 'lastname' => $_POST['lastname']), "id = %i", $_POST['id']);
            break;
    }
} elseif (!empty($_POST['newValue'])) {
    $value = explode('_', $_POST['id']);
    DB::update(prefix_table("users"), array($value[0] => $_POST['newValue']), "id = %i", $value[1]);
    // update LOG
    logEvents('user_mngt', 'at_user_new_' . $value[0] . ':' . $value[1], $_SESSION['user_id'], $_SESSION['login'], $_POST['id']);
    // refresh SESSION if requested
    if ($value[0] == "treeloadstrategy") {
        $_SESSION['user_settings']['treeloadstrategy'] = $_POST['newValue'];
    }
    // Display info
    echo $_POST['newValue'];
} elseif (isset($_POST['newadmin'])) {
    $id = explode('_', $_POST['id']);
    DB::update(prefix_table("users"), array('admin' => $_POST['newadmin']), "id = %i", $id[1]);
    // Display info
    if ($_POST['newadmin'] == "1") {
        echo "Oui";
    } else {
        echo "Non";
    }
开发者ID:br0ziliy,项目名称:TeamPass,代码行数:31,代码来源:users.queries.php

示例4: mysqli_connect

    DB::$password = $pass;
    DB::$dbName = $database;
    DB::$port = $port;
    DB::$encoding = $encoding;
    DB::$error_handler = 'db_error_handler';
    $link = mysqli_connect($server, $user, $pass, $database, $port);
    $link->set_charset($encoding);
    // Include main functions used by TeamPass
    require_once 'sources/main.functions.php';
    // Update table by deleting ID
    if (isset($_SESSION['user_id'])) {
        DB::update($pre . "users", array('key_tempo' => ''), "id=%i", $_SESSION['user_id']);
    }
    //Log into DB the user's disconnection
    if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) {
        logEvents('user_connection', 'disconnection', $_SESSION['user_id'], $_SESSION['login']);
    }
} else {
    require_once $_SESSION['settings']['cpassman_dir'] . '/includes/language/english.php';
    echo '
    <div style="width:800px;margin:auto;">';
    if (@$_SESSION['error']['code'] == ERR_NOT_ALLOWED) {
        echo '
        <div class="ui-state-error ui-corner-all error" >' . $LANG['error_not_authorized'] . '</div>';
    } elseif (@$_SESSION['error']['code'] == ERR_NOT_EXIST) {
        echo '
        <div class="ui-state-error ui-corner-all error" >' . $LANG['error_not_exists'] . '</div>';
    } elseif (@$_SESSION['error']['code'] == ERR_SESS_EXPIRED) {
        echo '
        <div class="ui-state-error ui-corner-all error" style="text-align:center;" >' . $LANG['index_session_expired'] . '<br /><br /><a href="index.php" />' . $LANG['home'] . '</a></div>';
    } elseif (@$_SESSION['error']['code'] == ERR_NO_MCRYPT) {
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:31,代码来源:error.php

示例5: prefix_table

 case "admin_email_send_backlog":
     require_once $_SESSION['settings']['cpassman_dir'] . '/sources/main.functions.php';
     $rows = DB::query("SELECT * FROM " . prefix_table("emails") . " WHERE status = %s OR status = %s", "not_sent", "");
     foreach ($rows as $record) {
         //send email
         $ret = json_decode(@sendEmail($record['subject'], $record['body'], $record['receivers']));
         if (!empty($ret['error'])) {
             //update item_id in files table
             DB::update(prefix_table("emails"), array('status' => "not_sent"), "timestamp = %s", $record['timestamp']);
         } else {
             //delete from DB
             DB::delete(prefix_table("emails"), "timestamp = %s", $record['timestamp']);
         }
     }
     //update LOG
     logEvents('admin_action', 'Emails backlog', $_SESSION['user_id'], $_SESSION['login']);
     echo '[{"result":"admin_email_send_backlog", ' . @sendEmail($LANG['admin_email_test_subject'], $LANG['admin_email_test_body'], $_SESSION['settings']['email_from']) . '}]';
     break;
     /*
      * Generate exchanges encryption keys
      */
 /*
  * Generate exchanges encryption keys
  */
 case "admin_action_generate_encrypt_keys":
     require_once "../includes/libraries/jCryption/jcryption.php";
     $keyLength = 1024;
     $jCryption = new jCryption();
     $numberOfPairs = 100;
     $arrKeyPairs = array();
     for ($i = 0; $i < $numberOfPairs; $i++) {
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:31,代码来源:admin.queries.php

示例6: intval

     //send back the random key
     $return = $data_received['randomstring'];
 } else {
     if ($data['disabled'] == 1) {
         //User and password is okay but account is locked
         $return = "user_is_locked";
     } else {
         //User exists in the DB but Password is false
         //check if user is locked
         $user_is_locked = 0;
         $nb_attempts = intval($data['no_bad_attempts'] + 1);
         if ($_SESSION['settings']['nb_bad_authentication'] > 0 && intval($_SESSION['settings']['nb_bad_authentication']) < $nb_attempts) {
             $user_is_locked = 1;
             //log it
             if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) {
                 logEvents('user_locked', 'connection', $data['id']);
             }
         }
         $db->query_update("users", array('key_tempo' => $_SESSION['key'], 'last_connexion' => mktime(date("h"), date("i"), date("s"), date("m"), date("d"), date("Y")), 'disabled' => $user_is_locked, 'no_bad_attempts' => $nb_attempts), "id=" . $data['id']);
         //What return shoulb we do
         if ($user_is_locked == 1) {
             $return = "user_is_locked";
         } else {
             if ($_SESSION['settings']['nb_bad_authentication'] == 0) {
                 $return = "false";
             } else {
                 $return = $nb_attempts;
             }
         }
     }
 }
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:main.queries.php

示例7: rest_get


//.........这里部分代码省略.........
                // Empty user
                if (mysqli_escape_string($link, htmlspecialchars_decode($login)) == "") {
                    rest_error('USERLOGINEMPTY');
                }
                // Check if user already exists
                $data = DB::query("SELECT id, fonction_id, groupes_interdits, groupes_visibles FROM " . prefix_table("users") . "\n            WHERE login LIKE %ss", mysqli_escape_string($link, stripslashes($login)));
                if (DB::count() == 0) {
                    try {
                        // find AdminRole code in DB
                        $resRole = DB::queryFirstRow("SELECT id\n                            FROM " . prefix_table("roles_title") . "\n                            WHERE title LIKE %ss", mysqli_escape_string($link, stripslashes($adminby)));
                        // get default language
                        $lang = DB::queryFirstRow("SELECT `valeur` FROM " . prefix_table("misc") . " WHERE type = %s AND intitule = %s", "admin", "default_language");
                        // prepare roles list
                        $rolesList = "";
                        foreach (explode('|', $roles) as $role) {
                            echo $role . "-";
                            $tmp = DB::queryFirstRow("SELECT `id` FROM " . prefix_table("roles_title") . " WHERE title = %s", $role);
                            if (empty($rolesList)) {
                                $rolesList = $tmp['id'];
                            } else {
                                $rolesList .= ";" . $tmp['id'];
                            }
                        }
                        // Add user in DB
                        DB::insert(prefix_table("users"), array('login' => $login, 'name' => $name, 'lastname' => $lastname, 'pw' => bCrypt(stringUtf8Decode($password), COST), 'email' => $email, 'admin' => intval($isadmin), 'gestionnaire' => intval($ismanager), 'read_only' => intval($isreadonly), 'personal_folder' => intval($haspf), 'user_language' => $lang['valeur'], 'fonction_id' => $rolesList, 'groupes_interdits' => '0', 'groupes_visibles' => '0', 'isAdministratedByRole' => empty($resRole) ? '0' : $resRole['id']));
                        $new_user_id = DB::insertId();
                        // Create personnal folder
                        if (intval($haspf) == 1) {
                            DB::insert(prefix_table("nested_tree"), array('parent_id' => '0', 'title' => $new_user_id, 'bloquer_creation' => '0', 'bloquer_modification' => '0', 'personal_folder' => '1'));
                        }
                        // Send email to new user
                        @sendEmail($LANG['email_subject_new_user'], str_replace(array('#tp_login#', '#tp_pw#', '#tp_link#'), array(" " . addslashes($login), addslashes($password), $_SESSION['settings']['email_server_url']), $LANG['email_new_user_mail']), $email);
                        // update LOG
                        logEvents('user_mngt', 'at_user_added', 'api - ' . $GLOBALS['apikey'], $new_user_id);
                        echo '{"status":"user added"}';
                    } catch (PDOException $ex) {
                        echo '<br />' . $ex->getMessage();
                    }
                } else {
                    rest_error('USERALREADYEXISTS');
                }
            }
        } elseif ($GLOBALS['request'][0] == "auth") {
            /*
             ** FOR SECURITY PURPOSE, it is mandatory to use SSL to connect your teampass instance. The user password is not encrypted!
             **
             **
             ** Expected call format: .../api/index.php/auth/<PROTOCOL>/<URL>/<login>/<password>?apikey=<VALID API KEY>
             ** Example: https://127.0.0.1/teampass/api/index.php/auth/http/www.zadig-tge.adp.com/U1/test/76?apikey=chahthait5Aidood6johh6Avufieb6ohpaixain
             ** RESTRICTIONS:
             **              - <PROTOCOL>        ==> http|https|ftp|...
             **              - <URL>             ==> encode URL without protocol (example: http://www.teampass.net becomes www.teampass.net)
             **              - <login>           ==> user's login
             **              - <password>        ==> currently clear password
             **
             ** RETURNED ANSWER:
             **              - format sent back is JSON
             **              - Example: {"<item_id>":{"label":"<pass#1>","login":"<login#1>","pw":"<pwd#1>"},"<item_id>":{"label":"<pass#2>","login":"<login#2>","pw":"<pwd#2>"}}
             **
             */
            // get user credentials
            if (isset($GLOBALS['request'][3]) && isset($GLOBALS['request'][4])) {
                // get url
                if (isset($GLOBALS['request'][1]) && isset($GLOBALS['request'][2])) {
                    // is user granted?
                    $user = DB::queryFirstRow("SELECT `id`, `pw`, `groupes_interdits`, `groupes_visibles`, `fonction_id` FROM " . $pre . "users WHERE login = %s", $GLOBALS['request'][3]);
开发者ID:br0ziliy,项目名称:TeamPass,代码行数:67,代码来源:functions.php

示例8: array

             }
         }
         // update cron time
         DB::update(prefix_table("misc"), array('valeur' => time()), "intitule = %s AND type = %s", "sending_emails", "cron");
     }
     break;
     /**
      * Store error
      */
 /**
  * Store error
  */
 case "store_error":
     if (!empty($_SESSION['user_id'])) {
         // update DB
         logEvents('error', urldecode($_POST['error']), $_SESSION['user_id'], $_SESSION['login']);
     }
     break;
     /**
      * Generate a password generic
      */
 /**
  * Generate a password generic
  */
 case "generate_a_password":
     if ($_POST['size'] > $_SESSION['settings']['pwd_maximum_length']) {
         echo prepareExchangedData(array("error_msg" => "Password length is too long!", "error" => "true"), "encode");
         break;
     }
     //Load PWGEN
     $pwgen = new SplClassLoader('Encryption\\PwGen', '../includes/libraries');
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:31,代码来源:main.queries.php

示例9: html_entity_decode

                     if ($i == 3) {
                         $item[$i] = html_entity_decode(htmlspecialchars_decode(str_replace("<br />", "\n", $item[$i]), ENT_QUOTES));
                     }
                     $pdf->MultiCell($w, 5, $item[$i], 0, $a);
                     //go to right
                     $pdf->SetXY($x + $w, $y);
                 }
                 //return to line
                 $pdf->Ln($h);
             }
         }
         $pdf_file = "print_out_pdf_" . date("Y-m-d", mktime(0, 0, 0, date('m'), date('d'), date('y'))) . "_" . generateKey() . ".pdf";
         //send the file
         $pdf->Output($_SESSION['settings']['path_to_files_folder'] . "/" . $pdf_file);
         //log
         logEvents('pdf_export', implode(';', $printed_ids), $_SESSION['user_id']);
         echo '[{"text":"<a href=\'' . $_SESSION['settings']['url_to_files_folder'] . '/' . $pdf_file . '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]';
     }
     break;
     //CASE export in CSV format
 //CASE export in CSV format
 case "export_to_csv_format":
     $full_listing = array();
     $full_listing[0] = array('id' => "id", 'label' => "label", 'description' => "description", 'pw' => "pw", 'login' => "login", 'restricted_to' => "restricted_to", 'perso' => "perso");
     $id_managed = '';
     $i = 1;
     $items_id_list = array();
     foreach (explode(';', $_POST['ids']) as $id) {
         if (!in_array($id, $_SESSION['forbiden_pfs']) && in_array($id, $_SESSION['groupes_visibles'])) {
             $rows = DB::query("SELECT i.id as id, i.restricted_to as restricted_to, i.perso as perso, i.label as label, i.description as description, i.pw as pw, i.login as login,\n                       l.date as date,\n                       n.renewal_period as renewal_period,\n                       k.rand_key\n                    FROM " . $pre . "items as i\n                    INNER JOIN " . $pre . "nested_tree as n ON (i.id_tree = n.id)\n                    INNER JOIN " . $pre . "log_items as l ON (i.id = l.id_item)\n                    INNER JOIN " . $pre . "keys as k ON (i.id = k.id)\n                    WHERE i.inactif = %i\n                    AND i.id_tree= %i\n                    AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))\n                    ORDER BY i.label ASC, l.date DESC", "0", intval($id), "at_creation", "at_modification", "at_pw :%");
             foreach ($rows as $reccord) {
开发者ID:jonathandietz,项目名称:TeamPass,代码行数:31,代码来源:export.queries.php


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