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


PHP prepareExchangedData函数代码示例

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


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

示例1: prepareExchangedData

     echo $return_values;
     break;
     /**
      * EDIT user
      */
 /**
  * EDIT user
  */
 case "store_user_changes":
     // Check KEY
     if ($_POST['key'] != $_SESSION['key']) {
         // error
         exit;
     }
     // decrypt and retreive data in JSON format
     $dataReceived = prepareExchangedData($_POST['data'], "decode");
     // Empty user
     if (mysqli_escape_string($link, htmlspecialchars_decode($dataReceived['login'])) == "") {
         echo '[ { "error" : "' . addslashes($LANG['error_empty_data']) . '" } ]';
         break;
     }
     $account_status_action = mysqli_escape_string($link, htmlspecialchars_decode($dataReceived['action_on_user']));
     // delete account
     // delete user in database
     if ($account_status_action == "delete") {
         DB::delete(prefix_table("users"), "id = %i", $_POST['id']);
         // delete personal folder and subfolders
         $data = DB::queryfirstrow("SELECT id FROM " . prefix_table("nested_tree") . "\n                    WHERE title = %s AND personal_folder = %i", $_POST['id'], "1");
         // Get through each subfolder
         if (!empty($data['id'])) {
             $folders = $tree->getDescendants($data['id'], true);
开发者ID:br0ziliy,项目名称:TeamPass,代码行数:31,代码来源:users.queries.php

示例2: identifyUser

function identifyUser($sentData)
{
    global $debugLdap, $debugDuo, $k;
    include $_SESSION['settings']['cpassman_dir'] . '/includes/settings.php';
    header("Content-type: text/html; charset=utf-8");
    error_reporting(E_ERROR);
    require_once $_SESSION['settings']['cpassman_dir'] . '/sources/main.functions.php';
    require_once $_SESSION['settings']['cpassman_dir'] . '/sources/SplClassLoader.php';
    if ($debugDuo == 1) {
        $dbgDuo = fopen($_SESSION['settings']['path_to_files_folder'] . "/duo.debug.txt", "a");
    }
    /*
    if (empty($sentData) && isset($_COOKIE['TeamPassC'])) {
    	$sentData = prepareExchangedData($_COOKIE['TeamPassC'], "encode");
    	setcookie('TeamPassC', "", time()-3600);
    }
    */
    if ($debugDuo == 1) {
        fputs($dbgDuo, "Content of data sent '" . $sentData . "'\n");
    }
    // connect to the server
    require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
    DB::$host = $server;
    DB::$user = $user;
    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);
    //Load AES
    $aes = new SplClassLoader('Encryption\\Crypt', '../includes/libraries');
    $aes->register();
    // load passwordLib library
    $pwdlib = new SplClassLoader('PasswordLib', '../includes/libraries');
    $pwdlib->register();
    $pwdlib = new PasswordLib\PasswordLib();
    // User's language loading
    $k['langage'] = @$_SESSION['user_language'];
    require_once $_SESSION['settings']['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
    // decrypt and retreive data in JSON format
    $dataReceived = prepareExchangedData($sentData, "decode");
    // Prepare variables
    $passwordClear = htmlspecialchars_decode($dataReceived['pw']);
    $passwordOldEncryption = encryptOld(htmlspecialchars_decode($dataReceived['pw']));
    $username = htmlspecialchars_decode($dataReceived['login']);
    $logError = "";
    if ($debugDuo == 1) {
        fputs($dbgDuo, "Starting authentication of '" . $username . "'\n");
    }
    // GET SALT KEY LENGTH
    if (strlen(SALT) > 32) {
        $_SESSION['error']['salt'] = true;
    }
    $_SESSION['user_language'] = $k['langage'];
    $ldapConnection = false;
    /* LDAP connection */
    if ($debugLdap == 1) {
        // create temp file
        $dbgLdap = fopen($_SESSION['settings']['path_to_files_folder'] . "/ldap.debug.txt", "w");
        fputs($dbgLdap, "Get all LDAP params : \n" . 'mode : ' . $_SESSION['settings']['ldap_mode'] . "\n" . 'type : ' . $_SESSION['settings']['ldap_type'] . "\n" . 'base_dn : ' . $_SESSION['settings']['ldap_domain_dn'] . "\n" . 'search_base : ' . $_SESSION['settings']['ldap_search_base'] . "\n" . 'bind_dn : ' . $_SESSION['settings']['ldap_bind_dn'] . "\n" . 'bind_passwd : ' . $_SESSION['settings']['ldap_bind_passwd'] . "\n" . 'user_attribute : ' . $_SESSION['settings']['ldap_user_attribute'] . "\n" . 'account_suffix : ' . $_SESSION['settings']['ldap_suffix'] . "\n" . 'domain_controllers : ' . $_SESSION['settings']['ldap_domain_controler'] . "\n" . 'use_ssl : ' . $_SESSION['settings']['ldap_ssl'] . "\n" . 'use_tls : ' . $_SESSION['settings']['ldap_tls'] . "\n*********\n\n");
    }
    if ($debugDuo == 1) {
        fputs($dbgDuo, "LDAP status: " . $_SESSION['settings']['ldap_mode'] . "\n");
    }
    if (isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $username != "admin") {
        //Multiple Domain Names
        if (strpos(html_entity_decode($username), '\\') == true) {
            $ldap_suffix = "@" . substr(html_entity_decode($username), 0, strpos(html_entity_decode($username), '\\'));
            $username = substr(html_entity_decode($username), strpos(html_entity_decode($username), '\\') + 1);
        }
        if ($_SESSION['settings']['ldap_type'] == 'posix-search') {
            $ldapconn = ldap_connect($_SESSION['settings']['ldap_domain_controler']);
            if ($debugLdap == 1) {
                fputs($dbgLdap, "LDAP connection : " . ($ldapconn ? "Connected" : "Failed") . "\n");
            }
            ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
            if ($ldapconn) {
                $ldapbind = ldap_bind($ldapconn, $_SESSION['settings']['ldap_bind_dn'], $_SESSION['settings']['ldap_bind_passwd']);
                if ($debugLdap == 1) {
                    fputs($dbgLdap, "LDAP bind : " . ($ldapbind ? "Bound" : "Failed") . "\n");
                }
                if ($ldapbind) {
                    $filter = "(&(" . $_SESSION['settings']['ldap_user_attribute'] . "={$username})(objectClass=posixAccount))";
                    $result = ldap_search($ldapconn, $_SESSION['settings']['ldap_search_base'], $filter, array('dn'));
                    if ($debugLdap == 1) {
                        fputs($dbgLdap, 'Search filter : ' . $filter . "\n" . 'Results : ' . print_r(ldap_get_entries($ldapconn, $result), true) . "\n");
                    }
                    if (ldap_count_entries($ldapconn, $result)) {
                        // try auth
                        $result = ldap_get_entries($ldapconn, $result);
                        $user_dn = $result[0]['dn'];
                        $ldapbind = ldap_bind($ldapconn, $user_dn, $passwordClear);
                        if ($ldapbind) {
                            $ldapConnection = true;
                        } else {
                            $ldapConnection = false;
                        }
                    }
//.........这里部分代码省略.........
开发者ID:chansolo,项目名称:TeamPass,代码行数:101,代码来源:identify.php

示例3: substr

                    $findPfGroup = "";
                    $init_personal_folder = true;
                }
            }
            // prepare new line
            $sOutput .= '<li ondblclick="' . $action_dbl . '" class="item" id="' . $record['id'] . '" style="margin-left:-30px;"><a id="fileclass' . $record['id'] . '" class="file_search" onclick="' . $action . '"><i class="fa fa-key mi-yellow"></i>&nbsp;' . substr(stripslashes($record['label']), 0, 65);
            if (!empty($record['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) {
                $tempo = explode("<br />", $record['description']);
                if (count($tempo) == 1) {
                    $sOutput .= '&nbsp;<font size="2px">[' . strip_tags(stripslashes(substr(cleanString($record['description']), 0, 30))) . ']</font>';
                } else {
                    $sOutput .= '&nbsp;<font size="2px">[' . strip_tags(stripslashes(substr(cleanString($tempo[0]), 0, 30))) . ']</font>';
                }
            }
            // set folder
            $sOutput .= '&nbsp;<span style="font-size:11px;font-style:italic;"><i class="fa fa-folder-o"></i>&nbsp;' . strip_tags(stripslashes(substr(cleanString($record['folder']), 0, 30))) . '</span>';
            $sOutput .= '<span style="float:right;margin:2px 10px 0px 0px;">';
            // Prepare make Favorite small icon
            $sOutput .= '&nbsp;<span id="quick_icon_fav_' . $record['id'] . '" title="Manage Favorite" class="cursor tip">';
            if (in_array($record['id'], $_SESSION['favourites'])) {
                $sOutput .= '<i class="fa fa-star mi-yellow fa-lg" onclick="ActionOnQuickIcon(' . $record['id'] . ',0)" class="tip"></i>&nbsp;';
            } else {
                $sOutput .= '<i class="fa fa-star-o fa-lg" onclick="ActionOnQuickIcon(' . $record['id'] . ',1)" class="tip"></i>&nbsp;';
            }
            $sOutput .= "</span>";
            $sOutput .= '</li>';
        }
        $returnValues = array("items_html" => $sOutput, "message" => str_replace("%X%", $iFilteredTotal, $LANG['find_message']));
        echo prepareExchangedData($returnValues, "encode");
    }
}
开发者ID:chansolo,项目名称:TeamPass,代码行数:31,代码来源:find.queries.php

示例4: array

            if ($dataReceived['field'] == "restricted_to_input" && $dataReceived['value'] == "0") {
                DB::update(prefix_table("misc"), array('valeur' => 0), "type = %s AND intitule = %s", $type, 'restricted_to_roles');
            }
        }
        /* else
           if ($dataReceived['field'] == "use_md5_password_as_salt" && $dataReceived['value'] == "0") {
               // in case this option is changed, we need to warn the users to adapt
               $rows = DB::query(
                   "SELECT id FROM ".prefix_table("users")."
                   WHERE admin != %i",
                   "",
                   "1"
               );
               foreach ($rows as $record) {
                   DB::update(
                       prefix_table("users"),
                       array(
                           'upgrade_needed' => "1"
                       ),
                       "id = %i"
                   );
               }
           }*/
        // store in SESSION
        $_SESSION['settings'][$dataReceived['field']] = $dataReceived['value'];
        // save change in config file
        handleConfigFile("update", $dataReceived['field'], $dataReceived['value']);
        // Encrypt data to return
        echo prepareExchangedData(array("error" => "", "misc" => $counter . " ; " . $_SESSION['settings'][$dataReceived['field']]), "encode");
        break;
}
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:31,代码来源:admin.queries.php

示例5: SplClassLoader

     $pwgen = new SplClassLoader('Encryption\\PwGen', '../includes/libraries');
     $pwgen->register();
     $pwgen = new Encryption\PwGen\pwgen();
     $pwgen->setLength($_POST['size']);
     if (isset($_POST['secure']) && $_POST['secure'] == "true") {
         $pwgen->setSecure(true);
         $pwgen->setSymbols(true);
         $pwgen->setCapitalize(true);
         $pwgen->setNumerals(true);
     } else {
         $pwgen->setSecure($_POST['secure'] == "true" ? true : false);
         $pwgen->setNumerals($_POST['numerals'] == "true" ? true : false);
         $pwgen->setCapitalize($_POST['capitalize'] == "true" ? true : false);
         $pwgen->setSymbols($_POST['symbols'] == "true" ? true : false);
     }
     echo prepareExchangedData(array("key" => $pwgen->generate(), "error" => ""), "encode");
     break;
     /**
      * Check if user exists and send back if psk is set
      */
 /**
  * Check if user exists and send back if psk is set
  */
 case "check_login_exists":
     $data = DB::query("SELECT login, psk FROM " . prefix_table("users") . "\n            WHERE login = %i", mysqli_escape_string($link, stripslashes($_POST['userId'])));
     if (empty($data['login'])) {
         $userOk = false;
     } else {
         $userOk = true;
     }
     if (isset($_SESSION['settings']['psk_authentication']) && $_SESSION['settings']['psk_authentication'] == 1 && !empty($data['psk'])) {
开发者ID:chansolo,项目名称:TeamPass,代码行数:31,代码来源:main.queries.php

示例6: mysqli_connect

//Class loader
require_once $_SESSION['settings']['cpassman_dir'] . '/sources/SplClassLoader.php';
// Connect to mysql server
require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
DB::$host = $server;
DB::$user = $user;
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);
// Check KEY and rights
if (!isset($_POST['key']) || $_POST['key'] != $_SESSION['key']) {
    echo prepareExchangedData(array("error" => "ERR_KEY_NOT_CORRECT"), "encode");
    break;
}
// Do asked action
if (isset($_POST['type'])) {
    switch ($_POST['type']) {
        /*
         * CASE
         * log if item's password is shown
         */
        case "item_password_shown":
            if (isset($_SESSION['settings']['log_accessed']) && $_SESSION['settings']['log_accessed'] == 1) {
                DB::insert(prefix_table("log_items"), array('id_item' => $_POST['id_item'], 'date' => time(), 'id_user' => $_SESSION['user_id'], 'action' => 'at_password_shown'));
            }
            break;
            /*
开发者ID:br0ziliy,项目名称:TeamPass,代码行数:31,代码来源:items.logs.php

示例7: meekrodb_error_handler

function meekrodb_error_handler($params)
{
    /*if (isset($params['query'])) $out[] = "QUERY: " . $params['query'];
      if (isset($params['error'])) $out[] = "ERROR: " . $params['error'];
      $out[] = "";
      
      
      if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
        echo implode("\n", $out);
      } else {
        echo implode("<br>\n", $out);
      }
      */
    echo prepareExchangedData('[{"error" : "' . $params['error'] . '"}]', "encode");
    die;
}
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:16,代码来源:db.class.php

示例8: intval

             // end
             $html .= '
                     </tr>';
             $x++;
         }
     }
     // check if end
     $next_start = intval($_POST['from']) + intval($_POST['nb']);
     DB::query("SELECT * FROM " . prefix_table("users"));
     if ($next_start > DB::count()) {
         $end_is_reached = 1;
     } else {
         $end_is_reached = 0;
     }
     //echo $html;
     echo prepareExchangedData(array("html" => $html, "error" => "", "from" => $next_start, "end_reached" => $end_is_reached), "encode");
     break;
     /**
      * UPDATE CAN CREATE ROOT FOLDER RIGHT
      */
 /**
  * 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;
开发者ID:ariostea74,项目名称:TeamPass,代码行数:31,代码来源:users.queries.php

示例9: prepareExchangedData

 if ($_POST['key'] != $_SESSION['key']) {
     echo '[{"error" : "something_wrong"}]';
     break;
 }
 if (empty($_POST['currentId'])) {
     echo '[{"error" : "No ID provided"}]';
     break;
 }
 if (empty($_SESSION['my_sk'])) {
     echo '[{"error" : "No personnal saltkey provided"}]';
     break;
 }
 if (isset($_POST['data_to_share'])) {
     // ON DEMAND
     //decrypt and retreive data in JSON format
     $dataReceived = prepareExchangedData(str_replace("'", '"', $_POST['data_to_share']), "decode");
     //Prepare variables
     $personal_sk = htmlspecialchars_decode($dataReceived['sk']);
     $oldPersonalSaltkey = htmlspecialchars_decode($dataReceived['old_sk']);
     if (empty($oldPersonalSaltkey)) {
         $oldPersonalSaltkey = $_SESSION['my_sk'];
     }
     if (empty($personal_sk)) {
         echo '[{"error" : "No personal saltkey provided"}]';
         break;
     }
     // get data about pw
     $data = DB::queryfirstrow("SELECT id, pw, pw_iv\n                FROM " . prefix_table("items") . "\n                WHERE id = %i", $_POST['currentId']);
     // check if current encryption protocol #3
     if (!empty($data['pw_iv']) && !empty($data['pw'])) {
         // decrypt it
开发者ID:ariostea74,项目名称:TeamPass,代码行数:31,代码来源:utils.queries.php

示例10: array

                $ret_server = $ssh->exec('echo -e "' . $dataReceived['new_pwd'] . '\\n' . $dataReceived['new_pwd'] . '" | passwd ' . $dataItem['login']);
                if (strpos($ret_server, "updated successfully") !== false) {
                    $err = false;
                } else {
                    $err = true;
                }
                $ret .= $ret_server . "</div>";
            }
        }
        if ($err == false) {
            // store new password
            DB::update(prefix_table("items"), array('pw' => $encrypt['string'], 'pw_iv' => $encrypt['iv']), "id = %i", $dataReceived['currentId']);
            // update log
            logItems($dataReceived['currentId'], $dataItem['label'], $_SESSION['user_id'], 'at_modification', $_SESSION['login'], 'at_pw :' . $oldPw, $oldPwIV);
            $ret .= "<br />" . $LANG['ssh_action_performed'];
        } else {
            $ret .= "<br /><i class='fa fa-warning'></i>&nbsp;" . $LANG['ssh_action_performed_with_error'] . "<br />";
        }
        // finished
        echo prepareExchangedData(array("error" => "", "text" => str_replace(array("\n"), array("<br />"), $ret)), "encode");
        break;
    case "server_auto_update_password_frequency":
        if ($_POST['key'] != $_SESSION['key'] || !isset($_POST['id']) || !isset($_POST['freq'])) {
            echo '[{"error" : "something_wrong"}]';
            break;
        }
        // store new frequency
        DB::update(prefix_table("items"), array('auto_update_pwd_frequency' => $_POST['freq'], 'auto_update_pwd_next_date' => time() + 2592000 * intval($_POST['freq'])), "id = %i", $_POST['id']);
        echo '[{"error" : ""}]';
        break;
}
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:31,代码来源:utils.queries.php

示例11: isset

                        $reason[1] = "";
                    }
                }
                // imported via API
                if ($record['login'] == "") {
                    $record['login'] = $LANG['imported_via_api'];
                }
                if (!empty($reason[1]) || $record['action'] == "at_copy" || $record['action'] == "at_creation" || $record['action'] == "at_manual" || $record['action'] == "at_modification" || $record['action'] == "at_delete" || $record['action'] == "at_restored") {
                    $avatar = isset($record['avatar_thumb']) && !empty($record['avatar_thumb']) ? $_SESSION['settings']['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb'] : $_SESSION['settings']['cpassman_url'] . '/includes/images/photo.jpg';
                    $history .= '<tr style="">' . '<td rowspan="2" style="width:40px;"><img src="' . $avatar . '" style="border-radius:20px; height:35px;"></td>' . '<td colspan="2" style="font-size:11px;"><i>' . $LANG['by'] . ' ' . $record['login'] . ' ' . $LANG['at'] . ' ' . date($_SESSION['settings']['date_format'] . ' ' . $_SESSION['settings']['time_format'], $record['date']) . '</i></td></tr>' . '<tr style="border-bottom:3px solid #C9C9C9;"><td style="width:100px;"><b>' . $LANG[$record['action']] . '</b></td>' . '<td style="">' . (!empty($record['raison']) ? count($reason) > 1 ? $LANG[trim($reason[0])] . ' : ' . handleBackslash($reason[1]) : ($record['action'] == "at_manual" ? $reason[0] : $LANG[trim($reason[0])]) : '') . '</td>' . '</tr>' . '<tr></tr>';
                }
            }
            $history .= "</table>";
            $data = array('error' => "", 'new_html' => $history);
            // send data
            echo prepareExchangedData($data, "encode");
            break;
    }
}
// Build the QUERY in case of GET
if (isset($_GET['type'])) {
    switch ($_GET['type']) {
        /*
         * CASE
         * Autocomplet for TAGS
         */
        case "autocomplete_tags":
            // Get a list off all existing TAGS
            $listOfTags = "";
            $rows = DB::query("SELECT tag FROM " . prefix_table("tags") . " WHERE tag LIKE %ss GROUP BY tag", $_GET['term']);
            foreach ($rows as $record) {
开发者ID:nilsteampassnet,项目名称:TeamPass,代码行数:31,代码来源:items.queries.php


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