'unix:///run/memcached.sock', 'port' => 0, 'buckets' => 1), ); $memcache = new \Memcache(); $Servers = $MemcachedServers; foreach ($MemcachedServers as $Server) { $memcache->addServer($Server['host'], $Server['port'], true, $Server['buckets']); } $cv=$memcache->get('oc_' . $_GET['i']); if($cv!==false) { $memcache->delete('oc_' . $_GET['i']); header($cv); } unset($memcache); } header('Access-Control-Allow-Origin: *'); header('Content-Type: image/gif'); echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw=='); die(); // /** * * * set $cors ''; if ($http_origin ~ '^https?://(localhost|www\.yourdomain\.com|www\.yourotherdomain\.com)') { set $cors 'true'; } if ($cors = 'true') { add_header 'Access-Control-Allow-Origin' "$http_origin" always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; # required to be able to read Authorization header in frontend #add_header 'Access-Control-Expose-Headers' 'Authorization' always; } if ($request_method = 'OPTIONS') { # Tell client that this pre-flight info is valid for 20 days add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } location ~* \.(ttf|ttc|otf|js|eot|woff|woff2)$ { if ( $http_origin ~* ((.+\.)?(domain\.systems|domain\.com|domain\.me)) ) { add_header "Access-Control-Allow-Origin" "$http_origin" always; } } * simple method to encrypt or decrypt a plain text string * initialization vector(IV) has to be the same when encrypting and decrypting * * @param string $action: can be 'encrypt' or 'decrypt' * @param string $string: string to encrypt or decrypt * * @return string */ function encrypt_decrypt($action, $string) { $output = false; $encrypt_method = "AES-256-CBC"; $secret_key = 'This is my secret key'; $secret_iv = 'This is my secret iv'; // hash $key = hash('sha256', $secret_key); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr(hash('sha256', $secret_iv), 0, 16); if ( $action == 'encrypt' ) { $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); $output = urlencode(($output)); } else if( $action == 'decrypt' ) { $output = openssl_decrypt((urldecode($string)), $encrypt_method, $key, 0, $iv); } return $output; } $plain_txt = "This is my plain text"; echo "Plain Text =" .$plain_txt. "\n"; $encrypted_txt = encrypt_decrypt('encrypt', $plain_txt); echo "Encrypted Text = " .$encrypted_txt. "\n"; $decrypted_txt = encrypt_decrypt('decrypt', $encrypted_txt); echo "Decrypted Text =" .$decrypted_txt. "\n"; if ( $plain_txt === $decrypted_txt ) echo "SUCCESS"; else echo "FAILED"; echo "\n"; //header('Content-Type: image/gif'); //echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw=='); ?>