本文整理汇总了PHP中decrypt_string函数的典型用法代码示例。如果您正苦于以下问题:PHP decrypt_string函数的具体用法?PHP decrypt_string怎么用?PHP decrypt_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decrypt_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_user
/**
* Validate the user session based on user name and password hash.
*
* @param string $user_name -- The user name to create a session for
* @param string $password -- The MD5 sum of the user's password
* @return true -- If the session is created
* @return false -- If the session is not created
*/
function validate_user($user_name, $password)
{
global $server, $current_user, $sugar_config;
$user = BeanFactory::getBean('Users');
$user->user_name = $user_name;
$authController = AuthenticationController::getInstance();
// Check to see if the user name and password are consistent.
if ($user->authenticate_user($password)) {
// we also need to set the current_user.
$user->retrieve($user->id);
$current_user = $user;
login_success();
return true;
} else {
if (function_exists('mcrypt_cbc')) {
$password = decrypt_string($password);
if ($authController->login($user_name, $password) && isset($_SESSION['authenticated_user_id'])) {
$user->retrieve($_SESSION['authenticated_user_id']);
$current_user = $user;
login_success();
return true;
}
} else {
$GLOBALS['log']->fatal("SECURITY: failed attempted login for {$user_name} using SOAP api");
$server->setError("Invalid username and/or password");
return false;
}
}
}
示例2: get_password
/** Get password from session
* @return string
*/
function get_password()
{
$return = get_session("pwds");
if (is_array($return)) {
$return = $_COOKIE["adminer_key"] ? decrypt_string($return[0], $_COOKIE["adminer_key"]) : false;
}
return $return;
}
示例3: update_elements_champs
public function update_elements_champs($array, $id_element)
{
global $thisSite;
$PDO = new myPDO();
$temp = array();
$this->get_champs();
foreach ($array as $k => $row) {
if (is_numeric($k)) {
if (in_array($k, $this->list_champ_crypte)) {
$temp[$k] = crypt_string('KEY', $row);
} else {
$temp[$k] = $row;
}
}
}
// UPDATE les valeurs saisie par l'utilisateur elements_champs
foreach ($temp as $key => $data) {
$result = $PDO->free_requete("UPDATE " . $thisSite->PREFIXE_TBL_CLI . "elements_champs \n SET valeur = '{$data}'\n WHERE " . $thisSite->PREFIXE_TBL_CLI . "elements_champs.id_element = {$id_element}\n AND " . $thisSite->PREFIXE_TBL_CLI . "elements_champs.id = {$key}");
}
/* decrypter le valeurs pour le rendre à la vue */
foreach ($temp as $kk => $vv) {
if (in_array($kk, $this->list_champ_crypte)) {
$temp[$kk] = decrypt_string('KEY', $vv);
}
}
$this->valeurs = $temp;
}
示例4: login
/**
* Log the user into the application
*
* @param UserAuth array $user_auth -- Set user_name and password (password needs to be
* in the right encoding for the type of authentication the user is setup for. For Base
* sugar validation, password is the MD5 sum of the plain text password.
* @param String $application -- The name of the application you are logging in from. (Currently unused).
* @return Array(session_id, error) -- session_id is the id of the session that was
* created. Error is set if there was any error during creation.
*/
function login($user_auth, $application)
{
global $sugar_config, $system_config;
$error = new SoapError();
$user = new User();
$success = false;
//rrs
$system_config = new Administration();
$system_config->retrieveSettings('system');
$authController = new AuthenticationController(!empty($sugar_config['authenticationClass']) ? $sugar_config['authenticationClass'] : 'SugarAuthenticate');
//rrs
$isLoginSuccess = $authController->login($user_auth['user_name'], $user_auth['password'], array('passwordEncrypted' => true));
$usr_id = $user->retrieve_user_id($user_auth['user_name']);
if ($usr_id) {
$user->retrieve($usr_id);
}
if ($isLoginSuccess) {
if ($_SESSION['hasExpiredPassword'] == '1') {
$error->set_error('password_expired');
$GLOBALS['log']->fatal('password expired for user ' . $user_auth['user_name']);
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
return array('id' => -1, 'error' => $error);
}
// if
if (!empty($user) && !empty($user->id) && !$user->is_group) {
$success = true;
global $current_user;
$current_user = $user;
}
// if
} else {
if ($usr_id && isset($user->user_name) && $user->getPreference('lockout') == '1') {
$error->set_error('lockout_reached');
$GLOBALS['log']->fatal('Lockout reached for user ' . $user_auth['user_name']);
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
return array('id' => -1, 'error' => $error);
} else {
if (function_exists('mcrypt_cbc')) {
$password = decrypt_string($user_auth['password']);
$authController = new AuthenticationController(!empty($sugar_config['authenticationClass']) ? $sugar_config['authenticationClass'] : 'SugarAuthenticate');
if ($authController->login($user_auth['user_name'], $password) && isset($_SESSION['authenticated_user_id'])) {
$success = true;
}
// if
}
}
}
// else if
if ($success) {
session_start();
global $current_user;
//$current_user = $user;
login_success();
$current_user->loadPreferences();
$_SESSION['is_valid_session'] = true;
$_SESSION['ip_address'] = query_client_ip();
$_SESSION['user_id'] = $current_user->id;
$_SESSION['type'] = 'user';
$_SESSION['avail_modules'] = get_user_module_list($current_user);
$_SESSION['authenticated_user_id'] = $current_user->id;
$_SESSION['unique_key'] = $sugar_config['unique_key'];
$current_user->call_custom_logic('after_login');
return array('id' => session_id(), 'error' => $error);
}
$error->set_error('invalid_login');
$GLOBALS['log']->fatal('SECURITY: User authentication for ' . $user_auth['user_name'] . ' failed');
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
return array('id' => -1, 'error' => $error);
}
示例5: base64_encode
}
$key = base64_encode(DRIVER) . "-" . base64_encode(SERVER) . "-" . base64_encode($_GET["username"]);
if ($permanent[$key]) {
unset($permanent[$key]);
cookie("adminer_permanent", implode(" ", $permanent));
}
redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.'));
}
} elseif ($permanent && !$_SESSION["pwds"]) {
session_regenerate_id();
$private = $adminer->permanentLogin();
// try to decode even if not set
foreach ($permanent as $key => $val) {
list(, $cipher) = explode(":", $val);
list($driver, $server, $username) = array_map('base64_decode', explode("-", $key));
$_SESSION["pwds"][$driver][$server][$username] = decrypt_string(base64_decode($cipher), $private);
}
}
function auth_error($exception = null)
{
global $connection, $adminer, $token;
$session_name = session_name();
$error = "";
if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) {
$error = lang('Session support must be enabled.');
} elseif (isset($_GET["username"])) {
if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) {
$error = lang('Session expired, please login again.');
} else {
$password =& get_session("pwds");
if (isset($password)) {
示例6: login
/**
* Log the user into the application
*
* @param UserAuth array $user_auth -- Set user_name and password (password needs to be
* in the right encoding for the type of authentication the user is setup for. For Base
* sugar validation, password is the MD5 sum of the plain text password.
* @param String $application -- The name of the application you are logging in from. (Currently unused).
* @return Array(session_id, error) -- session_id is the id of the session that was
* created. Error is set if there was any error during creation.
*/
function login($user_auth, $application)
{
global $sugar_config, $system_config;
$error = new SoapError();
$user = new User();
$success = false;
//rrs
$system_config = new Administration();
$system_config->retrieveSettings('system');
$authController = new AuthenticationController(!empty($sugar_config['authenticationClass']) ? $sugar_config['authenticationClass'] : 'SugarAuthenticate');
//rrs
$user = $user->retrieve_by_string_fields(array('user_name' => $user_auth['user_name'], 'user_hash' => $user_auth['password'], 'deleted' => 0, 'status' => 'Active', 'portal_only' => 0));
if (!empty($user) && !empty($user->id) && !$user->is_group) {
$success = true;
global $current_user;
$current_user = $user;
} else {
if (function_exists('mcrypt_cbc')) {
$password = decrypt_string($user_auth['password']);
if ($authController->login($user_auth['user_name'], $password) && isset($_SESSION['authenticated_user_id'])) {
$success = true;
}
}
}
if ($success) {
session_start();
global $current_user;
//$current_user = $user;
login_success();
$current_user->loadPreferences();
$_SESSION['is_valid_session'] = true;
$_SESSION['ip_address'] = query_client_ip();
$_SESSION['user_id'] = $current_user->id;
$_SESSION['type'] = 'user';
$_SESSION['avail_modules'] = get_user_module_list($current_user);
$_SESSION['authenticated_user_id'] = $current_user->id;
$_SESSION['unique_key'] = $sugar_config['unique_key'];
$current_user->call_custom_logic('after_login');
return array('id' => session_id(), 'error' => $error);
}
$error->set_error('invalid_login');
$GLOBALS['log']->fatal('SECURITY: User authentication for ' . $user_auth['user_name'] . ' failed');
LogicHook::initialize();
$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
return array('id' => -1, 'error' => $error);
}
示例7: array
$mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "elements_champs";
$mySelect->fields = "id,valeur";
$mySelect->where = "id_element=:id_element";
$mySelect->whereValue["id_element"] = $vlistE['id'];
$listValeur[] = $mySelect->query();
}
$listFiltre = array();
foreach ($listChamp as $KLC => $ChampFiltre) {
foreach ($listChamp[$KLC] as $KeyLC => $VLC) {
$listFiltre[$KLC] = $VLC['filtre'];
}
}
// Injecter dans listChamps le tableaux des valeurs
$list_Champ_Valeur = array();
foreach ($listChamp as $Klistchamp => $Vlistchamp) {
$list_Champ_Valeur[$Klistchamp]['Champ'] = $Vlistchamp;
$list_Champ_Valeur[$Klistchamp]['Valeur'] = $listValeur[$Klistchamp];
}
// Décrypter les valeurs crypter
$newChampValeurs = array();
foreach ($list_Champ_Valeur as $kLCV => $value) {
foreach ($value['Champ'] as $kChamp => $vChamp) {
if (!empty($vChamp['filtre'])) {
$list_Champ_Valeur[$kLCV]['Valeur'][$kChamp]['valeur'] = decrypt_string("KEY", $value['Valeur'][$kChamp]['valeur']);
}
}
}
// Htmlspechialchars
foreach ($list_Champ_Valeur[0]['Valeur'] as $key => $data) {
$list_Champ_Valeur[0]['Valeur'][$key]['valeur'] = htmlspecialchars($data['valeur'], ENT_QUOTES);
}
示例8: update_rss_feed
function update_rss_feed($feed, $ignore_daemon = false, $no_cache = false)
{
$debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug'];
_debug("start", $debug_enabled);
$result = db_query("SELECT id,update_interval,auth_login,\n\t\t\tfeed_url,auth_pass,cache_images,last_updated,\n\t\t\tmark_unread_on_update, owner_uid,\n\t\t\tpubsub_state, auth_pass_encrypted,\n\t\t\t(SELECT max(date_entered) FROM\n\t\t\t\tttrss_entries, ttrss_user_entries where ref_id = id AND feed_id = '{$feed}') AS last_article_timestamp\n\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
if (db_num_rows($result) == 0) {
_debug("feed {$feed} NOT FOUND/SKIPPED", $debug_enabled);
return false;
}
$last_updated = db_fetch_result($result, 0, "last_updated");
$last_article_timestamp = @strtotime(db_fetch_result($result, 0, "last_article_timestamp"));
if (defined('_DISABLE_HTTP_304')) {
$last_article_timestamp = 0;
}
$owner_uid = db_fetch_result($result, 0, "owner_uid");
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
$pubsub_state = db_fetch_result($result, 0, "pubsub_state");
$auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result, 0, "auth_pass_encrypted"));
db_query("UPDATE ttrss_feeds SET last_update_started = NOW()\n\t\t\tWHERE id = '{$feed}'");
$auth_login = db_fetch_result($result, 0, "auth_login");
$auth_pass = db_fetch_result($result, 0, "auth_pass");
if ($auth_pass_encrypted) {
require_once "crypt.php";
$auth_pass = decrypt_string($auth_pass);
}
$cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
$fetch_url = db_fetch_result($result, 0, "feed_url");
$feed = db_escape_string($feed);
$date_feed_processed = date('Y-m-d H:i');
$cache_filename = CACHE_DIR . "/simplepie/" . sha1($fetch_url) . ".xml";
$pluginhost = new PluginHost();
$pluginhost->set_debug($debug_enabled);
$user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
$pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
$pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
$pluginhost->load_data();
$rss = false;
$rss_hash = false;
$force_refetch = isset($_REQUEST["force_refetch"]);
if (file_exists($cache_filename) && is_readable($cache_filename) && !$auth_login && !$auth_pass && filemtime($cache_filename) > time() - 30) {
_debug("using local cache.", $debug_enabled);
@($feed_data = file_get_contents($cache_filename));
if ($feed_data) {
$rss_hash = sha1($feed_data);
}
} else {
_debug("local cache will not be used for this feed", $debug_enabled);
}
if (!$rss) {
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) {
$feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed);
}
if (!$feed_data) {
_debug("fetching [{$fetch_url}]...", $debug_enabled);
_debug("If-Modified-Since: " . gmdate('D, d M Y H:i:s \\G\\M\\T', $last_article_timestamp), $debug_enabled);
$feed_data = fetch_file_contents($fetch_url, false, $auth_login, $auth_pass, false, $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT, $force_refetch ? 0 : $last_article_timestamp);
global $fetch_curl_used;
if (!$fetch_curl_used) {
$tmp = @gzdecode($feed_data);
if ($tmp) {
$feed_data = $tmp;
}
}
$feed_data = trim($feed_data);
_debug("fetch done.", $debug_enabled);
/* if ($feed_data) {
$error = verify_feed_xml($feed_data);
if ($error) {
_debug("error verifying XML, code: " . $error->code, $debug_enabled);
if ($error->code == 26) {
_debug("got error 26, trying to decode entities...", $debug_enabled);
$feed_data = html_entity_decode($feed_data, ENT_COMPAT, 'UTF-8');
$error = verify_feed_xml($feed_data);
if ($error) $feed_data = '';
}
}
} */
}
if (!$feed_data) {
global $fetch_last_error;
global $fetch_last_error_code;
_debug("unable to fetch: {$fetch_last_error} [{$fetch_last_error_code}]", $debug_enabled);
$error_escaped = '';
// If-Modified-Since
if ($fetch_last_error_code != 304) {
$error_escaped = db_escape_string($fetch_last_error);
} else {
_debug("source claims data not modified, nothing to do.", $debug_enabled);
}
db_query("UPDATE ttrss_feeds SET last_error = '{$error_escaped}',\n\t\t\t\t\t\tlast_updated = NOW() WHERE id = '{$feed}'");
return;
}
}
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
$feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed);
//.........这里部分代码省略.........
示例9: array
if ($F__utilisateur != "" && $F__utilisateur != 'noneItem') {
$formList->where .= " AND id_utilisateur='" . $F__utilisateur . "'";
}
$formList->clause_where();
$count_datas = $formList->get_datas();
if (count($formList->datasList) > 0) {
include DOS_INCPAGES_ADMIN . "list-beforeLoop.php";
$listRow = array();
foreach ($formList->datasList as $keyId => $datas) {
$valeurs = array();
include DOS_INCPAGES_ADMIN . "list-inLoop.php";
// chargement d'autres données ///////////////////////////////////////
// Décrypter les mots de passe
if (isset($list_champ_crypte[$valeurs["id_champ"]])) {
$valeurs["valeur_avant"] = decrypt_string("KEY", $valeurs["valeur_avant"]);
$valeurs["valeur_apres"] = decrypt_string("KEY", $valeurs["valeur_apres"]);
}
$valeurs["id_champ"] = $tabChamp[$valeurs["id_champ"]];
$valeurs["id_element"] = $tabElement[$valeurs["id_element"]];
// Convetir la date au bon format
$dt = new DateTime();
$valeurs["datetime"] = $dt->format('d-m-Y à H:i:s');
// Récupérer le prefix de id_utilisateur "admin-"
$prefix_utilisateur = substr($valeurs["id_utilisateur"], 0, 6);
if ($prefix_utilisateur == "admin-") {
// garder les valeurs apres "admin-"
$nom_utilisateur = substr($valeurs["id_utilisateur"], 6);
$valeurs["id_utilisateur"] = ucfirst($nom_utilisateur);
}
// fin chargement données manuellement
$listRow[$keyId] = $valeurs;
示例10: array
require_once "settings.php";
require_once "tools/compat.php";
require_once "functions-ftp.php";
require_once "access_list.php";
require_once "gettext.php";
$cookie_array = array("", "", "");
$cookie_present = FALSE;
if ($ftp_disable_mcrypt) {
$ftp_remember_me = FALSE;
} elseif (extension_loaded($mcrypt_mod)) {
if (isset($nocookie)) {
setcookie("WeebleFM_cookie", "", time(), "/", $HTTP_SERVER_VARS["SERVER_NAME"], 0);
setcookie("WeebleFM_SID", "", time(), "/", $HTTP_SERVER_VARS["SERVER_NAME"], 0);
setcookie("WeebleFM_Server", "", time(), "/", $HTTP_SERVER_VARS["SERVER_NAME"], 0);
} elseif (isset($WeebleFM_cookie) && isset($WeebleFM_SID)) {
$cookie_string = decrypt_string($WeebleFM_cookie, $key, $WeebleFM_SID, $pref_ciphers);
$cookie_array = explode("::", $cookie_string, 2);
if (isset($WeebleFM_Server)) {
$cookie_array[2] = $WeebleFM_Server;
}
$cookie_present = TRUE;
}
} else {
if (!isset($ERROR)) {
$ERROR = 20;
}
$ftp_remember_me = FALSE;
}
// If register_globals = off display an error.
if (!ini_get("register_globals") && !isset($ERROR)) {
$ERROR = 21;
示例11: decrypt_string
echo $msg;
exit;
}
//echo $response = $xml->response;
//echo print_r($xml);
//exit;
if ($xml->response == "success") {
/* foreach($xml->line as $row)
{
$row1 = decrypt_string($row);
//echo $row1.'<br><br>';
mysql_query($row1) or die("Could not perform query - " . mysql_error());
} */
for ($i = 0; $i <= 61; $i++) {
$row1 = $xml->line[$i];
$row1 = decrypt_string($row1);
mysql_query($row1);
//echo $row1.'<br><br>';
if (mysql_error()) {
echo "There was a unknow problem occured, While installing your application. Try to follow the instructions and install again!";
echo "<br />1. Before reinstalling DROP the existing tables in your dadabase.";
echo "<br />2. Delete the files dboprations.php and docroot.php in /system/includes folder, If it exists.";
exit;
}
}
//exit;
} else {
echo $xml->response;
exit;
}
/* $str='<?php
示例12: current
$mySelect->whereValue["id"] = $__GET['idc'];
$result = $mySelect->query();
$row = current($result);
$list_champ_categorie = explode(",", $row["list_champ"]);
foreach ($list_champ_categorie as $idChamp) {
$mySelect = new mySelect(__FILE__);
$mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "elements_champs";
$mySelect->fields = "valeur";
$mySelect->where = "id_element=:id_element AND id=:id";
$mySelect->whereValue["id_element"] = $__GET['ide'];
$mySelect->whereValue["id"] = $idChamp;
$resultValeur = $mySelect->query();
$rowValeur = current($resultValeur);
if ($rowValeur["valeur"] != "") {
if (in_array($idChamp, $list_champ_crypte)) {
$rowValeur["valeur"] = decrypt_string("KEY", $rowValeur["valeur"]);
}
}
?>
<section>
<div class="row">
<label class='label col col-2'><?php
echo $list_champ[$idChamp];
?>
</label>
<div class='col col-8 '>
<label class='input lang'>
<input class='ctrlg_ ' name='champ<?php
echo $idChamp;
?>
示例13: session_register
// Load the session data.
session_register("sess_Data");
session_register("theme");
session_register("personal");
// Redirect to the login page if the remote IP address doesn't match that
// specified in the session data.
if ($REMOTE_ADDR != $sess_Data["IP"]) {
header("Location: login.php\n\n");
exit;
}
// Checks the status of mcrypt and decrypts the password if necessary. Redirect
// to the login page if mcrypt is unavailable but not disabled.
if ($ftp_disable_mcrypt) {
$ftp_Pass = $sess_Data["pass"];
} elseif (extension_loaded($mcrypt_mod)) {
$ftp_Pass = decrypt_string($sess_Data["pass"], $key . $REMOTE_ADDR . $HTTP_USER_AGENT, $SID, $pref_ciphers);
} else {
header("Location: login.php\n\n");
exit;
}
// Log into the user's FTP account.
$fp = ftp_connect($sess_Data["server"], $sess_Data["port"]);
//ftp_login ( $fp, $sess_Data["user"], $ftp_Pass );
// Attempt to log into your account with the username and password
$result = @ftp_login($fp, $sess_Data["user"], $ftp_Pass);
if ($result == 0) {
header("Location: login.php?ERROR=3\n\n");
exit;
}
// Set passive mode if needed.
if ($ftp_Passive_Mode) {
示例14: smtp_phpmailer_init
function smtp_phpmailer_init($phpmailer)
{
$smtp_options = get_option('smtp_options');
$admin_info = get_userdata(1);
// Set Mailer value
$phpmailer->Mailer = 'smtp';
// Set From value
$phpmailer->From = $admin_info->user_email;
// Set FromName value
$phpmailer->FromName = $admin_info->display_name;
// Set SMTPSecure value
$phpmailer->SMTPSecure = $smtp_options['smtp_secure'];
// Set Host value
$phpmailer->Host = $smtp_options['host'];
// Set Port value
$phpmailer->Port = $smtp_options['port'];
// If usrname option is not blank we have to use authentication
if ($smtp_options['username'] != '') {
$phpmailer->SMTPAuth = true;
$phpmailer->Username = $smtp_options['username'];
$phpmailer->Password = decrypt_string($smtp_options['password'], CRYPT_KEY);
}
}
示例15: decrypt_string_and_decode
function decrypt_string_and_decode($salt, $string)
{
return decrypt_string($salt, base64_decode($string));
}