Search code examples
phpemailgmail

PHP throws 403 forbidden error when copying client data from gmail and submitting the form


I saving this specific data into my form, but i am getting 403

Forbidden You don't have permission to access /edit-booking on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

here is the data of the client.

Day 1 : Katra
  On arrival at Jammu Airport  catch the cab and then proceed to Katra Hotel.  Proceed to Katra. On arrive Check into The hotel. Proceed to local Sightseeing in Katra. Dinner and Overnight stay at the hotel Katra.

Day 2 : Katra Sightseeing
Today Morning After having Breakfast, Proceed to Katra- Vaishodevi Darshan. Dinner & Overnight stay at Katra.                  

Day 3 :  Katra - Amritsar 
Today Morning After having Breakfast, Check out From the Hotel & Proceed to Amritsar . On arrive Check into The hotel. Proceed to local Sightseeing in Amritsar . Dinner and Overnight stay at the hotel Amritsar 

Day 4 : Amritsar Sightseeing
Today Morning After having Breakfast, Proceed to Amritsar - Wagha  Border & visit Golden Temple. Dinner & Overnight stay at Amritsar.      
            


Day 5 : Amritsar Drop 
Today Morning After having Breakfast, Proceed to Amritsar Airport Drop 

when ever i am trying to save this particular details. i am getting 403 forbidden error. Also changed the source from notepad,wordfile,pdf docx. still given me the same error if i copy this data and save it to my form.enter image description here

i thaught maybe some special characters are creating this problem so i used preg_replace to eliminate all the specials characters. but still get this error

here is my php code for this.

$b_itinerary = filter_var($_POST['b_itinerary'],FILTER_SANITIZE_STRING);
$b_itinerary = preg_replace('/[^A-Za-z0-9\n ]/', '', $b_itinerary);


mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
try {
$stmt = $mysqli->prepare("UPDATE rmt_bookings SET b_itinerary=?");
$stmt->bind_param("ss",$b_itinerary,$b_bkid);
    
$stmt->execute();
if($stmt->affected_rows === 0)
$msg = "Booking Updated Successfully";
$stmt->close();

}
catch (Exception $e) {
  echo "Error : ".$e; //use in development
  error_log($e); //use in production
  echo 'Error:'.$e;
  $msg = "Error".$e;
 
}

What is causing the problem.

Here is the Screen Short of 2 Client data, With working and other throwing Error enter image description here


Solution

  • You had a mod_security problem. your ip is blocked for some reason. as your hosting provider to unblock your ip from there the problem occurred for me. something in your string must have matched the mod rule, if it was a false positive. the support team will unblock your ip. Do it.