开发者

php encrypt and decrypt

can anyone tell me how to encrypt and decry开发者_如何学Cpt a URL string ?

I want to encrypt a hyperlink ...


If you can use database,you could create a table to map a file to an id.

Create a 'mapping_table'

id - integer
file_location - string

Your URL would look something like localhost/waterwell/e_book.php?id=12 .


make links that return to your server with querystring GET params identifying the file. the server can then do echo file_get_contents() after you figure out which file from the inputs

In your example it's trivial. simply omit the portion of the url you don't want shown and fill it back in on the server.


    $confirmpassword = $_POST['confirmpassword'];
            $value_check = true;
            $ciphering = "AES-128-CTR";
            $options = 0; 
            $encryption_iv = '1234567891011121'; 
            $encryption_key = "GeeksforGeeks";
            $confirmpasswordencryption = openssl_encrypt($confirmpassword, $ciphering,$encryption_key, $options, $encryption_iv);  

$encryption = "pABqPJhobIMHzqai"
                                                        $ciphering = "AES-128-CTR";
                                                        $options = 0;
                                                        $decryption_iv = '1234567891011121'; 
  
// Store the decryption key 
$decryption_key = "GeeksforGeeks"; 
  
// Use openssl_decrypt() function to decrypt the data 
$decryption=openssl_decrypt ($encryption, $ciphering,  
        $decryption_key, $options, $decryption_iv); 
  
// Display the decrypted string 
echo "Decrypted String: " . $decryption; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜