Lets try a different avenue. Doing it this way will require that you send all your site support links directly to the root open.php page as this is where the form is and HTTP_REFERER only gives you the previous page.
Before we start on the code, we'll need somewhere in the database to store the referring URL's. Let's create a new column on ost_ticket, called "referer".
You'll need access to PHPMyAdmin or some other database manipulation software.
Run this SQL query....
ALTER TABLE ost_ticket ADD COLUMN referer varchar(255);
in main.inc.php
find this code...
ini_set('session.use_trans_sid', 0);
and REPLACE it with this code...
/*ini_set('session.use_trans_sid', 0);*
PS. I HAVE NO IDEA WHAT REPERCUSSIONS (IF ANY) THE ABOVE EDIT WILL HAVE AND ACCEPT NO RESPONSIBILITY FOR ANYTHING. USE AT YOUR OWN RISK
in open.inc.php
At the very top (line 1) add this code...
<?php
session_start();
if($_SERVER){
$_SESSION = $_SERVER;
}
?>
lets put the referring URL into our hidden input...
Find this code...
<textarea name="message" cols="35" rows="8" wrap="soft" style="width%"><?=$info?></textarea></td>
</tr>
Directly below add this...
<input type="hidden" name="referer" value="<?php
echo $_SERVER;
?>" />
Now we need to edit class.ticket.php to get the value from the field and write it to the database...
find this code...
var $overdue;
under it add this...
var $referer;
find this code...(around line 74)
$this->fullname =$row;
under it add this...
$this->referer =$row;
find this code...(around line 139)
function getName(){
return $this->fullname;
}
under it add this...
function getReferer(){
return $this->referer;
}
Find this code...(around line 1096)
$fields = array('type'=>'string', 'required'=>1, 'error'=>'Name required');
under it add this...
$fields = array('type'=>'string', 'required'=>0, 'error'=>'Referer required');
Find this code...(around line 1144)
',name='.db_input(Format:($var)).
under it add this...
',referer='.db_input(Format:($var)).
Find this code...(around line 1185)
$fields = array('type'=>'string', 'required'=>1, 'error'=>'Name required');
Under it add this...
$fields = array('type'=>'string', 'required'=>0, 'error'=>'Referer required');
Find this code...(around line 1133)
',name='.db_input(Format:($var)).
Under it add this...
',referer='.db_input(Format:($var)).
This code is tested and working on my server.
Now you have hidden field "referrer" writing its value (HTTP_REFERER) to the database.