How to Restrict User to open a existing php page?

孤人 提交于 2019-12-25 00:19:17

问题


I am working on a problem where i want to restrict a user to open a PHP page This is my javascript-

 <script>
      $('input[id=f1email1]').on('blur', function(){
           var k = $('input[id=f1email1]').val();
           if (k != "")
                $('span[id=showEmail]').load('emailCheck.php?email=' + k);
      });
 </script>

emailCheck.php can be accessed directly by typing into the browser and this might leak some information. I cannot even redirect the page because it connects me to database.

What can I do?


回答1:


There is no difference between a request made by Ajax and any other HTTP request (so you can't reliably distinguish between them, so you cannot prevent the URL from being visited directly if a user wants to visit it directly).

If the page contains information that the user shouldn't be able to get to, then don't put it in the page.



来源:https://stackoverflow.com/questions/18189464/how-to-restrict-user-to-open-a-existing-php-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!