//add to knowledge base if ($var_addtokb == "atokb" and $var_category > 0) { if (isKBApprovalNeeded()) { $kb_flag = "I"; } else { $kb_flag = "A"; } $var_replymatter_new_quest = $var_tqusetion . "\n\n" . $var_replymatter; //$var_replymatter= $var_tqusetion $sql = "Insert into sptbl_kb(nKBID,nCatId, nStaffId, vKBTitle,"; $sql .= " tKBDesc, dDate, vStatus"; $sql .= ") Values('','" . mysql_real_escape_string($var_category) . "','" . mysql_real_escape_string($_SESSION["sess_staffid"]) . "','" . mysql_real_escape_string($var_tickettitle) . "',"; $sql .= "'" . mysql_real_escape_string($var_replymatter_new_quest) . "',now(), '{$kb_flag}')"; executeQuery($sql, $conn); $var_insert_id = mysql_insert_id($conn); updateCount($var_catid, "+"); //Insert the actionlog if (logActivity()) { $sql = "Insert into sptbl_actionlog(nALId,nStaffId,vAction,vArea,nRespId,dDate) Values('','" . $_SESSION["sess_staffid"] . "','" . TEXT_ADDITION . "','Knowledgebase','" . mysql_real_escape_string($var_insert_id) . "',now())"; executeQuery($sql, $conn); } } //update ticket fileds $sql = " Select * from sptbl_lookup where vLookUpName IN('Post2PostGap','MailFromName','MailFromMail',"; $sql .= "'MailReplyName','MailReplyMail','Emailfooter','Emailheader','AutoLock','MailEscalation','HelpdeskTitle')"; $result = executeSelect($sql, $conn); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { switch ($row["vLookUpName"]) { case "MailFromName": $var_fromName = $row["vLookUpValue"];
} } $message = true; $infomessage = MESSAGE_RECORD_ADDED_SUCCESSFULLY; $flag_msg = 'class="msg_success"'; $var_kbtitle = ""; $var_kbdesc = ""; $var_kbmetatagkeyword = ""; $var_kbmetatagdescription = ""; } } elseif ($_POST["postback"] == "D") { if (!$error) { $catid = getCategoryId($var_id); $sql = "DELETE FROM sptbl_kb where nKBID='" . mysql_real_escape_string($var_id) . "'"; executeQuery($sql, $conn); updateCount($catid, "-"); //Insert the actionlog if (logActivity()) { $sql = "Insert into sptbl_actionlog(nALId,nStaffId,vAction,vArea,nRespId,dDate) Values('','{$var_staffid}','" . TEXT_DELETION . "','Knowledgebase','" . mysql_real_escape_string($var_id) . "',now())"; executeQuery($sql, $conn); } $var_catname = ""; $var_companyid = trim($_POST["cmbCompany"]); $var_departmentid = trim($_POST["cmbDepartment"]); $var_catid = $_POST["cmbCategory"]; $message = true; $infomessage = MESSAGE_KBENTRY_DELETED . "<br>"; $flag_msg = 'class="msg_success"'; $var_id = ""; } } elseif ($_POST["postback"] == "U") {
//如果不存在添加 $dataLog = array('cus_id' => $cus_id, 'ip' => $ip, 'expires' => $expires, 'sessid' => $sessid, 'platform' => $platform); $insertLog = insertLog($dataLog, $db); } else { $dataLog = array('expires' => $expires, 'ip' => $ip, 'sessid' => $sessid); $updateLog = updateLog($cus_id, $dataLog, $db); } //查看是否存在统计记录 $counter = findCount($cus_id, $db); if (empty($counter)) { //不存在,添加 $dataCount = array('cus_id' => $cus_id, 'record_date' => $date); $insertCount = insertCount($dataCount, $db); } if (isset($insertLog)) { $updateCount = updateCount($cus_id, $platform, $counter, $db); echo 'update statis succeed'; } else { echo 'not need update statis'; } /** * 查找日志 * @param type $cus_id * @param type $db * @return type */ function findLog($cus_id, $ip, $sessid, $db) { $res = $db->query("select * from up_statis_log where cus_id={$cus_id} and ip='{$ip}' and sessid='{$sessid}' limit 1", PDO::FETCH_ASSOC); foreach ($res as $v) { $row = $v;
function deleteEntry($id) { global $conn; global $var_staffid; $catid = getCategoryId($id); $sql = "DELETE FROM sptbl_kb where nKBID= {$id} "; executeQuery($sql, $conn); updateCount($catid, "-"); //Insert the actionlog if (logActivity()) { $sql = "Insert into sptbl_actionlog(nALId,nStaffId,vAction,vArea,nRespId,dDate) Values('','{$var_staffid}','" . TEXT_DELETION . "','Knowledgebase','" . mysql_real_escape_string($id) . "',now())"; executeQuery($sql, $conn); } }
/**/ include './header.php'; function updateCount($count, $id) { $count++; if ($count > 3) { $query = "DELETE FROM notifications WHERE id={$id}"; $result = @mysql_query($query); return 1; } $query = "UPDATE notifications SET readcount={$count} WHERE id={$id}"; $result = @mysql_query($query); return 0; } echo '<table cellspacing="5">'; $query = "SELECT id,thetext,thedate,readcount FROM notifications WHERE ownerid={$id} AND sid={$sid} ORDER BY thedate DESC"; $result = @mysql_query($query); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<tr> <td><b>' . $row[thedate] . '</b></td> <td>' . $row[thetext] . '</td> </tr>'; updateCount($row[readcount], $row[id]); } } else { echo 'You have no notifications'; } echo '</table>'; include './footer.php';