How to Limit People From Opening Multiple Tickets

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
SupportCenter
Posts: 65
Joined: Sat Aug 15, 2009 9:38 pm

How to Limit People From Opening Multiple Tickets

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

Post 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:

Code: Select all

hesk_dbConnect();
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
SupportCenter
Posts: 65
Joined: Sat Aug 15, 2009 9:38 pm

Post by SupportCenter »

Im not going to buy you a beer. Im buying you the Krystal!

Works like a charm!

PHP MASTER!
SupportCenter
Posts: 65
Joined: Sat Aug 15, 2009 9:38 pm

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

Post 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.
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
SupportCenter
Posts: 65
Joined: Sat Aug 15, 2009 9:38 pm

Post by SupportCenter »

I changed it so that they could only open up one ticket. I just changed it to make sure its > 1.
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You should use hesk_dbNumRows($res) > 0 to allow only one ticket, not > 1 (this would allow up to 2 tickets).
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
SupportCenter
Posts: 65
Joined: Sat Aug 15, 2009 9:38 pm

Post 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!");
}
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
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
franku
Posts: 12
Joined: Thu Jul 22, 2010 3:57 pm

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

Post by Klemen »

Instead of $email you will need to use $tmpvar['email'] in the code and paste the code just above

Code: Select all

/* Custom fields */
(because the hesk_dbConnect(); portion has been moved toward the top of the file).
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
Post Reply