Page 1 of 1

Blank page or 403 error when sumbitting a ticket with a large attachment

Posted: Fri Aug 31, 2018 8:14 am
by Maarten
Script URL: help.geodesk.nl
Version of script: 2.8.0
Hosting company: hosting by our own IT-department
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: post_max_size, attachment

Write your message below:
When a customer adds one attachment larger than ~8Mb (which is probably related to max_post_size which is 8M), he will get a blank page if using Firefox or a 403 error when using Chrome:
Access to help.geodesk.nl was denied
You don't have authorization to view this page.
HTTP ERROR 403
When a staff member creates a ticket with an attachment larger than ~8Mb, he gets the message:
Error:
You probably tried to submit more data than this server accepts.
Please try submitting the form again with smaller or no attachments.
I would expect a customer to get this message too.

Is there anything I can do to prevent the customer getting a blank page or a 403 error?

Kind regards,
Maarten.

Re: Blank page or 403 error when sumbitting a ticket with a large attachment

Posted: Fri Aug 31, 2018 9:22 am
by Klemen
You've got a point. Try this:

1. open submit_ticket.php in a powerful plain text editor, such as Notepad++
2. cut this code from lines 17-22

Code: Select all

// Try to detect some simple SPAM bots
if ( ! isset($_POST['hx']) || $_POST['hx'] != 3 || ! isset($_POST['hy']) || $_POST['hy'] != '' || isset($_POST['phone']) )
{
	header('HTTP/1.1 403 Forbidden');
	exit();
}
3. find this code and paste the cut code from step 2 below this code:

Code: Select all

// Check for POST requests larger than what the server can handle
if ( empty($_POST) && ! empty($_SERVER['CONTENT_LENGTH']) )
{
	hesk_error($hesklang['maxpost']);
}
So the final result should look like

Code: Select all

// Check for POST requests larger than what the server can handle
if ( empty($_POST) && ! empty($_SERVER['CONTENT_LENGTH']) )
{
	hesk_error($hesklang['maxpost']);
}

// Try to detect some simple SPAM bots
if ( ! isset($_POST['hx']) || $_POST['hx'] != 3 || ! isset($_POST['hy']) || $_POST['hy'] != '' || isset($_POST['phone']) )
{
	header('HTTP/1.1 403 Forbidden');
	exit();
}
That should fix it.

Re: Blank page or 403 error when sumbitting a ticket with a large attachment

Posted: Fri Aug 31, 2018 9:32 am
by Maarten
Thank you Klemen for the quick reply. This solves our problem!

Kind regards,
Maarten.