bachx Posted September 29, 2007 Share Posted September 29, 2007 I've noticed that some of my scripts are vulnerable to external HTML forms, meaning someone can use my functions using his own form. This might cause a bit of a problem to me. Is there any way to prevent someone from accessing my scripts using such a form and limit the access to my own forms? Quote Link to comment https://forums.phpfreaks.com/topic/71126-prevent-access-from-external-html-forms/ Share on other sites More sharing options...
bachx Posted September 30, 2007 Author Share Posted September 30, 2007 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/71126-prevent-access-from-external-html-forms/#findComment-358154 Share on other sites More sharing options...
Clintonio Posted September 30, 2007 Share Posted September 30, 2007 From my experience you cannot, and even if you did, you'd get people just Java injecting into your forms to the same effect. The best thing to do is checks after it has been entered, and before the script processes. Like checking if the values are of a correct range, or a certain type, certain case, or even just a specific value. Post data is held in browser headers anyway if I am remembering right, so no, it's impossible to stop such attacks. It's down to you to secure your scripts... Correct me if I am wrong. Quote Link to comment https://forums.phpfreaks.com/topic/71126-prevent-access-from-external-html-forms/#findComment-358160 Share on other sites More sharing options...
desithugg Posted September 30, 2007 Share Posted September 30, 2007 You could use php predefined variables to check where the user is coming from and if the value doesn't match the page with your form you can show an error. <? if($_SERVER['HTTP_REFERER']!="http://www.phpfreaks.com/myform.html"){ echo"Error."; exit; } ?> That would work but there's ways around it but you wouldn't expect the average person to go through so much trouble. Quote Link to comment https://forums.phpfreaks.com/topic/71126-prevent-access-from-external-html-forms/#findComment-358163 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.