隐藏参数,通过href标记 [英] Hide the parameters passed through href tag

查看:451
本文介绍了隐藏参数,通过href标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过的href 标签,如下传递参数

I am passing parameters through href tag as below:

<a href='message.php?toid=$userid&name1=$fname&name2=$lname'>

当我重定向到 message.php ,三个参数都在地址栏可见。如何隐藏这些参数?我碰到的.htaccess 作为解决方案之一,但没有的.htaccess 我想隐藏的参数

When I get redirected to message.php, the three parameters are visible on address bar. How can I hide these parameters? I came across .htaccess as one of the solution but without .htaccess I would like to hide the parameters

推荐答案

,你不能隐藏通过&LT发送的参数;一&GT; 锚标记。

No, you cannot hide the parameters that are sent through the <a> anchors tags.

不过,您可以通过加密,然后在你的服务器端脚本解密他们混淆的参数。

However, you can obfuscate the parameters by encrypting them and then decrypting them on your server-side script.

test1.php

test1.php

<?php
$key_value = "somekey"; //<--- This is a key for the encryption decryption process
$plain_text = "the secret !"; //<-- The actual text you are going to send.
$encryptedmsg = mcrypt_ecb(MCRYPT_DES, $key_value, $plain_text, MCRYPT_ENCRYPT); //<-- Encrypting...
echo "<a href=test2.php?enc=$encryptedmsg>Click Here</a>"; //<-- Your anchor tag

test2.php

test2.php

<?php
$key_value = "somekey"; //<--- Note..the same key !
$decryptedmsg = mcrypt_ecb(MCRYPT_DES, $key_value, $_GET['enc'], MCRYPT_DECRYPT); //<-- Decrypting
echo $decryptedmsg; //<-- Prints "the secret"

当点击该链接。该test2.php将获得 ENC 参数,然后使用code解密,但是,用户将不能够阅读纯文本.. 的秘密!

When clicked the link.. the test2.php will get the enc parameter and then decrypt it using the code , however, users will not be able to read the plain text.. the secret !

这是它的外观上的地址栏,当你点击的链接 test1.php

This is how it looks on the addressbar when you click the link from test1.php...

http://localhost/ext1/test2.php?enc=%D4%1D%96F|C%8B%8C%D7%8AP%19=%13%F6%A1

警告:pcated的 mcrypt_ecb 是德$ P $。我只是用它的说明目的,给你所发生的事情的想法。

Warning : The mcrypt_ecb is deprecated. I just used it for the illustration purposes to give you an idea of what is happening.

这篇关于隐藏参数,通过href标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆