php加密和解密

时间:2010-02-27 15:18:10

标签: php hyperlink encryption

谁能告诉我如何加密和解密URL字符串?

我想加密超链接......

3 个答案:

答案 0 :(得分:1)

如果可以使用数据库,则可以创建一个表来将文件映射到id。

创建'mapping_table'

id - integer
file_location - string

您的网址看起来像localhost/waterwell/e_book.php?id=12

答案 1 :(得分:0)

使用查询字符串GET参数标识文件来生成返回服务器的链接。然后,在您确定输入中的哪个文件

后,服务器可以echo file_get_contents()

在你的例子中,它是微不足道的。只需省略您不想显示的网址部分,然后将其重新填入服务器。

答案 2 :(得分:0)

    $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; 
相关问题