网址在<a> tag in php

时间:2017-03-08 07:11:22

标签: php codeigniter encryption url-rewriting urlencode

I am developing one secure portal project in Php codeignitor. I need to know about encryption of URL in <a> tag where the URL is completely visible in the page source. I am very well aware of urlencode function in php. I dont want to use it because it can also be decoded as well. so I want solution something looks like below

Instead Usual way

<a href="https://somedomain.com/path1/path2">....</a>

I want something like this

<a href="xWAYK4rT3D9VBsheGElFZXtoL5zkfQ">....</a>

I have seen this kind of encryption technique where even though it is encrpted, it navigates to current page.

1 个答案:

答案 0 :(得分:0)

你不能自己制作链接“xWAYK4rT3D9VBsheGElFZXtoL5zkfQ”,最好用你的网址添加唯一的生成令牌:href =“https://somedomain.com/xWAYK4rT3D9VBsheGElFZXtoL5zkfQ” 使用您自己的令牌生成代码,可以加密和解密。

$键=包( 'H *' “bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3”);

$ codeAlphabet =“ABCDEFGHIJKLMNOPQRSTUVWXYZ”;

$ codeAlphabet。=“abcdefghijklmnopqrstuvwxyz”;

$ encrypted_string = mcrypt_encrypt($ key,$ codeAlphabet,...);

$ decrypted_string = mcrypt_decrypt($ key,$ codeAlphabet,..);