Tracking ID or ID

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
buitenzorg1979
Posts: 2
Joined: Thu Jun 28, 2012 10:30 am

Tracking ID or ID

Post by buitenzorg1979 »

how to custom trackingID or ID like :

(companyName_fourRandomDigits_customerID)

companyName_customerID_date_Autonumber

e.g

Oracle_345_20070106_0001
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Tracking ID or ID

Post by steve »

To Change your Hesk ID you need to modify /inc/common.inc.php

around line 158 you will find

Code: Select all

/* Generate the ID */
    $trackingID  = '';
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= '-';
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= '-';
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
    $trackingID .= $useChars[mt_rand(0,29)];
Change that around to your liking.

Mine looks like this

Code: Select all

    /* Generate the ID */
    $trackingID  = '';
    $trackingID .= date(Y);
    $trackingID .= '-';
    $trackingID .= date(m);
    $trackingID .= '-';	
    $trackingID .= date(d);
    $trackingID .= '-';	
    $trackingID .= mt_rand(0,9);
    $trackingID .= mt_rand(0,9);
-Steve
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Tracking ID or ID

Post by Klemen »

Just a note: using this method could possibly lead to duplicate ticket IDs being generated.
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
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Tracking ID or ID

Post by steve »

In the event more than 99 tickets are created in a day?
-Steve
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Tracking ID or ID

Post by Klemen »

Actually, just two tickets might be enough to get a duplicate.

The

Code: Select all

mt_rand(0,9);
will randomly generate a digit from 0 - 9. This is the only random part of your ticket ID for a given day.

You use two random digits so have 100 possible combinations. This means you have a 1% chance that the second generated ID will be the same as the first one.

If you receive on average 2 tickets per day that means you will have on average 1 duplicate every 100 days. If you receive 10 tickets per day you will have a duplicate on average once per 10 days.
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
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Tracking ID or ID

Post by steve »

Very interesting, so I guess the solution would be to add another random digit to the end, that would substantially lower the odds of duplicates?
-Steve
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Tracking ID or ID

Post by Klemen »

That would make it a 0,1% possibility.

However, another important thing you have to consider is privacy and security of your customer's information.

A random ID actually serves as a password as it has millions and millions of possible combinations and is extremely hard to just guess. Your tracking ID on the other hand is easy to guess - all I need to do is try 100 possible combinations for a date and I will have access to a ticket submitted by another customer and possibly sensitive information within the ticket.
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
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Tracking ID or ID

Post by steve »

Thanks for the heads up!

I have disabled the customer interface, the only way to view a ticket is to have a user login. So for my purposes ill take the 0,1% probability.

Going forward, Ill be sure to mention the security risk involved in my method.
-Steve
Post Reply