}
}
if ($chatConvoActive) {
    //echo $chatBuffer;
    $tid = rand(10000, 9999999);
    $result = mysql_query("SELECT `tid` FROM `tbltickets` WHERE `tid`='" . $tid . "'");
    $numberRows = mysql_num_rows($result);
    while ($numberRows > 0) {
        $tid = rand(10000, 9999999);
        $result = mysql_query("SELECT `tid` FROM `tbltickets` WHERE `tid`='" . $tid . "'");
        $numberRows = mysql_num_rows($result);
    }
    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 = "";
if ($utype == 2) {
    echo "true";
} else {
    echo "false";
}
?>
;
var currentSession = "<?php 
echo $_GET["currentSession"];
?>
";<?php 
require_once "../chat/chatSession.php";
$chat_session = new chatSession();
if ($utype == 0) {
    $chat_session->useSession($_GET["currentSession"]);
    echo "\nvar username = \"" . $chat_session->getName() . "\";";
} elseif ($utype == 1) {
    $chat_session->getUID();
    $userResult = mysql_query("SELECT * FROM `tblclients` WHERE `id`='" . $uid . "';");
    while ($uRow = mysql_fetch_array($userResult)) {
        switch ($chat_settings["ClientDisplayName"]) {
            case "l":
                $uname = $uRow["lastname"];
                break;
            case "f":
                $uname = $uRow["firstname"];
                break;
            case "fl":
                $uname = $uRow["firstname"] . " " . $uRow["lastname"];
                break;
            case "lf":
Example #3
0
        }
    }
    if ($row[0] == "SystemURL") {
        if ($url == "") {
            $url = $row[1];
        }
    }
}
$url = substr($url, 0, -1);
if ($utype == 2) {
    // Client Info
    $env = $chat_sess->getEnvironment();
    if ($chat_sess->getUID() != 0) {
        $bufferClientInfo .= "<div class=\"clientSummery\"><img src=\"images/details.gif\" alt=\"Client\" /> <a href=\"" . $url . "/" . $customadminpath . "/clientssummary.php?userid=" . $chat_sess->getUID() . "\" target=\"_blank\">Client Summary Page</a></div><br />";
    }
    $bufferClientInfo .= "<strong>Inputted Data</strong><br />\n\t\t\n\t\t<table class=\"clientInfo\">\n\t\t\t<tr>\n\t\t\t\t<td>Name</td>\n\t\t\t\t<td>" . $chat_sess->getName() . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>Email</td>\n\t\t\t\t<td>" . $chat_sess->getEmail() . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>Question</td>\n\t\t\t\t<td>" . $chat_sess->getQuestion() . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>Session</td>\n\t\t\t\t<td>" . $chat_sess->getSession() . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>Remote IP</td>\n\t\t\t\t<td>" . $env["REMOTE_ADDR"] . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>HTTP User Agent</td>\n\t\t\t\t<td>" . $env["HTTP_USER_AGENT"] . "</td>\n\t\t\t</tr>\n\t\t</table>";
    if ($chat_sess->getUID() == 0) {
        $guessBuffer = "";
        $guessBuffer .= "<br /><strong>Intelligent Guess</strong><br /><table class=\"clientInfo\">";
        $run = false;
        $result = mysql_query("SELECT * FROM `tblclients` WHERE `email` LIKE '" . $chat_sess->getEmail() . "' OR `ip`='" . $env["REMOTE_ADDR"] . "'");
        while ($row = mysql_fetch_array($result)) {
            if ($clientSelected[$row["id"]] != "true") {
                $guessBuffer .= "<tr>\n\t\t\t\t<td>Client: <a href=\"" . $url . "/" . $customadminpath . "/clientssummary.php?userid=" . $row["id"] . "\" target=\"_blank\">" . $row["firstname"] . " " . $row["lastname"] . "</a></td>\n\t\t\t\t</tr>";
                $clientSelected[$row["id"]] = "true";
                $run = true;
            }
        }
        $name = explode(" ", $chat_sess->getName());
        for ($guess = 0; $guess < count($name); $guess++) {
            $result = mysql_query("SELECT * FROM `tblclients` WHERE `firstname` LIKE '" . $name[$guess] . "' OR `lastname` LIKE '" . $name[$guess] . "' OR `companyname` LIKE '" . $name[$guess] . "'");