Script URL: (in testing phase - haven't uploaded site yet)
Version of script: 0.94
Hosting company: (in testing phase - haven't uploaded site yet)
URL of phpinfo.php: (in testing phase - haven't uploaded site yet)
URL of session_test.php: (in testing phase - haven't uploaded site yet)
What terms did you try when SEARCHING for a solution: sequential, trackingID
Write your message below:
Hi there,
I would like to change the Ticket ID's from random to sequential (starting at # 1). I'm assuming the following script would need to be changed but I'm not quite show in which way:
&useChars='AEUYBDGHJLMNPQRSTVWXZ123456789';
&trackingID = $useChars{mt_rand{0,29} };
for {$i=1;$1<10;$i++}
{
$trackingID .= $useChars{mt_rand{0,29} };
}
$trackingURL=$hesk_settings{'hesk_url'].'/ticket.php=' .$trackingID;
Any advice would be greatly appreciated.
Cheers,
Matt
TrackingID - Changing from Random to Sequential
Moderator: mkoch227
Hi,
First of all I don't recommend doing this if you want to keep your customers' information private. It's hard to guess a random tracking ID, but with sequential IDs you could easily read tickets from other people, you'd just open ticket.php?t=123 (any number) in your browser. Too much of a privacy risk.
That said, Hesk does have tickets labeled sequentially already in the database, MySQL table "hesk_tickets", column "id". You could use that instead of "trackid", but that's quote some work to edit and is out of the scope of my support. Here.
First of all I don't recommend doing this if you want to keep your customers' information private. It's hard to guess a random tracking ID, but with sequential IDs you could easily read tickets from other people, you'd just open ticket.php?t=123 (any number) in your browser. Too much of a privacy risk.
That said, Hesk does have tickets labeled sequentially already in the database, MySQL table "hesk_tickets", column "id". You could use that instead of "trackid", but that's quote some work to edit and is out of the scope of my support. Here.
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
I just tacked on the autoincrement to 4 random characters so that it still is secure but still has an incremented number to assist manual tracking. The other possibility for no randomness would be to just do an update and set trackingID to id.
------------------------------------------------------------------------------
----------------------------------------------------------------------------
I insert that as the ID and then update it (because I need to insert it first in order to get the ID). I suppose you could ask for what the next autoincrement will be but I did it this way as I don't know either has any particular advantage [speed?] and I personally found this to be easier.
Here is what goes after the insertion
--------------------------------------------------------------------------------
[/code]
------------------------------------------------------------------------------
Code: Select all
//give me 4 random characters
$trackingIDheader='';
for ($i=1;$i<=4;$i++) {
$tmp = substr('AEUYBDGHJLMNPQRSTVWXZ', rand(1,21), 1);
$trackingIDheader .= $tmp;
}
//give us just the 4 for now and then we'll update this to include the inserted id
$trackingID = $trackingIDheader;
I insert that as the ID and then update it (because I need to insert it first in order to get the ID). I suppose you could ask for what the next autoincrement will be but I did it this way as I don't know either has any particular advantage [speed?] and I personally found this to be easier.
Here is what goes after the insertion
--------------------------------------------------------------------------------
Code: Select all
/* Get insert ID, create the trackingID and then update.. this is a bit of a hack! Hesk was written for totally random IDs, see above */
$insertid = mysql_insert_id();
$trackingID = $trackingIDheader . $insertid;
$trackingURL=$hesk_settings['hesk_url'].'/ticket.php?track='.$trackingID;
$sql = "
UPDATE `hesk_tickets` SET `trackid` = '$trackingID' WHERE id = '$insertid'";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");[code]