<form class="bj_con" name="bj_con" action="http://www.xxxxxxxx.com/uc_server/control/designer.php" method="post"  target="id_iframe"  data-validator-option="{stopOnError:false, timely:false}">
     <div>
         <div>
             <label for="area">xxxx</label>
             <input type="text" name="name"  id="area" placeholder="xxxxxx" data-rule="required;range[30~]  ;"/>
            
             </div>
         <div>
           
            <div>
            手机号码
            <input type="text" name="phone" id="phone" placeholder="详细清单将发往您的手机"  data-rule="required;mobile;"/>
            
            </div>
        
        </div>
        <input type="submit" id="bj_btn"  onClick="calc()">
    </form>
如上述代码 我是将表单中的两个值 name与 phone提交到http://www.xxxxxxxx.com/uc_server/control/designer.php,然后用PHP将数据提交到数据库,但这样别人不是也可以将同样的值用这个PHP页面提交到的我的数据库了嘛?现在要怎样做才能保证我数据库的安全呢

解决方案 »

  1.   

    你应该关心的是“怎样让存入的数据是安全的”,只要你php页面做好了数据的安全验证,符合规范的数据,都可以存入或者你在页面弄个验证码,在php页面判断,只有验证码正确才能进行下面的插入,这样就保证别人只能在你的表单页面进行提交
      

  2.   

    是的,这应该是不行的,对POST的程序 进行过滤处理就可以了,再不行搞个加密 POST啥的。让别人也不好模拟POST