如何保护隐藏字段数据?

时间:2013-04-20 07:06:48

标签: php hidden

我有一个表格,其中有两个隐藏的字段。我想保护隐藏字段中的数据,以便没有人可以通过页面源和火灾bug看到它。我alreday使用会话,它的工作,但我不能使用它。我需要改变它,请帮助。

<form name="android" method="post" action="http://apps.createcoolapps.com/c2dm_send.ashx" target="_blank" onSubmit="return valid();">
<table align="center">  
<?php $qry_id=mysql_query("select * from users where u_name='$_SESSION[u_name]'");
                    while($id_fetch=mysql_fetch_assoc($qry_id)){
            ?>

      <input type="hidden" name="publisherid" value="createcoolapps" />
<input type="hidden" name="username" value="<?php echo $query_id[manager_uname];?>" />
<input type="hidden" name="pass" value="<?php echo $query_id[manager_pass];?>" />
    <tr align="center">
    <td style="width: 100px; font-family: Helvetica,Arial,sans-serif; font-weight: bold;">Select Appid:<br>
      <select name="appid" style="border-style:hidden">
    <option value="">Select any one</option>
    <option value="QRScanner">app1</option>
    <option value="app3">app3</option>
    <option value="app4">app4</option>
    </select>
    </tr> 
    <tr align="center">
    <td style="width: 100px; font-family: Helvetica,Arial,sans-serif; font-weight: bold;">Notification Message:<br>
      <textarea name="pushmessage" style="width: 300px;"></textarea><br />
    </tr>
    <?php }?>

2 个答案:

答案 0 :(得分:3)

这是不可能的。 Firebug只是在其中读取DOM的实际状态,因此即使它在后期添加,它仍然可以被检索。

这种安全方式通过默默无闻称为安全性,是一种非安全性。你必须以另一种方式解决它,比如让服务器代替请求。

您让用户将表单提交给服务器。然后使用curl,使用正确的用户代码调用webservice。

更多信息Best way to hide a form input field from being accessed using firebug?

答案 1 :(得分:0)

隐藏的字段和安全?不可能。会话和服务器端代码是安全的。您可以进行加密和解密。但这可能会被打破。使用带会话的数据库来处理数据。