Limit the number of open tickets

Helpdesk for my helpdesk software

Moderator: mkoch227

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

Limit the number of open tickets

Post by SupportCenter »

I'd like to know how to prevent users from opening multiple tickets. I've already tried this and it doesnt seem to work. I was able to open multiple tickets and have seen others do so. I've changed all the 3's to 1's and then 2's nothing seems to work.


1. Paste the following below the hesk_dbConnect(); in the submit_ticket.php

$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:
hesk_dbConnect();

2. To limit the number of tickets to one change all the 3's to 1's
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

What version are you using?
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 using the version prior to the new release.
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

I just tested version 2.1 and this code works fine for me - it doesn't allow more than 3 open tickets. Just make 100% sure you paste it BELOW hesk_dbConnect();

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) > 2)
{
	hesk_error("You can have maximum 3 open tickets at a time!");
}
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 »

it is located below that file. I thought it worked before checked thee tickets and they were still able to open a new ticket.
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Yes, but they probably used a different e-mail address? Or they re-opened a ticket that was already closed in the past?
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 »

No they are entering the same exact information as before. Today I had two people reopen tickets that had one waiting for reply. There has to be a different way where you can block them by IP. I did the code exactly and it doesnt work.
SupportCenter
Posts: 65
Joined: Sat Aug 15, 2009 9:38 pm

Post by SupportCenter »

$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` != '2' 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!");
}

THIS IS THE CORRECT CODE
Klemen
Site Admin
Posts: 10143
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Wait, wait, this is the first time you made sense now - you are talking about reopening tickets now, not opening new ones!

If you want to prevent them to REopen more than XY tickets you will need to add the same ticket checking code into the change_status.php file i n line 65, just above:
$status = 1;
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