如何限制用户打开现有的PHP页面? [英] How to Restrict User to open a existing php page?
问题描述
我正在处理一个问题,我想限制用户打开一个PHP页面
这是我的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
可直接访问在浏览器中输入内容可能会泄露一些信息。我甚至无法重定向页面,因为它将我连接到数据库。
我能做什么?
由Ajax和任何其他HTTP请求发出的请求(因此您无法可靠地区分它们,因此,如果用户想直接访问该URL,则无法直接访问该URL)。
如果页面包含用户不应该访问的信息,则不要将其放在页面中。
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?
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.
这篇关于如何限制用户打开现有的PHP页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!