Sanitize Form Submissions
Hi - I want "sanitize" my form submissions somehow so as to prevent any malicious code being sent. I've read up on it a bit and I think adding some simple code to strip out < and > brackets should do the trick, but I'm not sure exactly how to go about it or where to put it.
I found a script that should do the job (below) but I'm mostly just unclear where to put in within the myriad of JS files etc.
Thanks in advance for your help!
Chris
function clean($code)
{
$strip = array(
'<' => '<',
'>' => '>'
);
return strtr($code, $strip);
}
I found a script that should do the job (below) but I'm mostly just unclear where to put in within the myriad of JS files etc.
Thanks in advance for your help!
Chris
function clean($code)
{
$strip = array(
'<' => '<',
'>' => '>'
);
return strtr($code, $strip);
}
.js scripts can be spoofed so it's best to handle this with php and pdo statements if your using MySql.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Thanks Eric -
any insight to where a good place to include this would be?
any insight to where a good place to include this would be?
Your going to replace the myformname.php with your own myformname.php with all the custom code to process the $_POST['myvariablename'];
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.