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

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Maarten
Posts: 5
Joined: Mon Feb 16, 2015 12:57 pm

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

Post 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.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

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

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Maarten
Posts: 5
Joined: Mon Feb 16, 2015 12:57 pm

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

Post by Maarten »

Thank you Klemen for the quick reply. This solves our problem!

Kind regards,
Maarten.
Post Reply