"Undefined" error when booking an appointment
Hi Nikola,
I am having the same issue with the ‘undefined’ error when trying to book an appointment. Same result like Baboe has described. Can you help please?
Regards
@Nikola Lonecar, here is the link to the page with the EA form – https://ponyroadautospecialists.com/contact-us/booking/
I am still waiting for an answer on this issue. After countless emails and comments on multiple forum, still no answer. Let me know if you require moreinformation please.
Regards
Hi Nikola,
We have exactly the same issue with the undefined error.
Here are the booking forms:
https://blurbybike.com/testride/
https://blurbybike.hu/tesztkor/
Let me know if you need anything from our backend or Cpanel to get it fixed.
9876 to access the booking
Hi @Nikola,
I think our hosting provider found what is the issue. Can you please check if it is correct and if yes then make a bug fix accordingly? Here is the email from our hosting provider:
We have found the exact problem.
The issue is inside the method ajax_final_appointment inside the plugin file src/ajax.php.
This function/method is called upon form submission. During form creation, this plugin creates a database record with the IP address of the user filling out the form. While finalizing the form, it verifies if the IP address is the same, using the $_SERVER["REMOTE_ADDR"] PHP super global variable.
However, this variable does not work with Cloudflare as Cloudflare uses a reverse proxy type system, and this variable would basically receive an IP different to the user's real IP.
Simply disabling this check in the code makes the appointments go through.
Appointments should now work on blurbybike.com.
This fix is slightly ugly, as it is a direct edit inside a plugin file, and updating the plugin in the future would override this edit.
I would recommend, if you go with this fix, to let the plugin developer know of this bug (they should either handle cloudflare kind of a situation in the code or skip this step). Until the plugin developer updates a fix, and you want to go ahead with this fix, you will either (i) not want to update the plugin OR (ii) Add this modification to the code everytime you update the plugin.
Let me know if you are okay with this fix, and I can apply this to the rest of your websites.
Regards,
Andrew
Attached code & comments:
We just commented out the lines inside the file /wp-content/plugins/easy-appointments/src/ajax.php , in the method ajax_final_appointment
These lines enforce an IP check – that the user starting and finishing the form, originates from the same IP address. But $_SERVER["REMOTE_ADDR"] will not serve the correct IP address if website is behind Cloudflare proxy.
//Hustly disabled these lines as $_SERVER['REMOTE_ADDR']) does not work with Cloudflare.
//error_log('Debugging: IP Address Check – $appointment["ip"]: ' . $appointment['ip']);
//error_log('Debugging: IP Address Check – $_SERVER["REMOTE_ADDR"]: ' . $_SERVER['REMOTE_ADDR']);
// check IP
//if ($appointment['ip'] != $_SERVER['REMOTE_ADDR']) {
// $this->send_err_json_result('{"err":true}');
//}
Thanks Andrew. This seems like it is working for me too now. Many thanks for a very good and positive contribution.
Regards
Twanny
Maybe the best way to handle that is to make an exception for that page to not be cached via Cloudflare.
Best regards,
Nikola
Please login or Register to submit your answer