Ejemplo n.º 1
0
 }
 if (empty($departments[count($departments) - 1])) {
     $departments[count($departments) - 1] = $chat_settings["defaultDepartment"];
 }
 $result = mysql_query("INSERT INTO `tbltickets` (`tid`, `did`, `userid`, `name`, `email`, `c`, `date`, `title`, `message`, `status`, `urgency`, `lastreply`, `clientunread`, `adminunread`)\nVALUES ('" . $tid . "', '" . $departments[count($departments) - 1] . "', '" . $uid . "', '" . mysql_real_escape_string($chat_session->getName()) . "', '" . mysql_real_escape_string($chat_session->getEmail) . "', '" . $_SERVER["UNIQUE_ID"] . "', '" . date("Y-m-d G:i:s") . "', 'Live Chat Transcript', '" . mysql_real_escape_string($chatBuffer) . "', 'Closed', 'Low', '" . date("Y-m-d G:i:s") . "','0', '0');");
 $result3 = mysql_query("SELECT `id` FROM `tbltickets` WHERE `tid`='" . $tid . "'");
 while ($row3 = mysql_fetch_array($result3)) {
     $ticketid = $row3["id"];
     //print_r($row3);
 }
 //echo $ticketid;
 $chat_session->setActive("2");
 $chat_session->setTID($ticketid);
 // Inputted Information
 $inputBuffer = "Name: " . $chat_session->getName() . "<br />Email: " . $chat_session->getEmail() . "<br />Question: " . $chat_session->getQuestion() . "<br />Session: " . $chat_session->getSession() . "<br />Remote IP: " . $env["REMOTE_ADDR"] . "<br />HTTP User Agent: " . $env["HTTP_USER_AGENT"];
 $result2 = mysql_query("INSERT INTO `tblticketnotes` (`ticketid`, `admin`, `date`, `message`) VALUES ('" . $ticketid . "', 'Live Chat System', '" . date("Y-m-d G:i:s", $chat_session->getTimestamp()) . "', '" . mysql_real_escape_string($inputBuffer) . "');");
 // Post Notes to ticket notes:
 $result = mysql_query("SELECT * FROM `chat_notes` WHERE `session`='" . mysql_real_escape_string($_POST["session"]) . "' ORDER BY `timestamp` ASC;");
 while ($row = mysql_fetch_array($result)) {
     $noteBuffer = "";
     $htmlDecode = html_entity_decode($row["note"]);
     // Identify user's name
     $userResult = mysql_query("SELECT * FROM `tbladmins` WHERE `id`='" . $row["admin"] . "';");
     while ($uRow = mysql_fetch_array($userResult)) {
         $uname = $uRow["firstname"] . " " . $uRow["lastname"];
     }
     $noteBuffer .= "<div class=\"innote " . $row["order"] . "\">";
     //$noteBuffer .= "<span class=\"note aname\">".strip_tags(preg_replace('/<script\b[^>]*>(.*?)<\/script>/i', "", $uname)).":</span> ";
     $noteBuffer .= "<span class=\"note asays\">" . nl2br(strip_tags($htmlDecode)) . "</span></div>";
     $result2 = mysql_query("INSERT INTO `tblticketnotes` (`ticketid`, `admin`, `date`, `message`) VALUES ('" . $ticketid . "', '" . mysql_real_escape_string($uname) . "', '" . date("Y-m-d G:i:s", $row["timestamp"]) . "', '" . mysql_real_escape_string($noteBuffer) . "');");
 }