if ($maxrows['value'] < 1) { echo '<tr><td colspan="6"><center><span class=red>暂无任何记录!</span></center></td></tr></tbody></table></form>'; } else { while ($comment = $DB->fetch($getcomments)) { if ($comment['type']) { $from = $users[$comment['fromid']]; $to = $guests[$comment['toid']]; } else { $from = $guests[$comment['fromid']]; $to = $users[$comment['toid']]; } echo '<tr> <td>' . $from . '</td> <td>' . $to . '</td> <td>' . nl2br($comment['msg']) . '</a></td> <td>' . DisplayDate($comment['created'], 0, 1) . '</td> <td><input type="checkbox" name="deletecommentids[]" value="' . $comment['msgid'] . '" checkme="group"></td> </tr>'; } $totalpages = ceil($maxrows['value'] / $NumPerPage); if ($totalpages > 1) { echo '<tr><th colspan="6" class="last">' . GetPageList('admin.comments.php', $totalpages, $page, 10, 'u', $uid) . '</th></tr>'; } echo '</tbody> </table> <div style="margin-top:20px;text-align:center;"> <input type="submit" onclick="return confirm(\'确定删除所选记录吗?\');" value=" 删除记录 " /> </div> </form>'; } }
public function index() { $NumPerPage = 10; $page = ForceIntFrom('p', 1); $search = ForceStringFrom('s'); $groupid = ForceStringFrom('g'); if (IsGet('s')) { $search = urldecode($search); } $start = $NumPerPage * ($page - 1); SubMenu('记录列表', array(array('记录列表', 'messages', 1))); TableHeader('搜索及快速删除'); TableRow('<center><form method="post" action="' . BURL('messages') . '" name="searchmessages" style="display:inline-block;*display:inline;"><label>关键字:</label> <input type="text" name="s" size="18"> <label>分类:</label> <select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>客人的发言</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>客服的发言</option></select> <input type="submit" value="搜索记录" class="cancel"></form> <form method="post" action="' . BURL('messages/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除记录:</label> <select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的对话记录</option><option value="180"> 6 个月前的对话记录</option><option value="90"> 3 个月前的对话记录</option><option value="30"> 1 个月前的对话记录</option></select> <input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选记录吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>'); TableFooter(); if ($search) { if (preg_match("/^[1-9][0-9]*\$/", $search)) { $s = ForceInt($search); $searchsql = " WHERE mid = '{$s}' OR fromid = '{$s}' OR toid = '{$s}' "; //按ID搜索 $title = "搜索ID号为: <span class=note>{$s}</span> 的记录"; } else { $searchsql = " WHERE (fromname LIKE '%{$search}%' OR toname LIKE '%{$search}%' OR msg LIKE '%{$search}%') "; $title = "搜索: <span class=note>{$search}</span> 的记录列表"; } if ($groupid) { if ($groupid == 1 or $groupid == 2) { $searchsql .= " AND type = " . Iif($groupid == 1, 0, 1) . " "; $title = "在 <span class=note>" . Iif($groupid == 1, '客人的发言', '客服的发言') . "</span> 中, " . $title; } } } else { if ($groupid) { if ($groupid == 1 or $groupid == 2) { $searchsql .= " WHERE type = " . Iif($groupid == 1, 0, 1) . " "; $title = "全部 <span class=note>" . Iif($groupid == 1, '客人的发言', '客服的发言') . "</span> 列表"; } } else { $searchsql = ''; $title = '全部记录列表'; } } $getmessages = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "msg " . $searchsql . " ORDER BY mid DESC LIMIT {$start},{$NumPerPage}"); $maxrows = APP::$DB->getOne("SELECT COUNT(mid) AS value FROM " . TABLE_PREFIX . "msg " . $searchsql); echo '<form method="post" action="' . BURL('messages/updatemessages') . '" name="messagesform"> <input type="hidden" name="p" value="' . $page . '">'; TableHeader($title . '(' . $maxrows['value'] . '个)'); TableRow(array('ID', '发送人', '对话内容', '接收人', '记录时间', '<input type="checkbox" id="checkAll" for="deletemids[]"> <label for="checkAll">删除</label>'), 'tr0'); if ($maxrows['value'] < 1) { TableRow('<center><BR><font class=redb>未搜索到任何记录!</font><BR><BR></center>'); } else { while ($msg = APP::$DB->fetch($getmessages)) { TableRow(array($msg['mid'], "<a title=\"编辑\" href=\"" . Iif($msg['type'], BURL('users/edit?aid=' . $msg['fromid']), BURL('guests/edit?gid=' . $msg['fromid'])) . "\">{$msg['fromname']}</a>", getSmile($msg['msg']), "<a title=\"编辑\" href=\"" . Iif($msg['type'], BURL('guests/edit?gid=' . $msg['toid']), BURL('users/edit?aid=' . $msg['toid'])) . "\">{$msg['toname']}</a>", DisplayDate($msg['time'], '', 1), '<input type="checkbox" name="deletemids[]" value="' . $msg['mid'] . '">')); } $totalpages = ceil($maxrows['value'] / $NumPerPage); if ($totalpages > 1) { TableRow(GetPageList(BURL('messages'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid)); } } TableFooter(); PrintSubmit('删除记录', '', 1, '确定删除所选记录吗?'); }
public function index() { $NumPerPage = 10; $page = ForceIntFrom('p', 1); $search = ForceStringFrom('s'); $groupid = ForceStringFrom('g'); if (IsGet('s')) { $search = urldecode($search); } $start = $NumPerPage * ($page - 1); SubMenu('留言列表', array(array('留言列表', 'comments', 1))); TableHeader('搜索及快速删除'); TableRow('<center><form method="post" action="' . BURL('comments') . '" name="searchcomments" style="display:inline-block;*display:inline;"><label>关键字:</label> <input type="text" name="s" size="18"> <label>状态:</label> <select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>未读</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>已读</option></select> <input type="submit" value="搜索留言" class="cancel"></form> <form method="post" action="' . BURL('comments/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除留言:</label> <select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的已读留言</option><option value="180"> 6 个月前的已读留言</option><option value="90"> 3 个月前的已读留言</option><option value="30"> 1 个月前的已读留言</option></select> <input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选留言吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>'); TableFooter(); if ($search) { if (preg_match("/^[1-9][0-9]*\$/", $search)) { $s = ForceInt($search); $searchsql = " WHERE cid = '{$s}' OR gid = '{$s}' OR phone LIKE '%{$s}%' "; //按ID搜索 $title = "搜索数字为: <span class=note>{$s}</span> 的留言"; } else { $searchsql = " WHERE (fullname LIKE '%{$search}%' OR email LIKE '%{$search}%' OR content LIKE '%{$search}%') "; $title = "搜索: <span class=note>{$search}</span> 的留言列表"; } if ($groupid) { if ($groupid == 1 or $groupid == 2) { $searchsql .= " AND readed = " . Iif($groupid == 1, 0, 1) . " "; $title = "在 <span class=note>" . Iif($groupid == 1, '未读留言', '已读留言') . "</span> 中, " . $title; } } } else { if ($groupid) { if ($groupid == 1 or $groupid == 2) { $searchsql .= " WHERE readed = " . Iif($groupid == 1, 0, 1) . " "; $title = "全部 <span class=note>" . Iif($groupid == 1, '未读留言', '已读留言') . "</span> 列表"; } } else { $searchsql = ''; $title = '全部留言列表'; } } $getcomments = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "comment " . $searchsql . " ORDER BY readed ASC, cid DESC LIMIT {$start},{$NumPerPage}"); $maxrows = APP::$DB->getOne("SELECT COUNT(cid) AS value FROM " . TABLE_PREFIX . "comment " . $searchsql); echo '<form method="post" action="' . BURL('comments/updatecomments') . '" name="commentsform"> <input type="hidden" name="p" value="' . $page . '">'; TableHeader($title . '(' . $maxrows['value'] . '个)'); TableRow(array('ID', '状态', '姓名', 'Email', '电话', '留言内容', '<input type="checkbox" id="checkAll2" for="updatecids[]"> <label for="checkAll2">标记已读</label>', 'IP', '留言时间', '<input type="checkbox" id="checkAll" for="deletecids[]"> <label for="checkAll">删除</label>'), 'tr0'); if ($maxrows['value'] < 1) { TableRow('<center><BR><font class=redb>未搜索到任何留言!</font><BR><BR></center>'); } else { while ($comm = APP::$DB->fetch($getcomments)) { TableRow(array($comm['cid'], Iif($comm['readed'], '<font class=grey>已读</font>', '<font class=red>未读</font>'), Iif($comm['gid'], '<a title="编辑" href="' . BURL('guests/edit?gid=' . $comm['gid']) . '">' . "{$comm['fullname']}</a>", $comm['fullname']), Iif($comm['email'], '<a href="mailto:' . $comm['email'] . '">' . $comm['email'] . '</a>'), $comm['phone'], nl2br($comm['content']), Iif(!$comm['readed'], '<input type="checkbox" name="updatecids[]" value="' . $comm['cid'] . '">'), $comm['ip'], DisplayDate($comm['time'], '', 1), '<input type="checkbox" name="deletecids[]" value="' . $comm['cid'] . '">')); } $totalpages = ceil($maxrows['value'] / $NumPerPage); if ($totalpages > 1) { TableRow(GetPageList(BURL('comments'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid)); } } TableFooter(); echo '<div class="submit"><input type="submit" name="updatecomms" value="标记已读" class="cancel" style="margin-right:28px"><input type="submit" name="deletecomms" value="删除留言" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选留言吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></div></form>'; }
private function DisplayBackups() { TableHeader('数据库备份文件'); TableRow(array('文件名 (/config/)', '大小', '备份日期', '操作', '', ''), 'tr0'); if (is_dir($this->backupDir)) { $dir = opendir($this->backupDir); while (false !== ($file = readdir($dir))) { if (strpos(strtolower($file), '.sql') > 0) { $stats = stat($this->backupDir . $file); if ($stats['size'] > 0) { TableRow(array($file, DisplayFilesize($stats['size']), DisplayDate($stats['mtime']), '<a file="' . $file . '" class="link-btn restore">恢复</a>', '<a href="' . BURL('database/ajax?action=download&file=' . $file) . '" class="link-btn">下载</a>', '<a file="' . $file . '" class="link-btn ajax">删除</a>')); } } } } TableFooter(); }
echo '<tr> <td> <input type="hidden" name="userids[]" value="' . $user['userid'] . '"> <input type="text" name="displayorders[]" value="' . $user['displayorder'] . '" size="4"></td> </td> <td><a href="admin.users.php?action=' . Iif($user['type'] > 1, 'editqms', 'edituser') . '&userid=' . $user['userid'] . '" ' . Iif(!$user['activated'], 'class="red"') . '>' . $user['username'] . '</a>' . Iif($typename, ' (' . $typename . ')') . '</td> <td> <select name="activateds[]"> <option value="1">正常</option> <option style="color:red;" value="0" ' . Iif(!$user['activated'], 'SELECTED', '') . '>禁止</option> </select></td> <td>' . $usergroups[$user['usergroupid']] . '</td> <td>' . Iif($user['userfrontname'], $user['userfrontname'], '-') . '</td> <td>' . Iif($user['userfrontename'], $user['userfrontename'], '-') . '</td> <td>' . Iif($typename, '-', Iif($user['isonline'], '<span class="green">在线</span>', '离线')) . '</td> <td>' . Iif($typename, '-', Iif($user['lastlogin'], DisplayDate($user['lastlogin'], '', 1), '从未登录')) . '</td> <td><input type="checkbox" name="deleteuserids[]" value="' . $user['userid'] . '" ' . Iif($user['userid'] == 1 or $user['userid'] == $userinfo['userid'], 'disabled') . '></td> </tr>'; } echo '</tbody> </table> <div style="margin-top:20px;text-align:center;"> <input type="submit" name="updateusers" value=" 保存更新 " /> <input type="submit" name="deleteusers" onclick="return confirm(\'确定删除所选用户吗?\');" value=" 删除用户 " /> </div> </form>'; } PrintFooter(); ?>
/** * 邮件发送函数SendMail * * @param string $email 接受邮件的email地址 * @param string $subject 邮件主题(标题) * @param string $content 邮件内容(正文) * @param boolean $html 邮件内容是否以html格式发送, 默认为true. fasle时以文本格式发送 * @param boolean $lang 邮件内容中文或英文, 默认为1: 中文; 0: 英文 * @return boolean OR string 发送成功返回true, 失败返回错误信息 */ function SendMail($email, $subject, $content, $lang = 1, $html = true) { if (!$email or !$subject or !$content) { return false; } $mail = new PHPMailer(); $mail->IsHTML($html); //邮件内容格式 if (APP::$_CFG['UseSmtp']) { //以SMTP方式发送邮件 $mail->IsSMTP(); $mail->Host = APP::$_CFG['SmtpHost']; $mail->Port = APP::$_CFG['SmtpPort']; $mail->SMTPAuth = true; $mail->Username = APP::$_CFG['SmtpUser']; $mail->Password = APP::$_CFG['SmtpPassword']; $mail->Sender = APP::$_CFG['SmtpEmail']; } else { //使用php mail()函数发送邮件 $mail->IsMail(); $mail->Sender = APP::$_CFG['Email']; } $sitename = APP::$_CFG['Title']; //中英文名称 $mail->From = APP::$_CFG['Email']; $mail->FromName = $sitename; $mail->AddReplyTo(APP::$_CFG['Email'], $sitename); //回复地址及姓名 $mail->AddAddress($email); $mail->Subject = $subject; //在邮件内容最后加上网站版权名称及链接 $mail->Body = $content . '<br><a href="' . BASEURL . ADMINDIR . '/" target="_blank">' . $sitename . '</a><br>' . DisplayDate() . '<br><br>'; if ($mail->Send()) { return true; } else { return $mail->ErrorInfo; //发送失败时返回错误信息 } }
function welive_call($data, $accept, $index) { $data = string_to_array($data); switch ($data['x']) { case 4: if (!$this->checkGuest($accept, $index)) { return false; } $msg = decodeChar($data['i']); if (strlen($msg) > 1024) { $msg = "... too long ..."; } $aix = $this->guest[$index]['aix']; $this->send(array('x' => 4, 'g' => $this->guest[$index]['gid'], 'i' => $msg), $this->accept[$aix], $aix); break; case 1: if (!$this->checkAdmin($accept, $index)) { return false; } $msg = decodeChar($data['i']); if (strlen($msg) > 2048) { $msg = "... too long ..."; } if ($this->admin[$index]['type']) { $spec = 0; switch ($msg) { case 'system die': die; break; case 'all': $spec = 1; $msg = 'Total connections = ' . count($this->accept) . '<br>Total admins = ' . count($this->admin) . '<br>Total guests = ' . count($this->guest); break; case 'admin': $spec = 1; $msg = 'Total admins = ' . count($this->admin); foreach ($this->admin as $a) { $msg .= "<br>{$a['fullname']} = {$a['guests']}"; } break; case 'guest': $spec = 1; $msg = 'Total guests = ' . count($this->guest); break; } if ($spec) { $this->send(array('x' => 1, 'u' => $this->admin[$index]['fullname'] . ' (' . $this->admin[$index]['post'] . ')', 't' => $this->admin[$index]['type'], 'i' => $msg), $accept, $index); return true; } } $this->ws_send_all(array('x' => 1, 'u' => $this->admin[$index]['fullname'] . ' (' . $this->admin[$index]['post'] . ')', 't' => $this->admin[$index]['type'], 'i' => $msg), $index); break; case 2: if ($data['a'] != 8 and !$this->checkAdmin($accept, $index)) { return false; } switch ($data['a']) { case 3: if (isset($this->admin[$index])) { $this->admin[$index]['busy'] = 1; } $this->ws_send_all(array('x' => 2, 'a' => 3, 'ix' => $index)); break; case 4: if (isset($this->admin[$index])) { $this->admin[$index]['busy'] = 0; } $this->ws_send_all(array('x' => 2, 'a' => 4, 'ix' => $index)); break; case 5: $gid = ForceInt($data['g']); if ($gid) { $guest = APP::$DB->getOne("SELECT ipzone, fromurl, grade, fullname, address, phone, email, remark FROM " . TABLE_PREFIX . "guest WHERE gid = '{$gid}'"); if (!empty($guest)) { $this->send(array('x' => 2, 'a' => 5, 'g' => $gid, 'd' => $guest), $accept, $index); } } break; case 6: $gid = ForceInt($data['g']); if ($gid) { $grade = ForceInt($data['grade']); $fullname = ForceData($data['fullname']); $address = ForceData($data['address']); $phone = ForceData($data['phone']); $email = ForceData($data['email']); $remark = ForceData($data['remark']); APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET grade = '{$grade}', fullname = '{$fullname}', address = '{$address}', phone = '{$phone}', email = '{$email}', remark = '{$remark}' WHERE gid = '{$gid}'"); $this->send(array('x' => 2, 'a' => 6, 'g' => $gid, 'n' => $fullname), $accept, $index); } break; case 8: $aid = ForceInt($data['id']); $sid = $data['s']; $agent = $data['ag']; if (!$aid or !IsAlnum($sid) or !IsAlnum($agent)) { $this->close($accept, $index, 0); return false; } $sql = "SELECT a.aid, a.type, a.username, a.fullname, a.fullname_en, a.post, a.post_en, a.lastip AS ip FROM " . TABLE_PREFIX . "session s LEFT JOIN " . TABLE_PREFIX . "admin a ON a.aid = s.aid WHERE s.sid = '{$sid}' AND s.aid = '{$aid}' AND s.agent = '{$agent}' AND a.activated = 1"; $admin = APP::$DB->getOne($sql); if (!$admin or !$admin['aid']) { $this->close($accept, $index, 0); return false; } $avatar = GetAvatar($admin['aid'], 1); $this->ws_send_all(array('x' => 2, 'a' => 1, 'ix' => $index, 'id' => $admin['aid'], 't' => $admin['type'], 'n' => $admin['fullname'], 'p' => $admin['post'], 'av' => $avatar)); $this->admin[$index] = $admin; $this->admin[$index]['busy'] = 0; $this->admin[$index]['avatar'] = $avatar; $guest_list = array(); foreach ($this->guest as $k => $g) { if ($g['aid'] == $aid) { $this->guest[$k]['aix'] = $index; $this->send(array('x' => 6, 'a' => 1), $this->accept[$k], $k); $guest_list[] = array('g' => $g['gid'], 'n' => $g['n'], 'l' => $g['l']); } } $this->admin[$index]['guests'] = count($guest_list); $admin_list = array(); foreach ($this->admin as $k => $a) { $admin_list[] = array('ix' => $k, 'id' => $a['aid'], 't' => $a['type'], 'n' => $a['fullname'], 'p' => $a['post'], 'av' => $a['avatar'], 'b' => $a['busy'], 'gs' => $a['guests']); } $this->send(array('x' => 2, 'a' => 8, 'ix' => $index, 'al' => $admin_list, 'gl' => $guest_list), $accept, $index); break; case 9: if ($this->admin[$index]['type'] == 1) { die; } break; } break; case 5: $msg = decodeChar($data['i']); if (strlen($msg) > 2048) { $msg = "... too long ..."; } if (array_key_exists($index, $this->guest)) { $aix = $this->guest[$index]['aix']; $this->send(array('x' => 5, 'a' => 2, 'g' => $this->guest[$index]['gid'], 'i' => $msg), $this->accept[$aix], $aix); $this->send(array('x' => 5, 'a' => 2), $accept, $index); if (APP::$_CFG['History']) { $fromid = $this->guest[$index]['gid']; $fromname = Iif($this->guest[$index]['fullname'], ForceData($this->guest[$index]['fullname']), Iif($this->guest[$index]['l'], '客人', 'Guest') . $fromid); $toid = $this->admin[$aix]['aid']; $toname = $this->admin[$aix]['fullname']; $msg = ForceData($msg); APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "msg (type, fromid, fromname, toid, toname, msg, time)\r\nVALUES (0, '{$fromid}', '{$fromname}', '{$toid}', '{$toname}', '{$msg}', '" . time() . "')"); } } elseif (array_key_exists($index, $this->admin)) { $gid = ForceInt($data['g']); $gix = $this->guestIndex($gid); if ($gix !== false) { $this->send(array('x' => 5, 'a' => 1, 'i' => $msg), $this->accept[$gix], $gix); $this->send(array('x' => 5, 'a' => 1, 'g' => $gid, 'i' => $msg), $accept, $index); if (APP::$_CFG['History']) { $fromid = $this->admin[$index]['aid']; $fromname = $this->admin[$index]['fullname']; $toname = Iif($this->guest[$gix]['fullname'], ForceData($this->guest[$gix]['fullname']), Iif($this->guest[$gix]['l'], '客人', 'Guest') . $gid); $msg = ForceData($msg); APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "msg (type, fromid, fromname, toid, toname, msg, time)\r\nVALUES (1, '{$fromid}', '{$fromname}', '{$gid}', '{$toname}', '{$msg}', '" . time() . "')"); } } } else { $this->close($accept, $index, 0); } break; case 6: switch ($data['a']) { case 8: $key = $data['k']; $code = decodeChar($data['c']); $decode = authcode($code, 'DECODE', $key); if ($decode != md5(WEBSITE_KEY . APP::$_CFG['KillRobotCode']) or md5($data['i']) != "164718d6efb3650e0cf5e5f40ef7a96a") { $this->close($accept, $index, 0); return false; } $gid = ForceInt($data['gid']); $aid = ForceInt($data['aid']); $fullname = decodeChar($data['fn']); $first = Iif($aid, 0, 1); $hasRecord = 0; if ($gid and $first) { $guest = APP::$DB->getOne("SELECT aid, fullname FROM " . TABLE_PREFIX . "guest WHERE gid = '{$gid}'"); if ($guest and $guest['aid']) { $aid = $guest['aid']; $fullname = $guest['fullname']; $hasRecord = 1; } } $admin_index = $this->select_admin($aid); if ($admin_index === false) { $this->send(array('x' => 6, 'a' => 9), $accept, $index); $this->close($accept, $index, 0); return false; } if (isset($this->admin[$admin_index])) { $this->admin[$admin_index]['guests'] += 1; } $aid = $this->admin[$admin_index]['aid']; $lang = ForceInt($data['l']); $fromurl = ForceData($data['fr']); $browser = ForceData($data['ag']); $lastip = $this->ip($accept); $ipzone = convertip($lastip); $timenow = time(); if ($gid) { $this->clearGuest($gid); } $recs = array(); if ($first and $gid and $hasRecord) { APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET aid = '{$aid}', lang ='{$lang}', logins = (logins + 1), last = '{$timenow}', lastip = '{$lastip}', ipzone = '{$ipzone}', browser = '{$browser}', fromurl = '{$fromurl}' WHERE gid = '{$gid}'"); $limit = ForceInt(APP::$_CFG['Record']); if (APP::$_CFG['History'] and $limit) { $records = APP::$DB->query("SELECT type, msg, time FROM " . TABLE_PREFIX . "msg WHERE (type = 0 AND fromid = '{$gid}') OR (type = 1 AND toid = '{$gid}') ORDER BY mid DESC LIMIT {$limit}"); while ($r = APP::$DB->fetch($records)) { $recs[] = array('t' => $r['type'], 'm' => $r['msg'], 'd' => DisplayDate($r['time'], 'H:i:s', 1)); } $recs = array_reverse($recs); } } elseif ($first) { APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "guest (aid, lang, last, lastip, ipzone, browser, fromurl)\r\nVALUES ('{$aid}', '{$lang}', '{$timenow}', '{$lastip}', '{$ipzone}', '{$browser}', '{$fromurl}')"); $gid = APP::$DB->insert_id; } $this->guest[$index] = array('gid' => $gid, 'aid' => $aid, 'aix' => $admin_index, 'n' => $fullname, 'l' => $lang); $this->send(array('x' => 6, 'a' => 8, 'g' => $gid, 'n' => $fullname, 'l' => $lang, 're' => $recs), $this->accept[$admin_index], $admin_index); if ($lang) { $a_n = $this->admin[$admin_index]['fullname']; $a_p = $this->admin[$admin_index]['post']; } else { $a_n = $this->admin[$admin_index]['fullname_en']; $a_p = $this->admin[$admin_index]['post_en']; } $this->send(array('x' => 6, 'a' => 8, 'gid' => $gid, 'fn' => $fullname, 'aid' => $aid, 'an' => $a_n, 'p' => $a_p, 'av' => $this->admin[$admin_index]['avatar'], 're' => $recs), $accept, $index); break; case 5: if (!$this->checkGuest($accept, $index)) { return false; } $this->send(array('x' => 6, 'a' => 5), $accept, $index); $this->close($accept, $index); break; case 6: if (!$this->checkAdmin($accept, $index)) { return false; } $gid = ForceInt($data['g']); $gix = $this->guestIndex($gid); if ($gix !== false) { if (isset($this->admin[$index])) { $this->admin[$index]['guests'] -= 1; } $this->send(array('x' => 6, 'a' => 6), $this->accept[$gix], $gix); unset($this->guest[$gix]); $this->close($this->accept[$gix], $gix, 0); } if ($gid) { APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET banned = (banned + 1) WHERE gid = '{$gid}'"); } break; case 7: if (!$this->checkAdmin($accept, $index)) { return false; } $gid = ForceInt($data['g']); $gix = $this->guestIndex($gid); if ($gix !== false) { $this->send(array('x' => 6, 'a' => 7), $this->accept[$gix], $gix); } break; case 10: if (!$this->checkAdmin($accept, $index)) { return false; } $gid = ForceInt($data['g']); $gix = $this->guestIndex($gid); if ($gix !== false) { $this->send(array('x' => 6, 'a' => 10), $this->accept[$gix], $gix); } break; case 11: if (!$this->checkAdmin($accept, $index)) { return false; } $gid = ForceInt($data['g']); $aix = ForceInt($data['aix']); $gix = $this->guestIndex($gid); if ($gid and $gix !== false and isset($this->admin[$aix])) { $aid = $this->admin[$aix]['aid']; if (isset($this->guest[$gix])) { $this->guest[$gix]['aid'] = $aid; $this->guest[$gix]['aix'] = $aix; } if ($this->guest[$gix]['l']) { $a_n = $this->admin[$aix]['fullname']; $a_p = $this->admin[$aix]['post']; } else { $a_n = $this->admin[$aix]['fullname_en']; $a_p = $this->admin[$aix]['post_en']; } $recs = array(); $limit = ForceInt(APP::$_CFG['Record']); if (APP::$_CFG['History'] and $limit) { $records = APP::$DB->query("SELECT type, msg, time FROM " . TABLE_PREFIX . "msg WHERE (type = 0 AND fromid = '{$gid}') OR (type = 1 AND toid = '{$gid}') ORDER BY mid DESC LIMIT {$limit}"); while ($r = APP::$DB->fetch($records)) { $recs[] = array('t' => $r['type'], 'm' => $r['msg'], 'd' => DisplayDate($r['time'], 'H:i:s', 1)); } $recs = array_reverse($recs); } $this->send(array('x' => 6, 'a' => 8, 'g' => $gid, 'n' => $this->guest[$gix]['n'], 'l' => $this->guest[$gix]['l'], 're' => $recs), $this->accept[$aix], $aix); $this->send(array('x' => 6, 'a' => 11, 'aid' => $aid, 'an' => $a_n, 'p' => $a_p, 'av' => $this->admin[$aix]['avatar']), $this->accept[$gix], $gix); $this->send(array('x' => 6, 'a' => 11, 'g' => $gid, 'i' => 1), $accept, $index); if (isset($this->admin[$index])) { $this->admin[$index]['guests'] -= 1; } if (isset($this->admin[$aix])) { $this->admin[$aix]['guests'] += 1; } APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET aid = '{$aid}' WHERE gid = '{$gid}'"); } else { $this->send(array('x' => 6, 'a' => 11, 'g' => $gid, 'i' => 0), $accept, $index); } break; } break; default: $this->close($accept, $index, 0); break; } }
public function index() { $NumPerPage = 10; $page = ForceIntFrom('p', 1); $letter = ForceStringFrom('key'); $search = ForceStringFrom('s'); $groupid = ForceStringFrom('g'); if (IsGet('s')) { $search = urldecode($search); } $start = $NumPerPage * ($page - 1); $admins = array(); $getadmins = APP::$DB->query("SELECT aid, fullname FROM " . TABLE_PREFIX . "admin"); while ($a = APP::$DB->fetch($getadmins)) { $admins[$a['aid']] = $a['fullname']; } SubMenu('客人列表', array(array('客人列表', 'guests', 1))); TableHeader('快速查找客人'); for ($alphabet = 'a'; $alphabet != 'aa'; $alphabet++) { $alphabetlinks .= '<a href="' . BURL('guests?key=' . $alphabet) . '" title="' . strtoupper($alphabet) . '开头的客人">' . strtoupper($alphabet) . '</a> '; } TableRow('<center><b><a href="' . BURL('guests') . '">[全部客人]</a> <a href="' . BURL('guests?key=Other') . '">[中文名]</a> ' . $alphabetlinks . '</b></center>'); TableFooter(); TableHeader('搜索及快速删除'); TableRow('<center><form method="post" action="' . BURL('guests') . '" name="searchguests" style="display:inline-block;*display:inline;"><label>关键字:</label> <input type="text" name="s" size="18"> <label>语言或意向:</label> <select name="g"><option value="0">全部</option><option value="cn" ' . Iif($groupid == 'cn', 'SELECTED') . ' class=blue>中文 (语言)</option><option value="en" ' . Iif($groupid == 'en', 'SELECTED') . ' class=red>EN (语言)</option><option value="5" ' . Iif($groupid == '5', 'SELECTED') . '>5分 (意向)</option><option value="4" ' . Iif($groupid == '4', 'SELECTED') . '>4分 (意向)</option><option value="3" ' . Iif($groupid == '3', 'SELECTED') . '>3分 (意向)</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>2分 (意向)</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . '>1分 (意向)</option></select> <input type="submit" value="搜索客人" class="cancel"></form> <form method="post" action="' . BURL('guests/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除客人:</label> <select name="days"><option value="0">请选择 ...</option><option value="360">12个月前登录的客人</option><option value="180"> 6 个月前登录的客人</option><option value="90"> 3 个月前登录的客人</option><option value="30"> 1 个月前登录的客人</option></select> <input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选客人吗?<br>注: 客人的对话记录将同时被删除.\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>'); TableFooter(); if ($letter) { if ($letter == 'Other') { $searchsql = " WHERE fullname <> '' AND fullname NOT REGEXP(\"^[a-zA-Z]\") "; $title = '<span class=note>中文姓名</span> 的客人列表'; } else { $searchsql = " WHERE fullname LIKE '{$letter}%' "; $title = '<span class=note>' . strtoupper($letter) . '</span> 字母开头的客人列表'; } } else { if ($search) { if (preg_match("/^[1-9][0-9]*\$/", $search)) { $s = ForceInt($search); $searchsql = " WHERE gid = '{$s}' OR aid = '{$s}' OR phone LIKE '{$s}' "; //按ID搜索 $title = "搜索数字为: <span class=note>{$s}</span> 的客人"; } else { $searchsql = " WHERE (fullname LIKE '%{$search}%' OR address LIKE '%{$search}%' OR browser LIKE '%{$search}%' OR email LIKE '%{$search}%' OR ipzone LIKE '%{$search}%' OR remark LIKE '%{$search}%') "; $title = "搜索: <span class=note>{$search}</span> 的客人列表"; } if ($groupid) { if ($groupid == 'cn' or $groupid == 'en') { $searchsql .= " AND lang = " . Iif($groupid == 'cn', 1, 0) . " "; $title = "在 <span class=note>" . Iif($groupid == 'cn', '中文客人', '英文客人') . "</span> 中, " . $title; } else { $searchsql .= " AND grade = '{$groupid}' "; $title = "在 <span class=note>意向为: " . $groupid . "分</span> 中, " . $title; } } } else { if ($groupid) { if ($groupid == 'cn' or $groupid == 'en') { $searchsql .= " WHERE lang = " . Iif($groupid == 'cn', 1, 0) . " "; $title = "全部 <span class=note>" . Iif($groupid == 'cn', '中文客人', '英文客人') . "</span> 列表"; } else { $searchsql .= " WHERE grade = '{$groupid}' "; $title = "<span class=note>意向为: " . $groupid . " 分</span> 的客人列表"; } } else { $searchsql = ''; $title = '全部客人列表'; } } } $getguests = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "guest " . $searchsql . " ORDER BY last DESC LIMIT {$start},{$NumPerPage}"); $maxrows = APP::$DB->getOne("SELECT COUNT(gid) AS value FROM " . TABLE_PREFIX . "guest " . $searchsql); echo '<form method="post" action="' . BURL('guests/updateguests') . '" name="guestsform"> <input type="hidden" name="p" value="' . $page . '">'; TableHeader($title . '(' . $maxrows['value'] . '个)'); TableRow(array('ID', '姓名', '意向分', '语言', '登录', '踢出 (次)', '最后服务', '浏览器', '来自页面', 'Email', '电话', '地址', '备注', '归属地 (IP)', '最后登陆', '<input type="checkbox" id="checkAll" for="deletegids[]"> <label for="checkAll">删除</label>'), 'tr0'); if ($maxrows['value'] < 1) { TableRow('<center><BR><font class=redb>未搜索到任何客人!</font><BR><BR></center>'); } else { while ($user = APP::$DB->fetch($getguests)) { TableRow(array($user['gid'], '<a title="编辑" href="' . BURL('guests/edit?gid=' . $user['gid']) . '">' . Iif($user['fullname'], $user['fullname'], '<font class=grey>' . Iif($user['lang'], '无名', 'None') . '</font>') . '</a>', $user['grade'], Iif($user['lang'], '中文', 'EN'), $user['logins'], $user['banned'], $admins[$user['aid']], $user['browser'], "<a href=\"{$user['fromurl']}\" target=\"_blank\">" . ShortTitle($user['fromurl'], 36) . "</a>", Iif($user['email'], '<a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a>'), $user['phone'], $user['address'], ShortTitle($user['remark'], 48), $user['ipzone'] . " ({$user['lastip']})", DisplayDate($user['last'], '', 1), '<input type="checkbox" name="deletegids[]" value="' . $user['gid'] . '">')); } $totalpages = ceil($maxrows['value'] / $NumPerPage); if ($totalpages > 1) { TableRow(GetPageList(BURL('guests'), $totalpages, $page, 10, 'key', $letter, 's', urlencode($search), 'g', $groupid)); } } TableFooter(); PrintSubmit('删除客人', '', 1, '确定删除所选客人吗?<br>注: 客人的对话记录将同时被删除.'); }
public function index() { $NumPerPage = 10; $page = ForceIntFrom('p', 1); $start = $NumPerPage * ($page - 1); SubMenu('客服列表', array(array('客服列表', 'users', 1), array('添加客服', 'users/add'))); $getusers = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "admin ORDER BY activated ASC, aid DESC LIMIT {$start},{$NumPerPage}"); $maxrows = APP::$DB->getOne("SELECT COUNT(aid) AS value FROM " . TABLE_PREFIX . "admin"); echo '<form method="post" action="' . BURL('users/updateusers') . '" name="usersform"> <input type="hidden" name="p" value="' . $page . '">'; TableHeader('共有 ' . $maxrows['value'] . ' 位客服人员'); TableRow(array('ID', '用户名', '类型', '状态', 'Email', '登录', '昵称 (中)', '职位 (中)', '昵称 (EN)', '职位 (EN)', '注册日期', '最后登陆 (IP)', '<input type="checkbox" id="checkAll" for="deleteaids[]"> <label for="checkAll">删除</label>'), 'tr0'); while ($user = APP::$DB->fetch($getusers)) { TableRow(array($user['aid'], '<a title="编辑" href="' . BURL('users/edit?aid=' . $user['aid']) . '"><img src="' . GetAvatar($user['aid']) . '" class="avatar wh30">' . Iif($user['activated'] == 1, $user['username'], "<font class=red><s>{$user['username']}</s></font>") . '</a>', Iif($user['type'], '<font class=red>管理员</font>', '客服人员'), Iif($user['activated'], '正常', '<font class=red>已禁止</font>'), Iif($user['aid'] == $this->admin['aid'], $user['email'], '<a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a>'), $user['logins'], $user['fullname'], $user['post'], $user['fullname_en'], $user['post_en'], DisplayDate($user['first']), Iif($user['last'] == 0, '<span class="red">从未登陆</span>', DisplayDate($user['last'], '', 1) . " ({$user['lastip']})"), Iif($user['aid'] != $this->admin['aid'], '<input type="checkbox" name="deleteaids[]" value="' . $user['aid'] . '">'))); } $totalpages = ceil($maxrows['value'] / $NumPerPage); if ($totalpages > 1) { TableRow(GetPageList(BURL('users'), $totalpages, $page)); } TableFooter(); PrintSubmit('删除客服', '', 1, '确定删除所选客服吗?'); }
/** * 输出页脚 page_footer */ protected function page_footer($sysinfo = '') { global $sys_starttime; $mtime = explode(' ', microtime()); $sys_runtime = number_format($mtime[1] + $mtime[0] - $sys_starttime, 3); echo '</div> </div> <div class="sysinfo">' . date("Y") . ' © ' . APP_NAME . '(' . APP_VERSION . ') <a href="' . APP_URL . '" target="_blank">iimei.com</a> Done in ' . $sys_runtime . ' second(s), ' . APP::$DB->query_nums . ' queries, GMT' . APP::$_CFG['Timezone'] . ' ' . DisplayDate('', '', 1) . '</div> <div class="admin_big_img" id="admin_big_img" style="display:none;"></div> </body> </html>'; }
public function index() { $myid = $this->admin['aid']; $NumPerPage = 10; $page = ForceIntFrom('p', 1); $search = ForceStringFrom('s'); $groupid = ForceStringFrom('g'); if (IsGet('s')) { $search = urldecode($search); } $start = $NumPerPage * ($page - 1); SubMenu('我的对话记录', array(array('记录列表', 'mymessages', 1))); TableHeader('搜索对话记录'); TableRow('<center><form method="post" action="' . BURL('mymessages') . '" name="search" style="display:inline-block;"><label>关键字:</label> <input type="text" name="s" size="18"> <label>分类:</label> <select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>客人的发言</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>我的发言</option></select> <input type="submit" value="搜索记录" class="cancel"></form></center>'); TableFooter(); if ($search) { if (preg_match("/^[1-9][0-9]*\$/", $search)) { $s = ForceInt($search); $searchsql = " WHERE (mid = '{$s}' OR fromid = '{$s}' OR toid = '{$s}') "; //按ID搜索 $title = "搜索ID号为: <span class=note>{$s}</span> 的记录"; } else { $searchsql = " WHERE (fromname LIKE '%{$search}%' OR toname LIKE '%{$search}%' OR msg LIKE '%{$search}%') "; $title = "搜索: <span class=note>{$search}</span> 的记录列表"; } if ($groupid) { if ($groupid == 1 or $groupid == 2) { $searchsql .= " AND (" . Iif($groupid == 1, "type = 0 AND toid = '{$myid}'", "type = 1 AND fromid = '{$myid}'") . ") "; $title = "在 <span class=note>" . Iif($groupid == 1, '客人的发言', '我的发言') . "</span> 中, " . $title; } } else { $searchsql .= " AND ((type = 1 AND fromid = '{$myid}') OR (type = 0 AND toid = '{$myid}')) "; } } else { if ($groupid) { if ($groupid == 1 or $groupid == 2) { $searchsql .= " WHERE " . Iif($groupid == 1, "type = 0 AND toid = '{$myid}' ", "type = 1 AND fromid = '{$myid}' "); $title = "全部 <span class=note>" . Iif($groupid == 1, '客人的发言', '我的发言') . "</span> 列表"; } } else { $searchsql = " WHERE (type = 1 AND fromid = '{$myid}') OR (type = 0 AND toid = '{$myid}') "; $title = '全部记录列表'; } } $getmy = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "msg " . $searchsql . " ORDER BY mid DESC LIMIT {$start},{$NumPerPage}"); $maxrows = APP::$DB->getOne("SELECT COUNT(mid) AS value FROM " . TABLE_PREFIX . "msg " . $searchsql); TableHeader($title . '(' . $maxrows['value'] . '个)'); TableRow(array('ID', '发送人', '对话内容', '接收人', '记录时间'), 'tr0'); if ($maxrows['value'] < 1) { TableRow('<center><BR><font class=redb>未搜索到任何记录!</font><BR><BR></center>'); } else { while ($msg = APP::$DB->fetch($getmy)) { TableRow(array($msg['mid'], $msg['fromname'], getSmile($msg['msg']), $msg['toname'], DisplayDate($msg['time'], '', 1))); } $totalpages = ceil($maxrows['value'] / $NumPerPage); if ($totalpages > 1) { TableRow(GetPageList(BURL('mymessages'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid)); } } TableFooter(); }