This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$change_from = 'old_string'; | |
$change_to = 'new_string_new_length'; | |
$serialized = file_get_contents('serialized_data.txt'); | |
$serialized = str_replace($change_from, $change_to, $serialized); | |
function fix_str_length($matches) { | |
$string = $matches[2]; | |
$right_length = strlen($string); // yes, strlen even for UTF-8 characters, PHP wants the mem size, not the char count | |
return 's:' . $right_length . ':"' . $string . '";'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ENCRYPTION | |
$method = 'AES-256-CBC'; | |
$secret = 'my secret'; | |
$key = 'test'; | |
$hex_key = (bin2hex($key)); // example 74657374 | |
$length = openssl_cipher_iv_length($method); | |
$iv = openssl_random_pseudo_bytes($length); | |
// $iv = hex2bin("047ed7c4aaf0069daa06b633b86aff67"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Реализация API, не изменяйте ее | |
* @param {string} url | |
* @param {function} callback | |
*/ | |
function getData(url, callback) { | |
var RESPONSES = { | |
'/countries': [ | |
{name: 'Cameroon', continent: 'Africa'}, | |
{name :'Fiji Islands', continent: 'Oceania'}, |