douwo1862 2016-06-10 15:02
浏览 14
已采纳

隐藏php文件路径和POST请求中的参数?

I have post request to increase the liking number on records in database. The php file and the GET paramters are sown in the post request so any one will see the page source will be able to process that exteranlly via the php file.. so is it a way to hide those information, and if not .. so what is the most secrue way to hit the databse without showing secure data like that?

 $.post("liking.php?id="+rank_id+"&lik="+lik+"&dis="+dis,function(data){} 
  • 写回答

1条回答 默认 最新

  • douzhang1364 2016-06-10 15:15
    关注

    If you are doing the POST from jquery like that then the variables are going to be visible to the user in the source. This is not a problem as your security should be server side.

    In your file: liking.php You need to add some kinds of checks to prevent users from repeat likes if that is your goal.

    If you want to limit a like to one per user then you need to log the like to a table somewhere with the userid (if they are logged in) so you can prevent double likes.

    If you are allowing non-logged in users to submit likes then you will want to limit them somehow. Perhaps using PHP sessions to not allow another like in the same session for the same rank_id. This can be session based or time based.

    Here are a few other questions that might lead you on the path:

    How do I make sure my like button is pressed only once by user?

    How to secure/encode Javascript POST requests

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog