Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/71126-prevent-access-from-external-html-forms/
Share on other sites

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.