本文整理汇总了PHP中decrypt_data函数的典型用法代码示例。如果您正苦于以下问题:PHP decrypt_data函数的具体用法?PHP decrypt_data怎么用?PHP decrypt_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decrypt_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadData
function loadData($def)
{
global $_COOKIE;
$mydata = $def;
if (array_key_exists("data", $_COOKIE)) {
$tempdata = json_decode(decrypt_data($_COOKIE["data"]), true);
if (is_array($tempdata) && array_key_exists("showpassword", $tempdata) && array_key_exists("bgcolor", $tempdata)) {
if (preg_match('/^#(?:[a-f\\d]{6})$/i', $tempdata['bgcolor'])) {
$mydata['showpassword'] = $tempdata['showpassword'];
$mydata['bgcolor'] = $tempdata['bgcolor'];
}
}
}
return $mydata;
}
示例2: update_member
/**
* Add a new user to the database. This user is just able to give and receive referrals.
*
* @return int
*/
function update_member()
{
global $Conf, $order, $User;
// Process and store payment information
$privateKey = decrypt_data($this->ID, true);
// Return the stored encrypted key
if (!$privateKey) {
// No key exists create a new one.
$privateKey = genPrivateKey();
//Generate a private key - This will made into a static value after generating it once
}
$data = array('status' => $this->ccStatus, 'details' => $this->ccDetails, 'error' => $this->ccError, 'tcode' => $this->ccTCode, 'name' => $order->name, 'ccType' => $order->cardtype, 'ccNum' => $order->cardnumber, 'MM' => $order->cardexpmonth, 'YY' => $order->cardexpyear, 'ccCODE' => $order->cvmvalue);
$data = encrypt(serialize($data), $privateKey);
//Catches the ciphertext from the encrypt function
// Convert the string value users enter and update it to and numeric string, autoid
$state = $User->get_province_by_name(strtoupper($order->state));
$tA = $Conf["data"]->UserTable;
myDBC::new_andWhere();
myDBC::andWhere("{$tA}.AutoID = '{$this->ID}'");
$fields = array("`shipAddr1`" => "'{$order->address1}'", "`shipCity`" => "'{$order->city}'", "`shipState`" => "'{$state->autoid}'", "`shipZip`" => "'{$order->zip}'", "`cc`" => "'{$data}'", "`level`" => "'member'", "`is_enabled`" => "'yes'", "`date_added`" => "NOW()", "`paymentType`" => "'Credit Card'");
capture_cc($this->ID, '', $privateKey);
myDBC::update_Record($tA, $fields, myDBC::get_andWhere(), " LIMIT 1");
}
示例3: file_get_contents
}
}
if (!$input_errors) {
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
/* read the file contents */
$data = file_get_contents($_FILES['conffile']['tmp_name']);
if (!$data) {
log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']));
return 1;
}
if ($_POST['decrypt']) {
if (!tagfile_deformat($data, $data, "config.xml")) {
$input_errors[] = gettext("The uploaded file does not appear to contain an encrypted pfsense configuration.");
return 1;
}
$data = decrypt_data($data, $_POST['decrypt_password']);
}
if (stristr($data, "<m0n0wall>")) {
log_error(gettext("Upgrading m0n0wall configuration to pfsense."));
/* m0n0wall was found in config. convert it. */
$data = str_replace("m0n0wall", "pfsense", $data);
$m0n0wall_upgrade = true;
}
if ($_POST['restorearea']) {
/* restore a specific area of the configuration */
if (!stristr($data, "<" . $_POST['restorearea'] . ">")) {
$input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
} else {
if (!restore_config_section($_POST['restorearea'], $data)) {
$input_errors[] = gettext("You have selected to restore an area but we could not locate the correct xml tag.");
} else {
示例4: define
<?php
/*
* Вызывается скриптом gate_hashes.php
* Выдает тело тр-ии
* */
define('DC', TRUE);
define('ABSPATH', dirname(__FILE__) . '/');
set_time_limit(0);
require_once ABSPATH . 'db_config.php';
require_once ABSPATH . 'includes/autoload.php';
require_once ABSPATH . 'includes/errors.php';
$db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT);
$encrypted_data = $_REQUEST['data'];
//debug_print("encrypted_data={$encrypted_data}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
$binary_tx_hashes = decrypt_data($encrypted_data, $db, $decrypted_key);
if (substr($binary_tx_hashes, 0, 7) == '[error]') {
die($binary_tx_hashes);
}
//debug_print("binary_tx_hashes={$binary_tx_hashes}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
$binary_tx = '';
// Разбираем список транзакций
do {
list(, $tx_hash) = unpack("H*", string_shift($binary_tx_hashes, 16));
if (!$tx_hash) {
continue;
}
$tx = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `data`\n\t\t\tFROM `" . DB_PREFIX . "transactions`\n\t\t\tWHERE `hash` = 0x{$tx_hash}\n\t\t\t", 'fetch_one');
if ($tx) {
$binary_tx .= ParseData::encode_length_plus_data($tx);
}
示例5: MySQLidb
require_once ABSPATH . 'includes/autoload.php';
require_once ABSPATH . 'includes/errors.php';
$db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT);
$ip = $_SERVER['REMOTE_ADDR'];
/*
* Защита от случайного ддоса
* */
//ddos_protection ($ip);
/***/
//ob_start();
/*
* Пробуем работать без локов
* */
$encrypted_data = $_POST['data'];
// извлечем ключ, декодируем его и декодируем им данные
$binary_data = decrypt_data($encrypted_data, $db);
if (substr($binary_data, 0, 7) == '[error]') {
die($binary_data);
}
/*
* структура данных:
* user_id - 5 байт
* type - 1 байт. 0 - блок, 1 - список тр-ий
* {если type==1}:
* <любое кол-во следующих наборов>
* high_rate - 1 байт
* tx_hash - 16 байт
* </>
* {если type==0}:
* block_id - 3 байта
* hash - 32 байт
示例6: print_input_errors
}
if ($input_errors) {
print_input_errors($input_errors);
} else {
$ds = split("\\+\\+\\+\\+", $data);
$revision = $_REQUEST['download'];
$sha256sum = $ds[0];
if ($sha256sum == "0") {
$sha256sum = "None on file.";
}
$data = $ds[1];
$configtype = "Encrypted";
if (!tagfile_deformat($data, $data, "config.xml")) {
$input_errors[] = "The downloaded file does not appear to contain an encrypted pfSense configuration.";
}
$data = htmlentities(decrypt_data($data, $decrypt_password));
if (!strstr($data, "pfsense")) {
$data = "Could not decrypt. Different encryption key?";
$input_errors[] = "Could not decrypt config.xml";
}
echo "<h2>Hostname</h2>";
echo "<textarea rows='1' cols='70'>{$hostname}</textarea>";
echo "<h2>Revision date/time</h2>";
echo "<textarea name='download' rows='1' cols='70'>{$_REQUEST['download']}</textarea>";
echo "<h2>Revision reason</h2>";
echo "<textarea name='download' rows='1' cols='70'>{$_REQUEST['reason']}</textarea>";
echo "<h2>SHA256 summary</h2>";
echo "<textarea name='shasum' rows='1' cols='70'>{$sha256sum}</textarea>";
echo "<h2>Encrypted config.xml</h2>";
echo "<textarea name='config_xml' rows='40' cols='70'>{$ds[1]}</textarea>";
echo "<h2>Decrypted config.xml</h2>";
示例7: decrypt
private static function decrypt($text)
{
return decrypt_data($text, self::SALT);
}
示例8: getFriendsRequest
function getFriendsRequest($appID, $data, $iv)
{
global $friendTable;
$json = json_decode(decrypt_data($appID, $data, $iv));
$id1 = $json->idusuario_a;
$response["status"] = 0;
$dbh = getConnection();
$sql = "SELECT idusuario, nome, email, addressLat, addressLong, imagePath\n\t\t\t\tfrom usuario, (SELECT idusuario_b AS friend FROM {$friendTable}\n\t\t\t\t\tWHERE idusuario_a = :id1 and status = 0 UNION SELECT\n\t\t\t\t\t\tidusuario_a AS friend FROM {$friendTable} WHERE\n\t\t\t\t\t\t\tidusuario_b = :id1 and status = 0) as tmp WHERE\n\t\t\t\t\t\t\t\t\t\t\t\t\tidusuario = tmp.friend";
$stmt = $dbh->prepare($sql);
$stmt->bindParam(":id1", $id1);
$stmt->execute();
/* get user information as a associative array */
$tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
$response["users"] = storeElements("user", $tmp);
if ($response["users"]) {
$response["status"] = 1;
}
closeConnection($dbh);
$json = json_encode($response);
$data = encrypt_data($appID, $json);
echo json_encode($data);
}
示例9: removeObjFilm
function removeObjFilm()
{
global $filmTable;
/* verifica se existe alguma informacao no corpo da mensagem */
$request = Slim::getInstance()->request();
$json = readRequestBody($request);
if (!$json) {
$response["status"] = 0;
echo json_encode($response);
return;
}
/* lendo dados do json */
$appID = $json->appID;
$crypt_data = $json->data;
$iv = $json->iv;
$json = json_decode(decrypt_data($appID, $crypt_data, $iv));
$id = $json->idFilme;
$response["status"] = 1;
$dbh = getConnection();
$sql = "delete from {$filmTable} where idFilme = :id";
$stmt = $dbh->prepare($sql);
$stmt->bindParam(":id", $id);
$stmt->execute();
closeConnection($dbh);
$json = json_encode($response);
$data = encrypt_data($appID, $json);
echo json_encode($data);
return;
}
示例10: is_valid_spam_key
function is_valid_spam_key($key)
{
$time = decrypt_data(base64_decode($key), $GLOBALS['_spam_key']);
return $time < time() - 4 && $time > strtotime('-4 hours');
}
示例11: addUserObj
function addUserObj()
{
global $patrimonio;
/* verifica se existe alguma informacao no corpo da mensagem */
$request = Slim::getInstance()->request();
$json = readRequestBody($request);
if (!$json) {
$response["status"] = 0;
echo json_encode($response);
return;
}
/* lendo dados do json */
$appID = $json->appID;
$crypt_data = $json->data;
$iv = $json->iv;
$json = json_decode(decrypt_data($appID, $crypt_data, $iv));
$userId = $json->userId;
$objId = $json->objId;
$objType = $json->objType;
/* the objType doesn't exist */
if (!isset($patrimonio[$objType])) {
$response["status"] = 0;
echo json_encode($response);
return;
}
$response["status"] = 1;
$dbh = getConnection();
$obj = $patrimonio[$objType][0];
$possui = $patrimonio[$objType][1];
try {
/* if the ids exist in their tables and are not linked, add a new row */
$sql = "insert into {$possui} select idusuario, id{$obj} from\n\t\t\t\t\tusuario, obj{$obj} where idusuario = :userID and\n\t\t\t\t\t\tid{$obj} = :objID and (select count(*) from {$possui} where\n\t\t\t\t\t\t\tfk_idUser = :userID and fk_id{$obj} = :objID) = 0";
$stmt = $dbh->prepare($sql);
$stmt->bindParam(":userID", $userId);
$stmt->bindParam(":objID", $objId);
$stmt->execute();
} catch (PDOException $e) {
/* couldn't insert */
$response["status"] = 0;
}
closeConnection($dbh);
$json = json_encode($response);
$data = encrypt_data($appID, $json);
echo json_encode($data);
return;
}
示例12: ocf_get_all_custom_fields_match_member
/**
* Gets all a member's custom fields that match certain parameters.
*
* @param MEMBER The member.
* @param ?BINARY That are publicly viewable (NULL: don't care).
* @param ?BINARY That are owner viewable (NULL: don't care).
* @param ?BINARY That are owner settable (NULL: don't care).
* @param ?BINARY That are encrypted (NULL: don't care).
* @param ?BINARY That are required (NULL: don't care).
* @param ?BINARY That are to be shown in posts (NULL: don't care).
* @param ?BINARY That are to be shown in post previews (NULL: don't care).
* @param BINARY That start 'ocp_'
* @param ?boolean That are to go on the join form (NULL: don't care).
* @return array A mapping of field title to a map of details: 'RAW' as the raw field value, 'RENDERED' as the rendered field value.
*/
function ocf_get_all_custom_fields_match_member($member_id, $public_view = NULL, $owner_view = NULL, $owner_set = NULL, $encrypted = NULL, $required = NULL, $show_in_posts = NULL, $show_in_post_previews = NULL, $special_start = 0, $show_on_join_form = NULL)
{
$fields_to_show = ocf_get_all_custom_fields_match($GLOBALS['FORUM_DRIVER']->get_members_groups($member_id), $public_view, $owner_view, $owner_set, $required, $show_in_posts, $show_in_post_previews, $special_start, $show_on_join_form);
$custom_fields = array();
$member_mappings = ocf_get_custom_field_mappings($member_id);
$member_value = mixed();
// Initialise type to mixed
$all_cpf_permissions = get_member() == $member_id || $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()) ? array() : list_to_map('field_id', $GLOBALS['FORUM_DB']->query_select('f_member_cpf_perms', array('*'), array('member_id' => $member_id)));
require_code('fields');
foreach ($fields_to_show as $i => $field_to_show) {
$member_value = $member_mappings['field_' . strval($field_to_show['id'])];
// Decrypt the value if appropriate
if (array_key_exists('cf_encrypted', $field_to_show) && $field_to_show['cf_encrypted'] == 1) {
require_code('encryption');
if (is_encryption_enabled() && !is_null(post_param('decrypt', NULL))) {
$member_value = decrypt_data($member_value, post_param('decrypt'));
}
}
$ob = get_fields_hook($field_to_show['cf_type']);
list(, , $storage_type) = $ob->get_field_value_row_bits($field_to_show);
if (strpos($storage_type, '_trans') !== false) {
if (is_null($member_value) || $member_value == 0) {
$member_value = '';
} else {
$member_value = get_translated_tempcode($member_value, $GLOBALS['FORUM_DB']);
}
// This is meant to be '' for blank, not new ocp_tempcode()
if (is_object($member_value) && $member_value->is_empty()) {
$member_value = '';
}
}
// get custom permissions for the current CPF
$cpf_permissions = array_key_exists($field_to_show['id'], $all_cpf_permissions) ? $all_cpf_permissions[$field_to_show['id']] : array();
$display_cpf = true;
// if there are custom permissions set and we are not showing to all
if (array_key_exists(0, $cpf_permissions) && !is_null($public_view)) {
$display_cpf = false;
// Negative ones
if ($cpf_permissions[0]['guest_view'] == 1) {
$display_cpf = true;
}
if (!is_guest()) {
if ($cpf_permissions[0]['member_view'] == 1) {
$display_cpf = true;
}
}
if (!$display_cpf) {
if ($cpf_permissions[0]['friend_view'] == 1) {
if (!is_null($GLOBALS['SITE_DB']->query_value_null_ok('chat_buddies', 'member_liked', array('member_likes' => $member_id, 'member_liked' => get_member())))) {
$display_cpf = true;
}
}
if (!is_guest()) {
if ($cpf_permissions[0]['group_view'] == 'all') {
$display_cpf = true;
} else {
if (strlen($cpf_permissions[0]['group_view']) > 0) {
require_code('ocfiltering');
$groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, false, false, NULL, $member_id);
$groups_to_search = array();
foreach (array_keys($groups) as $group_id) {
$groups_to_search[$group_id] = NULL;
}
$matched_groups = ocfilter_to_idlist_using_memory($cpf_permissions[0]['group_view'], $groups_to_search);
if (count($matched_groups) > 0) {
$display_cpf = true;
}
}
}
}
}
}
if ($display_cpf) {
$rendered_value = $ob->render_field_value($field_to_show, $member_value, $i, NULL);
$custom_fields[$field_to_show['trans_name']] = array('RAW' => $member_value, 'RENDERED' => $rendered_value);
}
}
return $custom_fields;
}
示例13: imagesetpixel
imagesetpixel($i, $x, $y, imagecolorallocate($i, $r, $g, $b));
$n++;
}
}
//imagepng($i, 'test.png');
return $i;
}
$gameFolder = 'c:/juegos/brave_s';
foreach (glob("{$gameFolder}/scenario/*.dat") as $fileIn) {
$fileOut = substr($fileIn, 0, -4) . '.scr';
echo "{$fileIn} -> {$fileOut}\n";
if (!file_exists($fileOut)) {
file_put_contents($fileOut, decrypt_data(file_get_contents($fileIn)));
}
}
foreach (glob("{$gameFolder}/map/*.dat") as $fileIn) {
$fileOut = substr($fileIn, 0, -4) . '.scr';
echo "{$fileIn} -> {$fileOut}\n";
if (!file_exists($fileOut)) {
file_put_contents($fileOut, decrypt_data(file_get_contents($fileIn)));
}
}
foreach (glob("{$gameFolder}/parts/*.CRP") as $fileIn) {
$fileOut1 = substr($fileIn, 0, -4) . '.CRP.u';
$fileOut2 = substr($fileIn, 0, -4) . '.PNG';
echo "{$fileIn} -> {$fileOut2}\n";
if (!file_exists($fileOut2)) {
`ms-expand.exe {$fileIn} {$fileOut1}`;
imagepng(decodeImage(fopen($fileOut1, 'rb')), $fileOut2);
}
}
示例14: changeEmprestimoStatus
function changeEmprestimoStatus()
{
global $loanTable;
/* verifica se existe alguma informacao no corpo da mensagem */
$request = Slim::getInstance()->request();
$json = readRequestBody($request);
if (!$json) {
$response["status"] = 0;
echo json_encode($response);
return;
}
/* lendo dados do json */
$appID = $json->appID;
$crypt_data = $json->data;
$iv = $json->iv;
$json = json_decode(decrypt_data($appID, $crypt_data, $iv));
$idEmp = $json->idemprestimo;
$status = $json->status;
$response["status"] = 1;
$dbh = getConnection();
$sql = "update {$loanTable} set status = :status where idemprestimo = :idEmp";
try {
$stmt = $dbh->prepare($sql);
$stmt->bindParam(":idEmp", $idEmp);
$stmt->bindParam(":status", $status);
$stmt->execute();
} catch (PDOException $e) {
$response["status"] = 0;
}
closeConnection($dbh);
$json = json_encode($response);
$data = encrypt_data($appID, $json);
echo json_encode($data);
return;
}
示例15: getCloseUsers
function getCloseUsers($appID, $data, $iv)
{
global $friendTable;
$json = json_decode(decrypt_data($appID, $data, $iv));
$response["status"] = 0;
$id1 = $json->idusuario;
$userLat = $json->addressLat;
$userLong = $json->addressLong;
$dbh = getConnection();
$sql = "SELECT idusuario, nome, email, addressLat, addressLong, imagePath\n\t\t\t\tfrom usuario, (SELECT idusuario_b AS friend FROM {$friendTable}\n\t\t\t\t\tWHERE idusuario_a = :id1 UNION SELECT idusuario_a AS friend\n\t\t\t\t\t\tFROM {$friendTable} WHERE idusuario_b = :id1) as tmp WHERE\n\t\t\t\t\t\t\tidusuario = tmp.friend";
$stmt = $dbh->prepare($sql);
$stmt->bindParam(":id1", $id1);
$stmt->execute();
/* get user information as a associative array */
$elements = $stmt->fetchAll(PDO::FETCH_ASSOC);
$type = "user";
if (count($elements) != 0) {
$arr = array();
$i = 0;
$coordUser = coordenadasEsfericas($userLat, $userLong);
foreach ($elements as $elem) {
$arr[$i] = array();
$arr[$i][$type] = array();
/* verifica proximidade */
$friendLat = $elements[$i]["addressLat"];
$friendLong = $elements[$i]["addressLong"];
$coordFriend = coordenadasEsfericas($friendLat, $friendLong);
if (!distBetweenUsers($coordUser, $coordFriend)) {
continue;
}
echo $elements[$i]['idusuario'];
foreach ($elements[$i] as $key => $value) {
$arr[$i][$type][$key] = $value ? $value : null;
}
$i++;
}
}
if ($i == 0) {
$arr = null;
}
$response["users"] = $arr;
if ($response["users"]) {
$response["status"] = 1;
}
closeConnection($dbh);
$json = json_encode($response);
$data = encrypt_data($appID, $json);
echo json_encode($data);
return;
}