Page 1 of 1
How to Limit People From Opening Multiple Tickets
Posted: Tue Sep 29, 2009 11:42 pm
by SupportCenter
Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
Hi, Just wanted to know if there was a way that I could limit the number of tickets people can open at one given time. I got people that open up 2 or 3 tickets at a time and its cramming up our support ticket system.
I wanted to know how to do this also in the event some person starts to spam our support site with opening up multiple tickets purposely.
Thank you.
Posted: Wed Sep 30, 2009 2:52 pm
by Klemen
Haven't tested it but in the submit_ticket.php you can add something like this:
Code: Select all
$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` != '3' AND (`email` LIKE '".hesk_dbEscape($email)."' OR `ip` LIKE '".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."')";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) >= 3)
{
hesk_error("You can have maximum 3 open tickets at a time!");
}
Paste it just below:
Posted: Thu Oct 01, 2009 1:19 am
by SupportCenter
Im not going to buy you a beer. Im buying you the Krystal!
Works like a charm!
PHP MASTER!
Posted: Thu Apr 01, 2010 1:50 am
by SupportCenter
Today a few people where able to post multiple tickets at once. I dont know how they did it but it was done.
I couldnt find this topic so I opened up another Topic conversation sorry.
Posted: Fri Apr 02, 2010 2:07 pm
by Klemen
The fix mentioned here allows up to 3 open tickets with the same e-mail, but if they use another e-mail it won't help.
Posted: Fri Apr 02, 2010 7:43 pm
by SupportCenter
I changed it so that they could only open up one ticket. I just changed it to make sure its > 1.
Posted: Fri Apr 02, 2010 8:15 pm
by Klemen
You should use hesk_dbNumRows($res) > 0 to allow only one ticket, not > 1 (this would allow up to 2 tickets).
Posted: Wed Apr 07, 2010 1:08 am
by SupportCenter
having it set to 0 prevents anyone from opening or creating a ticket.
This seems to work :
/* Add to database */
hesk_dbConnect();
$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` != '1' AND (`email` LIKE '".hesk_dbEscape($email)."' OR `ip` LIKE '".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."')";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) > 1)
{
hesk_error("You can have maximum 1 open tickets at a time!");
}
Posted: Wed Apr 07, 2010 2:31 pm
by Klemen
Your code allows up to 2 tickets. If one already in the database and the second one is still submitted because hesk_dbNumRows($res) will return 1 so it's not more ">" than 1 and no error is given.
Posted: Thu Jul 22, 2010 5:38 pm
by franku
Hi Kleman - will this work with the latest version of Hesk? Or is there new code that will be needed to be used ?
Posted: Thu Jul 22, 2010 6:39 pm
by Klemen
Instead of $email you will need to use $tmpvar['email'] in the code and paste the code just above
(because the hesk_dbConnect(); portion has been moved toward the top of the file).