In the SCP when viewing the tickets you get can see the IP address of the workstation that made the ticket request. How hard is it to add the workstation name? I know I would have to add a column to the ticket table and the table on the web page but how do I grab the data when posting?

Thanks

ZeroEffect

a month later

In the SCP when viewing the tickets you get can see the IP address of the workstation that made the ticket request. How hard is it to add the workstation name? I know I would have to add a column to the ticket table and the table on the web page but how do I grab the data when posting?

Thanks

ZeroEffect

Hello,

open osticket folder, and then include, and then staff, and then viewticket.inc.php

find this code:

IP Address:

<?=$ticket->getIP()?>

after this code put this code

Workstations:

<?php $hostname = gethostbyaddr($ticket->getIP()); echo $hostname; ?>

and that is your Workstations name...

I hope so that code is help you...

Looks interesting but in a DHCP environment converting the IP address in the database to a workstation name could return the wrong workstation, but this does give me a good place to start. The class.ticket.php calls this function twice.

Once as a function

function getIP() {

return $this->row;

and here

//Insert Staff Reply

function postResponse($msgid,$response,$signature='none',$attachment=false,$canalert=true){

global $thisuser,$cfg;

if(!$thisuser || !$thisuser->getId() || !$thisuser->isStaff()) //just incase

return 0;

$sql= 'INSERT INTO '.TICKET_RESPONSE_TABLE.' SET created=NOW() '.

',ticket_id='.db_input($this->getId()).

',msg_id='.db_input($msgid).

',response='.db_input(Format:($response)).

',staff_id='.db_input($thisuser->getId()).

',staff_name='.db_input($thisuser->getName()).

',ip_address='.db_input($thisuser->getIP());

$resp_id=0

but where is the IP address inserted in the database when a ticket is created? I'm still hunting.

Thanks for the help.

ZeroEffect

but where is the IP address inserted in the database when a ticket is created? I'm still hunting.

Thanks for the help.

ZeroEffect

File: /include/class.ticket.php

$sql= 'INSERT INTO '.TICKET_TABLE.' SET created=NOW() '.

',ticketID='.db_input($extId).

',dept_id='.db_input($deptId).

',priority_id='.db_input($priorityId).

',email='.db_input($var).

',name='.db_input(Format:($var)).

',subject='.db_input(Format:($var)).

',topic='.db_input(Format:($topicDesc)).

',phone='.db_input($var).

',phone_ext='.db_input($var?$var:'').

',ip_address='.db_input($ipaddress).

',source='.db_input($source);

Does anyone knows how to obtain netname/organization that owns the IP?

:

Does anyone knows how to obtain netname/organization that owns the IP?

:

I answered myself....

Using geoip_org_by_name ($ticket->getIP())

NOTE: Geo IP PHP module must be installed on server.

Write a Reply...