Why is this php code causing 403 error?
I am trying to insert data to a table using the following php code but it is causing 403 page. I can’t even insert the code to the code snippet in "XYZ PHP Code" plugin. There is definitely something wrong with the php code only as I am able to insert the html and JQuery scripts when I remove the php code.
global $wpdb;
$submit = filter_input(INPUT_POST, 'submit');
if (isset($submit)){
$name = filter_input(INPUT_POST, 'name');
$email = filter_input(INPUT_POST, 'email');
$phone = filter_input(INPUT_POST, 'phone');
$address = filter_input(INPUT_POST, 'address');
$profession = filter_input(INPUT_POST, 'prof');
$rowInserted = $wpdb->insert('my_table', array('id' => NULL, 'name' => $name, 'email' => $email, 'phone_no' => $phone, 'address' => $address, 'profession' => $profession));
if ($rowInserted){
echo "Record inserted successfully";
}
}
The security warning is generated by BitNinja and A section on the 403 page says the following.
Why have I been blocked?
The website you tried to reach is under active web security protection
to prevent cyber attacks. Your request triggered the web application
firewall system so the request has been blocked. There are several
factors why a request can be blocked, such as SQL keywords, malformed
requests, and some specific words.
Leave an answer