How to Limit People From Opening Multiple Tickets
Moderator: mkoch227
-
- Posts: 65
- Joined: Sat Aug 15, 2009 9:38 pm
How to Limit People From Opening Multiple Tickets
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.
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.
Haven't tested it but in the submit_ticket.php you can add something like this:
Paste it just below:
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!");
}
Code: Select all
hesk_dbConnect();
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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


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


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
-
- Posts: 65
- Joined: Sat Aug 15, 2009 9:38 pm
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!");
}
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!");
}
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 
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


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
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).
Code: Select all
/* Custom fields */
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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