function dotest($args) { $n = 1; $doing = 'create'; $funcname = "test_" . $doing; $start = gettimeofday(); $this->{$funcname}($args); $end = gettimeofday(); $tm = timediff($start, $end); $speed = $n / $tm * 1000000; echo "use time: {$tm}, speed:{$speed}\n"; }
function getLeftTime($timeend, $type = 1) { if ($type == 1) { $timeend = strtotime(date("Y-m-d", $timeend) . " 23:59:59"); $timenow = strtotime(date("Y-m-d", time()) . " 23:59:59"); $left = ceil(($timeend - $timenow) / 3600 / 24); } else { $left_arr = timediff(time(), $timeend); $left = $left_arr['day'] . "天 " . $left_arr['hour'] . "小时 " . $left_arr['min'] . "分钟 " . $left_arr['sec'] . "秒"; } return $left; }
continue; } if ($key == 'When') { $key = "Time"; $str = date('Y/m/d H:i:s', $str); } if ($key == 'Last getwork') { //$key="Time"; $str = date('Y/m/d H:i:s', $str); } if ($key == 'Pool Rejected%') { //$key="Time"; $str = number_format($str, 2); } if ($key == 'Elapsed') { $str = timediff($str); } if ($key == 'MHS av' || $key == 'MHS 5s' || $key == 'MHS 1m' || $key == 'MHS 5m' || $key == 'MHS 15m') { //$key="Time"; $key = str_replace("MHS", "GHS", $key); $str = floor($str * 0.001); $str .= " GHS"; } ?> <td><?php echo $str;
$db = new DB("peers"); $db->setColPrefix("peer_"); $db->select("peer_torrent = '" . $db->escape($tid) . "' AND peer_seeder = '1'"); $no_peers = true; if ($db->numRows()) { echo "<h4>" . _t("Seeders") . "</h4>"; echo "\n <table width='100%' class='forum' cellspacing='0' cellpadding='5'>\n <thead>\n <tr>\n <td class='border-bottom border-right' width='200px'>Seeder</td>\n <td class='border-bottom border-right'>Downloaded</td>\n <td class='border-bottom border-right'>Uploaded</td>\n <td class='border-bottom border-right' align='center'>Seeded for</td>\n </tr>\n </thead>\n <tbody>\n "; while ($db->nextRecord()) { $user = new Acl($db->userid); echo "\n <tr>\n <td class='border-bottom border-right'>" . (!$user->anonymous || $acl->Access("x") ? "<a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a>" : "Anonymous") . "</td>\n <td class='border-bottom border-right'>" . bytes($db->downloaded) . "</td>\n <td class='border-bottom border-right'>" . bytes($db->uploaded) . "</td>\n <td class='border-bottom border-right' align='center'>" . timediff($db->started, time()) . "</td>\n </tr>"; } echo "</tbody></table>"; $no_peers = false; } $db->select("peer_torrent = '" . $db->escape($tid) . "' AND peer_seeder = '0'"); if ($db->numRows()) { echo "<h4>" . _t("Leechers") . "</h4>"; echo "\n <table width='100%' class='forum' cellspacing='0' cellpadding='5'>\n <thead>\n <tr>\n <td class='border-bottom border-right' width='200px'>Leecher</td>\n <td class='border-bottom border-right'>Downloaded</td>\n <td class='border-bottom border-right'>Uploaded</td>\n <td class='border-bottom border-right' align='center'>Leeching for</td>\n </tr>\n </thead>\n <tbody>\n "; while ($db->nextRecord()) { $user = new Acl($db->userid); echo "\n <tr>\n <td class='border-bottom border-right'>" . (!$user->anonymous || $acl->Access("x") ? "<a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a>" : "Anonymous") . "</td>\n <td class='border-bottom border-right'>" . bytes($db->downloaded) . "</td>\n <td class='border-bottom border-right'>" . bytes($db->uploaded) . "</td>\n <td class='border-bottom border-right' align='center'>" . timediff($db->started, time()) . "</td>\n </tr>"; } echo "</tbody></table>"; $no_peers = false; } if ($no_peers) { echo notice(_t("No Peers found")); } } catch (Exception $e) { echo error(_t($e->getMessage())); }
$OnlineStatus = "N"; $ChatCount = 0; $UserInfo = ""; $TimeOnline = ""; $CurLocation = ""; while ($visitor = $visitors->fetchRow(DB_FETCHMODE_ASSOC)) { if ($visitor['isoperator'] == "N") { if ($visitor['status'] == "chat") { $ChatCount++; } $TrackQuery = "SELECT * FROM livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "'"; $Tracks = $mydatabase->query($TrackQuery); while ($tracking = $Tracks->fetchRow(DB_FETCHMODE_ASSOC)) { $CurLocation = $tracking['location']; $later = $tracking['whendone']; $TimeOnline = secondstoHHmmss(timediff($later, date("YmdHis"))); } $UserInfo = $visitor['user_id'] . "::" . $visitor['username'] . "::" . $visitor['ipaddress'] . "::" . $visitor['status'] . "::" . $visitor['camefrom'] . "::" . $TimeOnline . "::" . $CurLocation . ",," . $UserInfo; } if ($visitor['username'] == $_GET['username']) { $OnlineStatus = $visitor['isonline']; $MyUserID = $visitor['user_id']; } } // get the count of active visitors in the system right now. $timeof = date("YmdHis"); $prev = mktime(date("H"), date("i") - 4, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $sqlquery = "SELECT * FROM livehelp_users WHERE lastaction>'{$oldtime}' AND isoperator!='Y' "; // make list of ignored visitors: $MyOwnIP = $_SERVER['REMOTE_ADDR'];
if (!empty($dataset[1])) { $fieldid = str_replace("field_", "", $dataset[0]); $query = "SELECT * FROM livehelp_questions WHERE id=" . intval($fieldid); $questiondata = $mydatabase->query($query); $question_row = $questiondata->fetchRow(DB_FETCHMODE_ASSOC); print "<b> " . $question_row['headertext'] . ":</b> <br><font color=000000>" . urldecode($dataset[1]) . "</font><br>"; } } $now = date("YmdHis"); $thediff = $now - $user_info['lastaction']; print "<b>" . $lang['txt65'] . "</b> {$thediff} sec. <br>"; // time online: $query = "SELECT whendone from livehelp_visit_track WHERE sessionid='" . filter_sql($user_info['sessionid']) . "' Order by whendone LIMIT 1"; $page_trail = $mydatabase->query($query); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $later = $page['whendone']; print "<b>Time online:</b>" . secondstoHHmmss(timediff($later, date("YmdHis"))) . "<br>"; print "<b>" . $lang['txt66'] . "</b><br>"; $query = "SELECT * from livehelp_visit_track WHERE sessionid='" . filter_sql($user_info['sessionid']) . "' Order by whendone DESC"; $page_trail = $mydatabase->query($query); print "<table border=1><tr bgcolor=FFFFFF><td>" . $lang['txt67'] . "</td><td>url</td><td>" . $lang['date'] . "</td></tr>"; while ($page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC)) { $when = mktime(substr($page['whendone'], 8, 2), substr($page['whendone'], 10, 2), substr($page['whendone'], 12, 2), substr($page['whendone'], 4, 2), substr($page['whendone'], 6, 2), substr($page['whendone'], 0, 4)); print "<tr><td>" . $page['title'] . "</td><td><a href=" . $page['location'] . " target=_blank>" . $page['location'] . "</a></td><td>"; print date("F j, Y, g:i a", $when); print "</td></tr>"; } print "</table><br><center><a href=javascript:window.close()>" . $lang['txt40'] . "</a>"; if (!$serversession) { $mydatabase->close_connect(); }
function test_range_short($frompos, $dlen, $count) { //echo "====== test_range ======\n"; $key = "testmyhaha"; $starttm = gettimeofday(); for ($i = 0; $i < $count; $i++) { $m = new MemLinkClient('127.0.0.1', 11001, 11002, 30); $ret = $m->range($key, "", $frompos, $dlen); if (is_null($ret)) { echo "range error!\n"; return -1; } $m->destroy(); } $endtm = gettimeofday(); $speed = $count / (timediff($starttm, $endtm) / 1000000); echo "use time: " . timediff($starttm, $endtm) . " speed: {$speed}\n"; return $speed; }
function parseAndReplaceAll($text, $slotback = '') { global $directdump; $directdump = false; //[sql.s1.field1.type] //[var.name.type] //[para.name] $newstring = ""; $oldpos = 0; $pos = strpos($text, "[", $oldpos); $ifs = array(); $cif = 0; $ifs[$cif] = false; while ($pos !== false) { //search for close $pos2 = strpos($text, "]", $pos); if ($pos2 !== false) { if ($ifs[$cif]) { //ignore only for an [endif] [fi] $token = substr($text, $pos + 1, $pos2 - $pos - 1); $arr = explode(".", $token); if ($arr[0] == 'if' || $arr[0] == '!if' || $arr[0] == 'nif') { $cif++; $ifs[$cif] = true; } if ($arr[0] == "endif" || $arr[0] == "fi") { $ifs[$cif] = false; $cif--; } $oldpos = $pos2 + 1; } else { if ($directdump) { echo substr($text, $oldpos, $pos - $oldpos); } else { $newstring .= substr($text, $oldpos, $pos - $oldpos); } $oldpos = $pos; //we have a token.. anallys $token = substr($text, $pos + 1, $pos2 - $pos - 1); if (strlen($token)) { $displaytype = ""; $displaypara = ""; $displayvalue = ""; $arr = explode(".", $token); $iftest = false; $ifnegative = false; if (isset($arr[0]) && ($arr[0] == 'if' || $arr[0] == '!if' || $arr[0] == 'nif')) { $iftest = true; if ($arr[0] == '!if' || $arr[0] == 'nif') { $ifnegative = true; } $iftestvalue = ""; if (isset($arr[1])) { $iftestvalue = $arr[1]; } for ($i = 2; $i < count($arr); $i++) { $arr[$i - 2] = $arr[$i]; } if (count($arr)) { unset($arr[count($arr) - 1]); } if (count($arr)) { unset($arr[count($arr) - 1]); } } if (isset($arr[1]) || $token == "fi" || $token == "endif") { switch ($arr[0]) { case 'endif': case 'fi': $oldpos = $pos2 + 1; $ifs[$cif] = false; $cif--; break; case 'sql': //valid $oldpos = $pos2 + 1; if (isset($arr[3])) { $displaytype = $arr[3]; } if (isset($arr[4])) { $displaypara = $arr[4]; } //get value if (isset($arr[1]) && isset($GLOBALS[$arr[1] . '_sql_conn'])) { if (isset($arr[2])) { $displayvalue = $GLOBALS[$arr[1] . '_sql_conn']->getvalue($arr[2]); } if ($displaytype == "fast" && isset($arr[2])) { $displayvalue = $GLOBALS[$arr[1] . '_sql_conn']->getvaluefast($arr[2]); if (isset($arr[4])) { $displaytype = $arr[4]; } if (isset($arr[5])) { $displaypara = $arr[5]; } } if ($displaytype == "mins") { $displaypara = $GLOBALS[$arr[1] . '_sql_conn']->getvalue($arr[2] . "_panala"); require_once "config/dateutils.php"; $diff = timediff($displayvalue, $displaypara, getLT("dateformat")); $secs = intval(timediffsecs($diff) / 60); $displayvalue = $secs; $displaypara = $arr[5]; } } else { if ($arr[1] == "conn") { if (isset($arr[2])) { $displayvalue = $GLOBALS[$arr[1]]->getvalue($arr[2]); } if ($displaytype == "fast" && isset($arr[2])) { $displayvalue = $GLOBALS[$arr[1]]->getvaluefast($arr[2]); if (isset($arr[4])) { $displaytype = $arr[4]; } if (isset($arr[5])) { $displaypara = $arr[5]; } } if ($displaytype == "mins") { $displaypara = $GLOBALS[$arr[1]]->getvalue($arr[2] . "_panala"); require_once "config/dateutils.php"; $diff = timediff($displayvalue, $displaypara, getLT("dateformat")); $secs = intval(timediffsecs($diff) / 60); $displayvalue = $secs; $displaypara = $arr[5]; } } } break; case 'var': case 'g': //valid $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = $GLOBALS[$arr[1]]; } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } //get value break; case 'cache': $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = cache_getvalue($arr[1]); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } //get value break; case 'para': //valid $oldpos = $pos2 + 1; global $_control_replace_sql; if (isset($arr[1])) { $displayvalue = $_control_replace_sql('@' . $arr[1]); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'post': //valid $oldpos = $pos2 + 1; global $_POST; if (isset($arr[1]) && $_POST[$arr[1]] != "") { $displayvalue = '' . correctPostValue($_POST[$arr[1]]); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'posttags': //valid $oldpos = $pos2 + 1; global $_POST; if (isset($arr[1]) && $_POST[$arr[1]] != "") { $displayvalue = '' . correctPostValue(implode(",", $_POST[$arr[1]])); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'get': //valid $oldpos = $pos2 + 1; global $_GET; if (isset($arr[1]) && $_GET[$arr[1]] != "") { $displayvalue = '' . correctPostValue($_GET[$arr[1]]); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'config': case 'c': //valid $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = getUserConfig($arr[1]); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'cookie': $oldpos = $pos2 + 1; if (isset($arr[1]) && isset($arr[2])) { $displayvalue = cookie_getvalue($arr[1], $arr[2]); } if (isset($arr[3])) { $displaytype = $arr[3]; } if (isset($arr[4])) { $displaypara = $arr[4]; } break; case 'session': case 's': //valid $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = session_getvalue($arr[1]); } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'utils': //valid $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = $arr[1]; } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } break; case 'slot': //we have a callback $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = $arr[1]; } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } if ($slotback != '') { $displayvalue = $slotback($displayvalue, $displaytype, $displaypara); $displaytype = ''; $displaypara = ''; } break; case 'call': //we have a callback $oldpos = $pos2 + 1; if (isset($arr[1])) { $displayvalue = $arr[1]; } if (isset($arr[2])) { $displaytype = $arr[2]; } if (isset($arr[3])) { $displaypara = $arr[3]; } $fn = $displayvalue; if (function_exists($fn)) { $displayvalue = $fn($displaytype, $displaypara); } else { $displayvalue = ''; } break; } } $displaypara = str_replace('^', '.', $displaypara); if ($iftest) { //we have an ok $cif++; $iftestvalue = str_replace('^', '.', $iftestvalue); if ($ifnegative) { if ($displayvalue != $iftestvalue) { $ifs[$cif] = false; } else { $ifs[$cif] = true; } } else { if ($displayvalue == $iftestvalue) { $ifs[$cif] = false; } else { $ifs[$cif] = true; } } } else { $oldnewstring = $newstring; if ($directdump) { $newstring = ''; } switch ($displaytype) { case 'lb': $newstring .= '['; break; case 'rb': $newstring .= ']'; break; case 'now': require_once "config/dateutils.php"; if ($displayvalue != "") { $newstring .= date($displayvalue); } else { $newstring .= showDate(date("Y-m-d"), getLT("dateformat")); } break; case 'date': require_once "config/dateutils.php"; if ($displaypara != "") { if ($displayvalue != "0000-00-00") { $newstring .= date(str_replace("~", ".", $displaypara), showDate($displayvalue, "time")); } } else { $newstring .= showDate($displayvalue, getLT("dateformat")); } break; case 'sqldate': require_once "config/dateutils.php"; $newstring .= getDateForMysql($displayvalue, getLT("dateformat")); break; case 'time': require_once "config/dateutils.php"; $newstring .= showTime($displayvalue); break; case 'intval': if ($displaypara != "") { $newstring .= bcadd($displayvalue, '0'); } else { $newstring .= intval($displayvalue); } break; case 'number': $newstring .= showNumber($displayvalue, $displaypara); break; case 'exnumber': $newstring .= number_format(floatval($displayvalue), $displaypara, '.', ''); break; case 'zeronumber': if (abs(round($displayvalue) - $displayvalue) <= 0.01) { $newstring .= showNumber(round($displayvalue), $displaypara); } else { $newstring .= showNumber($displayvalue, $displaypara); } break; case 'zeros': $newstring .= str_pad($displayvalue, $displaypara, "0", STR_PAD_LEFT); break; case 'spell': require_once "extern/numberspell.php"; if (isset($GLOBALS[$displaypara])) { $newstring .= spellNumber($displayvalue, $GLOBALS[$displaypara]); } else { $newstring .= spellNumber($displayvalue, getCurrentLang()); } break; case 'sqlescape': global $conn; if ($displaypara != "") { $newstring .= $conn->escape(substr($displayvalue, 0, intval($displaypara))); } else { $newstring .= $conn->escape($displayvalue); } break; case 'sqlvalues': global $conn; $myvalues = ''; $myarr = explode(",", $displayvalue); foreach ($myarr as $kkmk => $kkmv) { if ($myvalues != "") { $myvalues .= ","; } $myvalues .= "'" . $conn->escape($kkmv) . "'"; } if ($myvalues == "") { $myvalues = "''"; } $newstring .= $myvalues; break; case 'split': $sparr = explode(".", trim($displayvalue)); $newstring .= $sparr[intval($displaypara)]; break; case 'explode': $sparr = explode(" ", trim($displayvalue)); $newstring .= $sparr[intval($displaypara)]; break; case 'substr': if (intval($displaypara) < 0) { $newstring .= substr($displayvalue, intval($displaypara)); } else { $newstring .= substr($displayvalue, 0, intval($displaypara)); } break; case 'trim': $displayvalue = str_replace(" ", "", trim($displayvalue)); $displayvalue = str_replace(".", "", $displayvalue); $displayvalue = str_replace("-", "", $displayvalue); $displayvalue = str_replace("=", "", $displayvalue); $newstring .= $displayvalue; break; case 'html': $newstring .= str_replace("\n", "<br>", $displayvalue); break; case 'nohtml': $newstring .= strip_tags(html_entity_decode2($displayvalue)); break; case 'pin': $newstring .= substr(md5($displayvalue), intval($displaypara)); break; case 'lang': $newstring .= getLT($displayvalue); break; case 'upper': $newstring .= strtoupper($displayvalue); break; case 'caps': $newstring .= strtoupper(substr(getLT($displayvalue), 0, 1)) . strtolower(substr(getLT($displayvalue), 1)); break; case 'lower': $newstring .= strtolower($displayvalue); break; case 'adresa': $newstring .= strtoupper(str_ireplace("zip", "cod postal", $displayvalue)); break; case 'full': $newstring .= parseAndReplaceAll($displayvalue, $slotback); break; case 'easyread': $newstring .= strrev(join(str_split(strrev($displayvalue), 3), ".")); break; case 'phone': $displayvalue = str_replace("-", "", $displayvalue); $displayvalue = str_replace("/", "", $displayvalue); $displayvalue = str_replace(" ", "", $displayvalue); $displayvalue = str_replace(".", "", $displayvalue); $displayvalue = str_replace(",", "", $displayvalue); $displayvalue = str_replace(",", "", $displayvalue); $displayvalue = substr($displayvalue, 0, 10); $newstring .= $displayvalue; break; case 'seo': $newstring .= buildSeoLink($displayvalue); break; default: $newstring .= $displayvalue; break; } if ($directdump) { echo $newstring; $newstring = $oldnewstring; } } } } } $pos = strpos($text, "[", $pos + 1); } $newstring .= substr($text, $oldpos); return $newstring; }
/** * Archives off a user: * * @param string SessionID */ function archiveidentity($tablename, $sessionid, $dateof) { global $mydatabase, $CSLH_Config; // get visitor information: $sqlquery = "SELECT user_id,showedup,isnamed,identity,username,lastaction,ipaddress,cookieid,useragent FROM livehelp_users WHERE sessionid='" . filter_sql($sessionid) . "'"; $res = $mydatabase->query($sqlquery); $res_array = $res->fetchRow(DB_FETCHMODE_ORDERED); $user_id = $res_array[0]; $showedup = $res_array[1]; $isnamed = $res_array[2]; $identitystring = $res_array[3]; $username = $res_array[4]; $lastaction = $res_array[5]; $ipaddress = $res_array[6]; $cookieid = $res_array[7]; $useragent = $res_array[8]; $seconds = timediff($lastaction, $showedup); // do we have this user in the identity table by cookie: $sqlquery = "SELECT uservisits,id,seconds FROM {$tablename} WHERE cookieid='" . filter_sql($cookieid) . "' AND dateof=" . intval($dateof) . " LIMIT 1"; $identity_res = $mydatabase->query($sqlquery); // found by cookie name: if ($identity_res->numrows() != 0) { $id_array = $identity_res->fetchRow(DB_FETCHMODE_ORDERED); $uservisits = $id_array[0]; $id = $id_array[1]; $timesofar = $id_array[2]; } else { // look by identity/username: $sqlquery = "SELECT uservisits,id,seconds FROM {$tablename} WHERE identity='" . filter_sql($identitystring) . "' AND username='******' AND dateof=" . intval($dateof) . " LIMIT 1"; $identity_res = $mydatabase->query($sqlquery); //found by identity and username: if ($identity_res->numrows() != 0) { $id_array = $identity_res->fetchRow(DB_FETCHMODE_ORDERED); $uservisits = $id_array[0]; $id = $id_array[1]; $timesofar = $id_array[2]; } else { // find groupidentity $sqlquery = "SELECT groupidentity FROM {$tablename} WHERE identity='" . filter_sql($identitystring) . "'"; $sth = $mydatabase->query($sqlquery); if ($sth->numrows() == 0) { $sqlquery = "SELECT MAX(groupidentity) as groupidentity FROM {$tablename}"; $sth = $mydatabase->query($sqlquery); $row3 = $sth->fetchRow(DB_FETCHMODE_ASSOC); $groupidentity = $row3['groupidentity'] + 1; } else { $row3 = $sth->fetchRow(DB_FETCHMODE_ASSOC); $groupidentity = $row3['groupidentity']; } //groupusername $sqlquery = "SELECT groupusername FROM {$tablename} WHERE username='******'"; $sth = $mydatabase->query($sqlquery); if ($sth->numrows() == 0) { $sqlquery = "SELECT MAX(groupusername) as groupusername FROM {$tablename}"; $sth = $mydatabase->query($sqlquery); $row3 = $sth->fetchRow(DB_FETCHMODE_ASSOC); $groupusername = $row3['groupusername'] + 1; } else { $row3 = $sth->fetchRow(DB_FETCHMODE_ASSOC); $groupusername = $row3['groupusername']; } $sqlquery = "INSERT INTO {$tablename} (groupusername,groupidentity,isnamed,identity,ipaddress,username,dateof,uservisits,seconds) VALUES (" . intval($groupusername) . "," . intval($groupidentity) . ",'{$isnamed}','" . filter_sql($identitystring) . "','" . filter_sql($ipaddress) . "','" . filter_sql($username) . "'," . intval($dateof) . ",0,0)"; $mydatabase->query($sqlquery); $uservisits = 0; $timesofar = 0; $id = mysql_insert_id(); } } // update row: $seconds = $seconds + $timesofar; $uservisits++; $sqlquery = "UPDATE {$tablename} SET useragent='" . filter_sql($useragent) . "',isnamed='{$isnamed}',ipaddress='" . filter_sql($ipaddress) . "',uservisits={$uservisits},seconds={$seconds},cookieid='" . filter_sql($cookieid) . "' WHERE id={$id} "; $mydatabase->query($sqlquery); }
function gethtml() { global $alertinsite, $alertchat, $insitewav, $soundwav, $hidechatters, $color_alt2, $color_alt4, $color_background, $numchatsnow, $UNTRUSTED, $CSLH_Config, $operators, $operators_array, $ignorelist_array, $ignorelist, $lang, $show_arrival, $mydatabase, $identity, $onload, $myid, $stuffatbottom, $user_alert; $onload = ""; $DIVS = " "; $lasthtml = ""; $timeof = rightnowtime(); // update operators timestamp . $sql = "UPDATE livehelp_users set lastaction='{$timeof}' WHERE sessionid='" . $identity['SESSIONID'] . "' "; $mydatabase->query($sql); /// Current Chat Requests: ----------------------------------------------------------- $html = "<table width=100% bgcolor=" . $color_alt2 . "><tr>"; $html .= "<td width=20> </td>"; $html .= "<td><b>" . $lang['txt230'] . "</b></td></tr></table>"; $prev = mktime(date("H"), date("i") - 10, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $sqlquery = "SELECT * FROM livehelp_users WHERE status='chat' AND isoperator='N' ORDER by showedup"; $chatcheck = $mydatabase->query($sqlquery); $numchatnow = $chatcheck->numrows(); $html .= "<table width=100%>"; $chatrequests = 0; while ($visitor = $chatcheck->fetchRow(DB_FETCHMODE_ASSOC)) { $actionlink = ""; $chatting = ""; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $visitor['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($data_check->numrows() == 0) { // we are not in the department that this user is chatting in.. } else { // see if anyone is chatting with this person. $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $visitor['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); $showedup = substr($visitor['showedup'], 8, 2) . ":" . substr($visitor['showedup'], 10, 2); if ($counting->numrows() == 0) { $updated_ignore = $ignorelist . "," . $visitor['user_id']; $chatting = "<img src=images/needaction.gif width=21 height=20 border=0>"; $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&action=activiate&who=" . $visitor['user_id'] . "&whatchannel=" . $visitor['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "&needaction=1>" . $lang['Activate'] . "</a>]\n"; if ($UNTRUSTED['autoanswer'] == "Y") { print "<script>window.location.replace('admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&action=activiate&who=" . $visitor['user_id'] . "&whatchannel=" . $visitor['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "&needaction=1');</script>"; } if (!in_array($visitor['user_id'], $ignorelist_array)) { $actionlink .= "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$updated_ignore}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&showvisitors=" . $UNTRUSTED['showvisitors'] . ">" . $lang['Ignore'] . "</a>]\n"; $onload = " setTimeout(\"tellme(0);\",500); "; $chatrequests++; if ($user_alert == "N" || $user_alert == "") { $soundwav = " <embed src=\"sounds/" . $alertchat . "\" autostart=true loop=false width=1 height=1> "; $stuffatbottom .= "\n<SCRIPT type=\"text/javascript\">top.status=\"[activate]\";top.status=\"\"; setTimeout(\"tellme(0);\",1500); </SCRIPT>\n"; } } if (!in_array($visitor['user_id'], $ignorelist_array)) { $html .= "<tr><td width=10> {$showedup} </td><td nowrap=nowrap><table><tr><td>{$chatting}</td><td><a href=javascript:seepages(" . $visitor['user_id'] . ") onMouseOver=\"try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $visitor['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $visitor['username'] . "'); } catch(dam){} return true;\">" . $visitor['username'] . "</a> {$actionlink} </td></tr></table></td></tr>\n"; } else { $html .= "<tr bgcolor=#DDDDDD><td width=10> {$showedup} </td><td nowrap=nowrap><table><tr><td>{$chatting}</td><td><a href=javascript:seepages(" . $visitor['user_id'] . ") onMouseOver=\"try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $visitor['username'] . "');} catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $visitor['username'] . "'); } catch(dam){} return true;\">" . $visitor['username'] . "</a> {$actionlink} </td></tr></table></td></tr>\n"; } $chatrequests++; $sqlquery = "SELECT * from livehelp_users WHERE sessionid='" . $visitor['sessionid'] . "'"; $user_info = $mydatabase->query($sqlquery); $user_info = $user_info->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "' Order by whendone DESC LIMIT 1"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $visitor['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $DIVS .= "<DIV ID=\"info-" . $visitor['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n <TABLE BORDER=\"0\" WIDTH=\"250\"><TR BGCOLOR=\"#000000\"><TD> \n <TABLE BORDER=\"0\" WIDTH=\"248\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n <FONT COLOR=\"#000000\">\n <b>" . $lang['referer'] . ":</b><br>" . $user_info['camefrom'] . "<br>\n <b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n <b>Url:</b><br><a href=" . $page['location'] . " target=_blank>" . $page['location'] . "</a><br>"; $now = date("YmdHis"); if ($user_info['lastaction'] == "" || $user_info['lastaction'] < 20002020202020) { $user_info['lastaction'] = $now; } $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['txt65'] . ":</b><br>{$thediff} Seconds ago<br> \n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; } } } if ($chatrequests == 0) { $html .= "<tr><td>" . $lang['txt231'] . "</td></tr>"; if ($UNTRUSTED['autoanswer'] == "Y") { $html .= "<tr><td><i>Auto Answer:</i> <b>ON</b> (<a href=admin_users_refresh.php>Turn OFF</a>)</td></tr>"; if (!empty($UNTRUSTED['notit'])) { $html .= "<tr bgcolor=FFFFCC><td><i> <b><font color=#990000>NOTE : </font></b> it is recommended you have <b>Typing Alert</b> set to ON so you can be alerted of chats while this is ON . After answering a chat you can turn it OFF.. </td></tr>"; $query = "UPDATE livehelp_users set typing_alert='Y' WHERE sessionid='" . $identity['SESSIONID'] . "'"; $mydatabase->query($query); print "<script type=\"text/javascript\"> window.parent.rooms.location='admin_rooms.php';</script>"; } } else { // used for social panel: // $html .= "<tr><td><i>Auto Answer:</i> <b>Off</b> (<a href=admin_users_refresh.php?autoanswer=Y¬it=2>Turn ON</a>)</td></tr>"; } } $html .= "</table>"; $html .= "<table width=100% bgcolor=" . $color_alt2 . "><tr>"; $sqlquery = "SELECT * FROM livehelp_users WHERE status='chat' AND isoperator='N'"; $chatcheck = $mydatabase->query($sqlquery); $numchatnow = $chatcheck->numrows(); while ($visitor = $chatcheck->fetchRow(DB_FETCHMODE_ASSOC)) { $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $visitor['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() == 0 && !in_array($visitor['user_id'], $ignorelist_array)) { $UNTRUSTED['hidechatters'] = 0; } } if ($UNTRUSTED['hidechatters'] == 1) { $html .= "<td width=20><a href=admin_users_refresh.php?hidechatters=0&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&hidechatters=0 onclick=\"javascript:shouldireloadbot();\" ><img src=images/plus.gif border=0></a></td>"; } else { $html .= "<td width=20><a href=admin_users_refresh.php?hidechatters=1&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&hidechatters=1 onclick=\"javascript:shouldireloadbot();\" ><img src=images/minus.gif border=0></a></td>"; } $html .= "<td><b> " . $lang['chat_text'] . " </b></td></tr></table>"; $prev = mktime(date("H"), date("i") - 4, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); // select out all of the operators that are online chatting: $sqlquery = "SELECT * FROM livehelp_users WHERE status='chat' ORDER by showedup"; $chatcheck = $mydatabase->query($sqlquery); $numchatnow = $chatcheck->numrows(); $chatboxes = 0; $OPhiddennow = 0; $OPonlinenow = 0; $html .= "<table width=100% cellpadding=0 cellspacing=0 border=0>"; if ($UNTRUSTED['hidechatters'] != 1) { $html .= "<tr><td colspan=4 NOWRAP=NOWRAP align=right><b><font color=007700>[OPonlinenow] " . $lang['online'] . "</font> <font color=777777>[OPhiddennow] " . $lang['Hidden'] . "</font></b></td></tr>"; if ($chatcheck->numrows() == 0) { $html .= "<tr><td>" . $lang['no_chat'] . "</td></tr>"; } //--List of Chatting users by Operator---------------------------------------------------------------------- $sqlquery = "SELECT * FROM livehelp_users WHERE isonline='Y' and isoperator='Y' ORDER by username"; $chatcheck = $mydatabase->query($sqlquery); while ($operatorsarray = $chatcheck->fetchRow(DB_FETCHMODE_ASSOC)) { $actionlink = ""; $chatting = ""; $operatorhtml = ""; $operatorlasthtml = ""; $htmlgray = ""; $lasthtmlgray = ""; $showgray = 0; // Operators can be on multiple channels so see if one of the channels they are on is one we are on. $foundcommonchannel = 0; $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE user_id='" . $operatorsarray['user_id'] . "'"; $mychannels = $mydatabase->query($sqlquery); while ($rowof = $mychannels->fetchRow(DB_FETCHMODE_ASSOC)) { $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE user_id='{$myid}' And channel='" . $rowof['channel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() != 0) { $foundcommonchannel = $rowof['channel']; } } // Operators can be on multiple departements so see if this operator is on our department: $foundcommondepartment = 0; $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='" . $operatorsarray['user_id'] . "'"; $mychannels = $mydatabase->query($sqlquery); while ($rowof = $mychannels->fetchRow(DB_FETCHMODE_ASSOC)) { $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' And department='" . $rowof['department'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() != 0) { $foundcommondepartment = 1; } } // update the action links acccording to if we are on the same channel or not.. if ($foundcommonchannel == 0) { $chatting = "<img src=images/noton.gif width=19 height=18 border=0>"; if ($myid != $operatorsarray['user_id']) { $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&numchats={$numchatsnow}&operators={$operators}&action=activiate&who=" . $operatorsarray['user_id'] . "&whatchannel=" . $operatorsarray['onchannel'] . "&conferencein=yes&showvisitors=" . $UNTRUSTED['showvisitors'] . "><font color=007700>" . $lang['begin'] . "</font></a>]\n"; } else { $actionlink = ""; $chatting = "<img src=images/active.gif width=19 height=18 border=0>\n"; } } else { $chatting = "<table cellpadding=0 cellspacing=0 border=0 bgcolor=" . $rowof['txtcolor_alt'] . "><tr><td><img src=images/active.gif width=19 height=18 border=0></td></tr></table>\n"; if ($operatorsarray['user_id'] != $myid) { $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&action=leave&who=" . $operatorsarray['user_id'] . "&whatchannel={$foundcommonchannel}&clearchannel=N&showvisitors=" . $UNTRUSTED['showvisitors'] . ">" . $lang['stop_chat'] . "</a>]\n"; } } // if we are in the same department as this operator show them.. if not show them in gray if and only if // we have a chatter in common... if ($foundcommondepartment) { $OPonlinenow++; if ($myid != $operatorsarray['user_id']) { $operatorhtml .= "<tr><td width=21><img src=images/operator.gif width=21 height=20 border=0></td><td colspan=3><table><tr><td>{$chatting}</td><td width=90% align=left> <b>" . $operatorsarray['username'] . "</b> {$actionlink} </td></tr></table></td></tr>\n"; } else { $operatorlasthtml .= "<tr><td width=21><img src=images/operator.gif width=21 height=20 border=0></td><td colspan=3><table><tr><td>{$chatting}</td><td width=90% align=left> <b>" . $operatorsarray['username'] . "</b> {$actionlink} </td></tr></table></td></tr>\n"; } } else { $OPhiddennow++; if ($myid != $operatorsarray['user_id']) { $htmlgray .= "<tr><td width=21><img src=images/operator_gray.gif width=21 height=20 border=0></td><td colspan=3><table><tr><td>{$chatting}</td><td width=90% align=left> <b>" . $operatorsarray['username'] . "</b> {$actionlink} </td></tr></table></td></tr>\n"; } else { $lasthtmlgray .= "<tr><td width=21><img src=images/operator_gray.gif width=21 height=20 border=0></td><td colspan=3><table><tr><td>{$chatting}</td><td width=90% align=left> <b>" . $operatorsarray['username'] . "</b> {$actionlink} </td></tr></table></td></tr>\n"; } } // show all of this operators chats: $q = "SELECT livehelp_users.* FROM livehelp_users,livehelp_operator_channels WHERE livehelp_users.user_id=livehelp_operator_channels.userid AND livehelp_users.status='chat' AND livehelp_operator_channels.user_id=" . $operatorsarray['user_id'] . " ORDER by showedup"; $sth = $mydatabase->query($q); $showgray = 0; while ($chatters = $sth->fetchRow(DB_FETCHMODE_ASSOC)) { $inthedepartment = 1; $ischattingwith = 0; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $chatters['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($data_check->numrows() == 0) { // we are not in the department that this user is chatting in.. $OPhiddennow++; $inthedepartment = 0; } // see if we are chatting with them $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE user_id='{$myid}' And channel='" . $chatters['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); $checkbox = ""; $actionlinkouter = ""; if ($counting->numrows() == 0) { $chatting = "<img src=images/noton.gif width=19 height=18 border=0>"; $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&action=activiate&who=" . $chatters['user_id'] . "&whatchannel=" . $chatters['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "&conferencein=yes><font color=007700>Join Chat</font></a>]\n"; $actionlinkouter = $actionlink; } else { $ischattingwith = 1; $chatboxes++; $rowof = $counting->fetchRow(DB_FETCHMODE_ASSOC); $chatting = "<table cellpadding=0 cellspacing=0 border=0 bgcolor=" . $rowof['channelcolor'] . "><tr><td><img src=images/active.gif width=19 height=18 border=0></td></tr></table>\n"; $showgray = 1; $actionlink = ""; $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $chatters['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() > 1) { $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&action=leave&who=" . $chatters['user_id'] . "&whatchannel=" . $chatters['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . ">Un-Conference</a>]\n "; } $checkbox = "<input type=checkbox name=session__" . $chatters['user_id'] . " value=" . $chatters['sessionid'] . " border=0>"; $actionlink .= "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators={$operators}&action=stop&who=" . $chatters['user_id'] . "&whatchannel=" . $chatters['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "><font color=990000>" . $lang['stop'] . "</font></a>]\n"; } // see if anyone is chatting with this person. $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $chatters['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() == 0 && !in_array($chatters['user_id'], $ignorelist_array)) { // no one is chatting with this person..... they are listed in requested chats... } else { $intheuserdepartment = 0; $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' And department='" . $chatters['department'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() != 0) { $intheuserdepartment = 1; } $OPonlinenow++; if ($myid != $operatorsarray['user_id']) { if (!($intheuserdepartment == 0 && preg_match("/noton/", $chatting))) { $operatorhtml .= "<tr bgcolor=#EFEFEF><td> </td><td><img src=images/blank.gif width=5 height=5 border=0></td><td nowrap=nowrap>{$chatting}</td><td width=90% align=left><a href=javascript:seepages(" . $chatters['user_id'] . ") onMouseOver=\" try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $chatters['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $chatters['username'] . "');} catch(dam){} return true;\">" . $chatters['username'] . "</a> {$actionlinkouter} </td></tr>\n"; } } else { if (!($intheuserdepartment == 0 && preg_match("/noton/", $chatting))) { $operatorlasthtml .= "<tr bgcolor=#EFEFEF><td> </td><td>{$checkbox}</td><td nowrap=nowrap>{$chatting}</td><td width=90% align=left><a href=javascript:seepages(" . $chatters['user_id'] . ") onMouseOver=\"try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $chatters['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $chatters['username'] . "'); } catch(dam){} return true;\">" . $chatters['username'] . "</a> {$actionlink} </td></tr>\n"; } } } $sqlquery = "SELECT * from livehelp_users WHERE sessionid='" . $chatters['sessionid'] . "'"; $user_info = $mydatabase->query($sqlquery); $user_info = $user_info->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $chatters['sessionid'] . "' Order by whendone DESC LIMIT 1"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $chatters['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $DIVS .= "<DIV ID=\"info-" . $chatters['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n<TABLE BORDER=\"0\" WIDTH=\"250\"><TR BGCOLOR=\"#000000\"><TD> \n<TABLE BORDER=\"0\" WIDTH=\"248\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n<FONT COLOR=\"#000000\">\n<b>" . $lang['referer'] . ":</b><br>" . $user_info['camefrom'] . "<br>\n<b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n<b>Url:</b><br><a href=" . $page['location'] . " target=_blank>" . $page['location'] . "</a><br>"; $now = date("YmdHis"); if ($user_info['lastaction'] == "" || $user_info['lastaction'] < 20002020202020) { $user_info['lastaction'] = $now; } $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['txt65'] . ":</b><br>{$thediff} " . $lang['Seconds'] . "<br>\n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; } if (preg_match("/active/", $operatorhtml)) { $html .= $htmlgray; $lasthtml .= $lasthtmlgray; } $html .= $operatorhtml; $lasthtml .= $operatorlasthtml; } } $html = str_replace("[OPonlinenow]", $OPonlinenow, $html); $html = str_replace("[OPhiddennow]", $OPhiddennow, $html); $html .= $lasthtml . "</table>"; $html .= "<DIV ID=\"chattersdiv\" STYLE=\"z-index: 2;\">"; if ($UNTRUSTED['hidechatters'] != 1 && $chatboxes > 0) { $html .= "<table cellpadding=0 cellspacing=0 border=0>"; $html .= "<tr><td><img src=images/blank.gif width=18 height=22 border=0></td><td align=left><img src=images/arrow_ltr.gif width=38 height=22><select name=whattodochat onchange=updatepeople(1)>"; $html .= "<option value=\"\">" . $lang['txt207'] . ":</option>"; $html .= "<option value=stop>" . $lang['stop_chat'] . "</option>"; $html .= "<option value=transfer>" . $lang['transfer_chat'] . "</option>"; $html .= "<option value=conference>" . $lang['conference_chats'] . "</option>"; $html .= "</select> <a href=javascript:updatepeople(1)><img src=images/go.gif border=0 width=20 height=20></a></td></tr>"; $html .= "</table>"; } $html .= "</DIV>"; ///-------------------------------------------------------------------------------------------------- // get the count of active visitors in the system right now. $timeof = rightnowtime(); $prev = mktime(date("H"), date("i") - 4, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $sqlquery = "SELECT * FROM livehelp_users WHERE lastaction>'{$oldtime}' AND status!='chat' AND isoperator!='Y' "; // make list of ignored visitors: $ipadd = explode(",", $CSLH_Config['ignoreips']); for ($i = 0; $i < count($ipadd); $i++) { if (!empty($ipadd[$i])) { $sqlquery .= " AND ipaddress NOT LIKE '" . $ipadd[$i] . "%' "; } } $sqlquery .= " ORDER by lastaction DESC"; $visitors = $mydatabase->query($sqlquery); $onlinenow = $visitors->numrows(); $hiddennow = 0; $html .= "<SCRIPT type=\"text/javascript\">\n \n function stopajax(){\n //document.admin_actions.togglerefresh.SelectedIndex=2;\n // alert(1);\n //document.admin_actions.submit();\n }\n </SCRIPT>"; $html .= "<table width=100% cellpadding=0 cellspacing=0 bgcolor=" . $color_alt2 . "><tr><td>"; if ($UNTRUSTED['showvisitors'] != 3) { if ($UNTRUSTED['showvisitors'] == 1) { $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=2 onclick=\"javascript:shouldireloadbot();\" ><img src=images/minus.gif border=0></a>"; } else { if ($CSLH_Config['admin_refresh'] == "auto") { $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=3&togglerefresh=AJAX onclick=\"javascript:shouldireloadbot();\" ><img src=images/plus.gif border=0></a>AJAX "; $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=1 onclick=\"javascript:shouldireloadbot();\" ><img src=images/plus.gif border=0></a>AUTO"; } else { $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=1 onclick=\"javascript:shouldireloadbot();\" ><img src=images/plus.gif border=0></a>"; } } } else { $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=2&togglerefresh=auto onclick=\"javascript:shouldireloadbot();\" ><img src=images/minus.gif border=0></a>"; } if ($UNTRUSTED['showvisitors'] == 1) { $html .= "</td><td><b>" . $lang['visit'] . "</b></td></tr></table>"; $html .= "<table width=100%><tr><td align=right><b><font color=007700>[onlinenow] " . $lang['online'] . "</font> <font color=777777>[hiddennow] " . $lang['Hidden'] . "</font></b></td></tr></table>"; $html .= "<table width=100%><tr bgcolor={$color_background}><td> </td><td><b>ID</b></td><td><b>" . $lang['status'] . ":</b></td><td><b>pg#</b></td>"; if ($CSLH_Config['maxrequests'] < 9999) { $html .= "<td>rq#</td>"; } $html .= "</tr>"; $insitewav = ""; while ($visitor = $visitors->fetchRow(DB_FETCHMODE_ASSOC)) { $chatting = ""; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $visitor['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($visitor['department'] != 0 && $data_check->numrows() == 0) { $hiddennow++; $onlinenow--; } else { if (empty($visitor['user_alert'])) { $visitor['user_alert'] = 0; } if ($visitor['isoperator'] != "Y" && $visitor['user_alert'] != 1) { $onload = " setTimeout(\"doorbell();\",700); "; if ($user_alert == "N" || $user_alert == "") { if ($show_arrival != "N") { $insitewav = " <EMBED SRC=sounds/" . $alertinsite . " AUTOSTART=TRUE width=1 height=1 LOOP=FALSE> \n"; } } $sql = "UPDATE livehelp_users SET user_alert='1' WHERE user_id='" . $visitor['user_id'] . "' "; $mydatabase->query($sql); } $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "'"; $my_count = $mydatabase->query($sqlquery); $my_count = $my_count->numrows(); $html .= "<tr><td width=10><input type=checkbox name=session__" . $visitor['user_id'] . " value=" . $visitor['sessionid'] . " border=0></td><td>"; $html .= "<a href=javascript:seepages(" . $visitor['user_id'] . ") onMouseOver=\" try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $visitor['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $visitor['username'] . "'); } catch(dam){} return true;\">" . $visitor['username'] . "</a>"; $sqlquery = "SELECT * from livehelp_users WHERE user_id='" . $visitor['user_id'] . "'"; $user_info = $mydatabase->query($sqlquery); $user_info = $user_info->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "' Order by whendone DESC"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $visitor['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $query = "SELECT whendone from livehelp_visit_track WHERE sessionid='" . filter_sql($visitor['sessionid']) . "' Order by whendone LIMIT 1"; $page_tmprow = $mydatabase->query($query); $tmprow = $page_tmprow->fetchRow(DB_FETCHMODE_ASSOC); $later = $tmprow['whendone']; $DIVS .= "<DIV ID=\"info-" . $visitor['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n<TABLE BORDER=\"0\" WIDTH=\"300\"><TR BGCOLOR=\"#000000\"><TD> \n<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n<FONT COLOR=\"#000000\">\n<b>Referer:</b><br>" . $user_info['camefrom'] . "<br>"; if (empty($page['location'])) { $page['location'] = ""; } $DIVS .= "<b>" . $lang['timeonline'] . ":</b>" . secondstoHHmmss(timediff($later, date("YmdHis"))) . "<br> \n<b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n<b>url:</b><br>" . $page['location'] . "<br>"; $now = date("YmdHis"); $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['lastact'] . ":</b><br>{$thediff} " . $lang['Seconds'] . "<br>\n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; $html .= "</td>"; switch ($visitor['status']) { case "DHTML": $html .= "<td>L:<img src=images/invited.gif> "; break; case "request": $html .= "<td>P:<img src=images/invited.gif> "; break; case "invited": $html .= "<td><img src=images/invited2.gif> "; break; case "qna": $html .= "<td><img src=images/qna.gif>"; break; case "stopped": $html .= "<td><img src=images/stopped.gif> {<a href=layer.php?selectedwho=" . $visitor['user_id'] . " target=_blank>RE-" . $lang['invite'] . "</a>}"; break; case "message": $html .= "<td><img src=images/message.gif> "; break; default: $html .= "<td><a href=layer.php?selectedwho=" . $visitor['user_id'] . " target=_blank>" . $lang['invite'] . "</a> "; break; } $html .= "</td>"; $html .= "<td>{$my_count}</td>"; if ($CSLH_Config['maxrequests'] < 9999) { if ($user_info['visits'] > $CSLH_Config['maxrequests'] - 16) { if ($user_info['visits'] < $CSLH_Config['maxrequests']) { $html .= "<td><font color=#770000>" . $user_info['visits'] . "</font><br><a href=javascript:resetpages(" . $visitor['user_id'] . ")>reset</a></td>"; } else { $html .= "<td><font color=#CC0000><b>" . $user_info['visits'] . "</b></font><br><a href=javascript:resetpages(" . $visitor['user_id'] . ")>reset</a></td>"; } } else { $html .= "<td>" . $user_info['visits'] . "</td>"; } } $html .= "</tr>"; } } $html = str_replace("[onlinenow]", $onlinenow, $html); $html = str_replace("[hiddennow]", $hiddennow, $html); $html .= "</table>"; $html .= "<DIV ID=\"visitorsdiv\" STYLE=\"z-index: 2;\">"; if ($onlinenow > 0) { $html .= "<table>"; $html .= "<tr><td><img src=images/arrow_ltr.gif width=38 height=22><select name=whattodo onchange=updatepeople(2)>"; $html .= "<option value=\"\">" . $lang['txt207'] . ":</option>"; $html .= "<option value=DHTML>" . $lang['Invite'] . ":" . $lang['layer'] . "</option>"; $html .= "<option value=pop>" . $lang['Invite'] . ":" . $lang['popup'] . "</option>"; $html .= "<option value=insite>" . $lang['Invite'] . ":" . insite . "</option>"; $html .= "</select> <a href=javascript:updatepeople(2)><img src=images/go.gif border=0 width=20 height=20></a></td></tr>"; $html .= "</table><center><a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=2>" . $lang['txt208'] . "</a><br></center>"; } $html .= "</DIV>"; } else { while ($visitor = $visitors->fetchRow(DB_FETCHMODE_ASSOC)) { $chatting = ""; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $visitor['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($visitor['department'] != 0 && $data_check->numrows() == 0) { $hiddennow++; $onlinenow--; } } if ($UNTRUSTED['showvisitors'] == 2) { $html .= "</td><td><b>" . $lang['visit']; if ($CSLH_Config['admin_refresh'] == "auto") { $html .= "<br>"; } $html .= " <font color=007700>{$onlinenow} " . $lang['online'] . "</font> <font color=777777>{$hiddennow} " . $lang['Hidden'] . "</font> </b></td></tr></table>"; if ($CSLH_Config['admin_refresh'] == "auto") { $html .= "<table width=100%><tr bgcolor={$color_background}><td colspan=4 align=center><font color=#990000><i>" . $lang['Hidden'] . "</i></a></font><br>To monitor visitors click either:"; $html .= " { <a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=3&togglerefresh=AJAX onclick=\"javascript:shouldireloadbot();\"> AJAX </a> | "; $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=1 onclick=\"javascript:shouldireloadbot();\"> AUTO</a> }"; } else { $html .= "<table width=100%><tr bgcolor={$color_background}><td colspan=4 align=center><font color=#990000><i>" . $lang['Hidden'] . "</i></a></font><br><a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&autoanswer=" . $UNTRUSTED['autoanswer'] . "&operators=" . $UNTRUSTED['operators'] . "&showvisitors=1 onclick=\"javascript:shouldireloadbot();\">" . $lang['txt209'] . "</a>"; } $html .= "</td></tr></table>"; } else { $html .= "</td><td><b>" . $lang['visit'] . "</b></td></tr></table>"; $html .= "<DIV id=\"visitorschatdiv\"> ...... Loading ..... </DIV>"; } } $html = $html . $DIVS; return $html; }
?> </td> </tr> <tr> <td width="100px">规划时长:</td> <td><?php echo timediff($currPlan['startime'], $currPlan['endtime']); ?> </td> <td width="120px">距离结束:</td> <td> <?php if ($currPlan['timeline']) { $timeline = unserialize($currPlan['timeline']); if (isset($timeline['online'])) { echo timediff($timeline['online'], $currPlan['endtime'], 0, 1); } else { echo '<div id="clock"></div>'; } } else { echo '<div id="clock"></div>'; } ?> </td> </tr> <tr> <td width="100px">简介:</td> <td colspan="3"><?php echo nl2br($currPlan['plan_discription']); ?> </td>
function showInterval($date1, $date2, $format, $nosecs = '') { $diff = timediff($date1, $date2, $format, $nosecs); $ret = ""; if ($diff['days']) { $ret = $diff['days'] . ' ' . getLT('days'); } if ($diff['hours']) { $ret .= " " . $diff['hours'] . ' ' . getLT('hours'); } if ($diff['mins']) { $ret .= " " . $diff['mins'] . ' ' . getLT('minutes'); } if ($diff['secs'] && $nosecs == "yes") { $ret .= " " . $diff['secs'] . ' ' . getLT('seconds'); } $indate1 = explode(" ", $date1); $dateArr1 = explode("-", $indate1[0]); $hourArr1 = explode(":", $indate1[1]); $indate2 = explode(" ", $date2); $dateArr2 = explode("-", $indate2[0]); $hourArr2 = explode(":", $indate2[1]); if ($date2 == '0000-00-00 00:00:00') { $ret = ""; } if ($date1 == '0000-00-00 00:00:00') { $ret = ""; } if ($ret == "") { $ret = getLT('amoment'); } $ret2 = ""; if ($indate1[0] == $indate2[0] && $indate1[0] != "0000-00-00") { $ret2 = showDate($indate1[0], $format); if ($nosecs == '') { $ret2 .= " " . $hourArr1[0] . ":" . $hourArr1[1] . "-" . $hourArr2[0] . ":" . $hourArr2[1]; } else { $ret2 .= " " . $indate1[1] . "-" . $indate2[1]; } } else { $t1 = showDateTime($date1, $format, $nosecs); $t2 = showDateTime($date2, $format, $nosecs); $ret2 .= $t1; if ($t1 != "" && $t2 != "") { $ret2 .= "[-]"; } $ret2 .= $t2; } $ret2 .= " (" . $ret . ")"; return $ret2; }
function arrayofchats() { global $mydatabase, $CSLH_Config, $UNTRUSTED, $identity; $arrayforoperator = array(); $query = "SELECT livehelp_operator_channels.id,livehelp_operator_channels.txtcolor,livehelp_operator_channels.txtcolor_alt,livehelp_operator_channels.channelcolor,livehelp_operator_channels.userid,livehelp_users.user_id,livehelp_users.isoperator,livehelp_users.ipaddress,livehelp_users.username,livehelp_users.onchannel,livehelp_users.lastaction FROM livehelp_operator_channels,livehelp_users where livehelp_operator_channels.userid=livehelp_users.user_id AND livehelp_operator_channels.user_id=" . intval($this->myid); $mychannels = $mydatabase->query($query); $counting = $mychannels->numrows(); $wearelinking = false; // flag for if we are linking the chat tabs or not. $alltabs = array(); $j = 0; while ($channel_a = $mychannels->fetchRow(DB_FETCHMODE_ASSOC)) { $prev = mktime(date("H"), date("i") - 3, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $alltabs[$j] = $channel_a; $j++; } // Update operator History for when operator is chatting $q = "SELECT chataction,user_id FROM livehelp_users WHERE sessionid='" . $identity['SESSIONID'] . "' LIMIT 1"; $sth = $mydatabase->query($q); $row = $sth->fetchRow(DB_FETCHMODE_ORDERED); $rightnow = rightnowtime(); $chataction = $row[0]; $opid = $row[1]; if ($j > 0) { $q = "UPDATE livehelp_users SET chataction='{$rightnow}' WHERE sessionid='" . $identity['SESSIONID'] . "'"; $mydatabase->query($q); } else { // get when they logged in and how many seconds they have been online: $query = "SELECT dateof FROM livehelp_operator_history WHERE opid=" . $opid . " AND action='Started Chatting' ORDER by dateof DESC LIMIT 1"; $data3 = $mydatabase->query($query); $row3 = $data3->fetchRow(DB_FETCHMODE_ASSOC); $seconds = timediff($chataction, $row3['dateof']); if ($chataction > 10) { // update history for operator to show login: $query = "UPDATE livehelp_users set chataction='0' WHERE sessionid='" . $identity['SESSIONID'] . "'"; $mydatabase->query($query); } } for ($k = 0; $k < count($alltabs); $k++) { $channel_a = $alltabs[$k]; if (!empty($alltabs[$k + 1])) { $channel_b = $alltabs[$k + 1]; } else { $channel_b['onchannel'] = -1; } if ($channel_a['isoperator'] == "Y") { // Operators can be on multiple channels so see if one of the channels they are on is one we are on. $foundcommonchannel = 0; $query = "SELECT * FROM livehelp_operator_channels WHERE user_id=" . intval($channel_a['user_id']); $mychannels2 = $mydatabase->query($query); while ($rowof = $mychannels2->fetchRow(DB_FETCHMODE_ASSOC)) { $query = "SELECT * FROM livehelp_operator_channels WHERE user_id=" . intval($myid) . " And channel=" . intval($rowof['channel']); $countingthem = $mydatabase->query($query); if ($countingthem->numrows() != 0) { $foundcommonchannel = $rowof['channel']; } } $channel_a['onchannel'] = $foundcommonchannel; $channel = $foundcommonchannel; } $thischannel = $channel_a['onchannel'] . "__" . $channel_a['userid']; $usercolor = $channel_a['txtcolor']; $usercolor_alt = $channel_a['txtcolor_alt']; if ($UNTRUSTED['channelsplit'] == $thischannel) { $myuser = $channel_a['username']; $myuser_ip = $channel_a['ipaddress']; $myusercolor = $usercolor; $mychannelcolor = $channel_a['channelcolor']; $txtcolor = $channel_a['channelcolor']; if (in_array($channel_a['onchannel'], $externalchats_array)) { $external = true; } else { $external = false; } } else { $txtcolor = "DDDDDD"; $txtcolor = $channel_a['channelcolor']; } $dakineuser = substr($channel_a['username'], 0, 15); array_push($arrayforoperator, array($txtcolor, $channel_a['onchannel'], $channel_a['userid'], $dakineuser)); } return $arrayforoperator; }
$start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT')); $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT')); $q = $db->query("select video_timestamps.gid, adate, atime, time_to_sec(timediff(atime, '{$start}')) as timediff,\n time_to_sec(timediff(atime, '{$end}')) as timetoend\n from hansard, video_timestamps\n where hansard.gid = video_timestamps.gid and subsection_id={$subsection_id}\n and (user_id is null or user_id!=-1) and deleted=0 order by atime, hpos"); header('Content-Type: text/xml'); $gids = array(); $file_offset = 0; print '<stamps>'; for ($i = 0; $i < $q->rows(); $i++) { $gid = str_replace('uk.org.publicwhip/', '', $q->field($i, 'gid')); if (isset($gids[$gid])) { continue; } $timetoend = $q->field($i, 'timetoend') - $file_offset; if ($timetoend > 0) { $video = video_from_timestamp($videodb, $q->field($i, 'adate'), $q->field($i, 'atime')); $new_start = date('H:i:s', strtotime($video['broadcast_start'] . ' GMT')); $file_offset += timediff($new_start, $start); $start = $new_start; $end = date('H:i:s', strtotime($video['broadcast_end'] . ' GMT')); } $timediff = $q->field($i, 'timediff') - $file_offset; if ($timediff >= 0) { print "<stamp><gid>{$gid}</gid><file>{$video['id']}</file><time>{$timediff}</time></stamp>\n"; } $gids[$gid] = true; } print '</stamps>'; function timediff($a, $b) { return substr($a, 0, 2) * 3600 + substr($a, 3, 2) * 60 + substr($a, 6, 2) - substr($b, 0, 2) * 3600 - substr($b, 3, 2) * 60 - substr($b, 6, 2); }
$query = "UPDATE livehelp_users set authenticated='N',isonline='N',status='offline' WHERE user_id={$opid}"; $mydatabase->query($query); } $prev = mktime(date("H"), date("i") - $CSLH_Config['sessiontimeout'], date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $query = "SELECT user_id,lastaction,sessionid FROM livehelp_users WHERE isoperator='Y' AND authenticated='Y' AND (ismobile='Y' OR ismobile='P') AND lastaction<'{$oldtime}'"; $data2 = $mydatabase->query($query); while ($row = $data2->fetchRow(DB_FETCHMODE_ASSOC)) { $opid = $row['user_id']; $lastaction = $row['lastaction']; $sessionid = $row['sessionid']; // get when they logged in and how many seconds they have been online: $query = "SELECT dateof FROM livehelp_operator_history WHERE opid={$opid} AND action='login' ORDER by dateof DESC LIMIT 1"; $data3 = $mydatabase->query($query); $row3 = $data3->fetchRow(DB_FETCHMODE_ASSOC); $seconds = timediff($lastaction, $row3['dateof']); // update history for operator to show login: $query = "INSERT INTO livehelp_operator_history (opid,action,dateof,sessionid,totaltime) VALUES ({$opid},'Logout','{$lastaction}','{$sessionid}',{$seconds})"; $mydatabase->query($query); // log them off: $query = "UPDATE livehelp_users set authenticated='N',isonline='N',status='offline' WHERE user_id={$opid}"; $mydatabase->query($query); } } // chatters who closed their chat window timeout after a minute of inactivity..: $aminute = mktime(date("H"), date("i") - 1, date("s") - 30, date("m"), date("d"), date("Y")); $oldchat = date("YmdHis", $aminute); $sqlquery = "SELECT sessionid,user_id FROM livehelp_users WHERE status='chat' AND isoperator='N' AND chataction<{$oldchat}"; $old_people = $mydatabase->query($sqlquery); while ($old_chat = $old_people->fetchRow(DB_FETCHMODE_ORDERED)) { $sessionid = $old_chat[0];
$sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "' Order by whendone DESC"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $visitor['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $query = "SELECT whendone from livehelp_visit_track WHERE sessionid='" . filter_sql($visitor['sessionid']) . "' Order by whendone LIMIT 1"; $page_tmprow = $mydatabase->query($query); $tmprow = $page_tmprow->fetchRow(DB_FETCHMODE_ASSOC); $later = $tmprow['whendone']; $DIVS .= "<DIV ID=\"info-" . $visitor['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n<TABLE BORDER=\"0\" WIDTH=\"300\"><TR BGCOLOR=\"#000000\"><TD> \n<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n<FONT COLOR=\"#000000\">\n<b>Referer:</b><br>" . $user_info['camefrom'] . "<br>"; if (empty($page['location'])) { $page['location'] = ""; } $DIVS .= "<b>" . $lang['timeonline'] . ":</b>" . secondstoHHmmss(timediff($later, date("YmdHis"))) . "<br> \n<b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n<b>url:</b><br>" . $page['location'] . "<br>"; $now = date("YmdHis"); $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['lastact'] . ":</b><br>{$thediff} " . $lang['Seconds'] . "<br>\n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; $html .= "</td>"; switch ($visitor['status']) { case "DHTML": $html .= "<td>L:<img src=images/invited.gif> "; break; case "request": $html .= "<td>P:<img src=images/invited.gif> "; break; case "invited": $html .= "<td><img src=images/invited2.gif> "; break; case "qna":
// You should have received a copy of the GNU General Public License // along with this program in a file named LICENSE.txt . //=========================================================================== require_once "admin_common.php"; validate_session($identity); // get the info of this user.. $query = "SELECT * FROM livehelp_users WHERE sessionid='" . $identity['SESSIONID'] . "'"; $people = $mydatabase->query($query); $people = $people->fetchRow(DB_FETCHMODE_ASSOC); $myid = $people['user_id']; $channel = $people['onchannel']; $isadminsetting = $people['isadmin']; $timeof = date("YmdHis"); $timeof_old = $timeof - 100000; // get when they logged in and how many seconds they have been online: $query = "SELECT dateof FROM livehelp_operator_history WHERE opid={$myid} AND action='login' ORDER by dateof DESC LIMIT 1"; $data3 = $mydatabase->query($query); $row3 = $data3->fetchRow(DB_FETCHMODE_ASSOC); $seconds = timediff(date("YmdHis"), $row3['dateof']); // update history for operator to show login: $query = "INSERT INTO livehelp_operator_history (opid,action,dateof,sessionid,totaltime) VALUES ({$myid},'Logout','" . date("YmdHis") . "','" . $identity['SESSIONID'] . "',{$seconds})"; $mydatabase->query($query); $sql = "DELETE FROM livehelp_operator_channels WHERE user_id={$myid} OR userid={$myid}"; $mydatabase->query($sql); // log them off: $query = "UPDATE livehelp_users set authenticated='N',isonline='N',status='offline' WHERE user_id={$myid}"; $mydatabase->query($query); logout($identity); if (!$serversession) { $mydatabase->close_connect(); }
<td width="50%" class="border-bottom border-right"> <a href="<?php echo page("torrent", "details", "", "", "", "id=" . $db->torrent_id); ?> "><?php echo $db->torrent_name; ?> </a> </td> <td class="border-right border-bottom" align="center"> <?php echo bytes($db->peer_uploaded); ?> </td> <td class="border-right border-bottom" align="center"> <?php echo bytes($db->peer_downloaded); ?> </td> <td class="border-bottom" align="center"> <?php echo timediff($db->peer_started, time()); ?> </td> </tr> <?php } ?> </tbody> </table> </div>
function gethtml() { global $alertchat, $insitewav, $soundwav, $hidechatters, $color_alt2, $color_alt4, $color_background, $numchatsnow, $UNTRUSTED, $CSLH_Config, $operators, $operators_array, $ignorelist_array, $ignorelist, $lang, $show_arrival, $mydatabase, $identity, $onload, $myid, $stuffatbottom, $user_alert; $onload = ""; $DIVS = " "; $lasthtml = ""; $timeof = rightnowtime(); // update operators timestamp . $sql = "UPDATE livehelp_users set lastaction='{$timeof}' WHERE sessionid='" . $identity['SESSIONID'] . "' "; $mydatabase->query($sql); /// Current Chat Requests: ----------------------------------------------------------- $html = "<table width=100% bgcolor=" . $color_alt2 . "><tr>"; $html .= "<td width=20> </td>"; $html .= "<td><b>" . $lang['txt230'] . "</b></td></tr></table>"; $prev = mktime(date("H"), date("i") - 10, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $sqlquery = "SELECT * FROM livehelp_users WHERE status='chat' AND isoperator='N' ORDER by showedup"; $chatcheck = $mydatabase->query($sqlquery); $numchatnow = $chatcheck->numrows(); $html .= "<table width=100%>"; $chatrequests = 0; while ($visitor = $chatcheck->fetchRow(DB_FETCHMODE_ASSOC)) { $actionlink = ""; $chatting = ""; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $visitor['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($data_check->numrows() == 0) { // we are not in the department that this user is chatting in.. } else { // see if anyone is chatting with this person. $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $visitor['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); $showedup = substr($visitor['showedup'], 8, 2) . ":" . substr($visitor['showedup'], 10, 2); if ($counting->numrows() == 0) { $updated_ignore = $ignorelist . "," . $visitor['user_id']; $chatting = "<img src=images/needaction.gif width=21 height=20 border=0>"; $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators={$operators}&action=activiate&who=" . $visitor['user_id'] . "&whatchannel=" . $visitor['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "&needaction=1>" . $lang['Activate'] . "</a>]\n"; if (!in_array($visitor['user_id'], $ignorelist_array)) { $actionlink .= "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$updated_ignore}&numchats={$numchatsnow}&operators={$operators}&showvisitors=" . $UNTRUSTED['showvisitors'] . ">" . $lang['Ignore'] . "</a>]\n"; $onload = " setTimeout(\"tellme(0);\",500); "; $chatrequests++; if ($user_alert == "N" || $user_alert == "") { $soundwav = "<SCRIPT type=\"text/javascript\">\n"; $soundwav .= "var MSIE=navigator.userAgent.indexOf(\"MSIE\");\n"; $soundwav .= "var NETS=navigator.userAgent.indexOf(\"Netscape\");\n"; $soundwav .= "var OPER=navigator.userAgent.indexOf(\"Opera\");\n"; $soundwav .= "if((MSIE>-1) || (OPER>-1)) {\n"; $soundwav .= "document.write(\"<BGSOUND SRC=sounds/{$alertchat} LOOP=1>\");\n"; $soundwav .= "} else {\n"; $soundwav .= "document.write(\"<EMBED SRC=sounds/{$alertchat} AUTOSTART=TRUE HIDDEN=true VOLUME=100 LOOP=FALSE><noembed><BGSOUND SRC={$alertchat} LOOP=1></noembed>\");\n"; $soundwav .= "}\n"; $soundwav .= "</SCRIPT>\n"; $stuffatbottom .= "\n<SCRIPT type=\"text/javascript\">top.status=\"[activate]\";top.status=\"\"; setTimeout(\"tellme(0);\",1500); </SCRIPT>\n"; } } if (!in_array($visitor['user_id'], $ignorelist_array)) { $html .= "<tr><td width=10> {$showedup} </td><td nowrap=nowrap><table><tr><td>{$chatting}</td><td><a href=javascript:seepages(" . $visitor['user_id'] . ") onMouseOver=\"try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $visitor['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $visitor['username'] . "'); } catch(dam){} return true;\">" . $visitor['username'] . "</a> {$actionlink} </td></tr></table></td></tr>\n"; } else { $html .= "<tr bgcolor=#DDDDDD><td width=10> {$showedup} </td><td nowrap=nowrap><table><tr><td>{$chatting}</td><td><a href=javascript:seepages(" . $visitor['user_id'] . ") onMouseOver=\"try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $visitor['username'] . "');} catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $visitor['username'] . "'); } catch(dam){} return true;\">" . $visitor['username'] . "</a> {$actionlink} </td></tr></table></td></tr>\n"; } $chatrequests++; $sqlquery = "SELECT * from livehelp_users WHERE sessionid='" . $visitor['sessionid'] . "'"; $user_info = $mydatabase->query($sqlquery); $user_info = $user_info->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "' Order by whendone DESC LIMIT 1"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $visitor['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $DIVS .= "<DIV ID=\"info-" . $visitor['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n <TABLE BORDER=\"0\" WIDTH=\"250\"><TR BGCOLOR=\"#000000\"><TD> \n <TABLE BORDER=\"0\" WIDTH=\"248\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n <FONT COLOR=\"#000000\">\n <b>" . $lang['referer'] . ":</b><br>" . $user_info['camefrom'] . "<br>\n <b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n <b>Url:</b><br><a href=" . $page['location'] . " target=_blank>" . $page['location'] . "</a><br>"; $now = date("YmdHis"); if ($user_info['lastaction'] == "" || $user_info['lastaction'] < 20002020202020) { $user_info['lastaction'] = $now; } $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['txt65'] . ":</b><br>{$thediff} Seconds ago<br> \n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; } } } if ($chatrequests == 0) { $html .= "<tr><td>" . $lang['txt231'] . "</td></tr>"; } $html .= "</table>"; //------------------------------------------------------------------------ $html .= "<table width=100% bgcolor=" . $color_alt2 . "><tr>"; $sqlquery = "SELECT * FROM livehelp_users WHERE status='chat' AND isoperator='N'"; $chatcheck = $mydatabase->query($sqlquery); $numchatnow = $chatcheck->numrows(); while ($visitor = $chatcheck->fetchRow(DB_FETCHMODE_ASSOC)) { $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $visitor['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() == 0 && !in_array($visitor['user_id'], $ignorelist_array)) { $UNTRUSTED['hidechatters'] = 0; } } if ($UNTRUSTED['hidechatters'] == 1) { $html .= "<td width=20><a href=admin_users_refresh.php?hidechatters=0&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators=" . $UNTRUSTED['operators'] . "&hidechatters=0><img src=images/plus.gif border=0></a></td>"; } else { $html .= "<td width=20><a href=admin_users_refresh.php?hidechatters=1&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators=" . $UNTRUSTED['operators'] . "&hidechatters=1><img src=images/minus.gif border=0></a></td>"; } $html .= "<td><b> " . $lang['chat_text'] . " </b></td></tr></table>"; $prev = mktime(date("H"), date("i") - 4, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); // select out all of the operators that are online chatting: $sqlquery = "SELECT * FROM livehelp_users WHERE status='chat' ORDER by showedup"; $chatcheck = $mydatabase->query($sqlquery); $numchatnow = $chatcheck->numrows(); $chatboxes = 0; $html .= "<table width=100% cellpadding=0 cellspacing=0 border=0>"; if ($UNTRUSTED['hidechatters'] != 1) { if ($chatcheck->numrows() == 0) { $html .= "<tr><td>" . $lang['no_chat'] . "</td></tr>"; } $sqlquery = "SELECT * FROM livehelp_users WHERE isonline='Y' and isoperator='Y' ORDER by username"; $chatcheck = $mydatabase->query($sqlquery); while ($operatorsarray = $chatcheck->fetchRow(DB_FETCHMODE_ASSOC)) { $actionlink = ""; $chatting = ""; // Operators can be on multiple channels so see if one of the channels they are on is one we are on. $foundcommonchannel = 0; $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE user_id='" . $operatorsarray['user_id'] . "'"; $mychannels = $mydatabase->query($sqlquery); while ($rowof = $mychannels->fetchRow(DB_FETCHMODE_ASSOC)) { $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE user_id='{$myid}' And channel='" . $rowof['channel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() != 0) { $foundcommonchannel = $rowof['channel']; } } if ($foundcommonchannel == 0) { $chatting = "<img src=images/noton.gif width=19 height=18 border=0>"; if ($myid != $operatorsarray['user_id']) { $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators={$operators}&action=activiate&who=" . $operatorsarray['user_id'] . "&whatchannel=" . $operatorsarray['onchannel'] . "&conferencein=yes&showvisitors=" . $UNTRUSTED['showvisitors'] . "><font color=007700>" . $lang['begin'] . "</font></a>]\n"; } else { $actionlink = ""; $chatting = "<img src=images/active.gif width=19 height=18 border=0>\n"; } } else { $chatting = "<table cellpadding=0 cellspacing=0 border=0 bgcolor=" . $rowof['txtcolor_alt'] . "><tr><td><img src=images/active.gif width=19 height=18 border=0></td></tr></table>\n"; if ($operatorsarray['user_id'] != $myid) { $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators={$operators}&action=leave&who=" . $operatorsarray['user_id'] . "&whatchannel={$foundcommonchannel}&clearchannel=N&showvisitors=" . $UNTRUSTED['showvisitors'] . ">" . $lang['stop_chat'] . "</a>]\n"; } } if ($myid != $operatorsarray['user_id']) { $html .= "<tr><td width=21><img src=images/operator.gif width=21 height=20 border=0></td><td colspan=3><table><tr><td>{$chatting}</td><td width=90% align=left> <b>" . $operatorsarray['username'] . "</b> {$actionlink} </td></tr></table></td></tr>\n"; } else { $lasthtml = "<tr><td width=21><img src=images/operator.gif width=21 height=20 border=0></td><td colspan=3><table><tr><td>{$chatting}</td><td width=90% align=left> <b>" . $operatorsarray['username'] . "</b> {$actionlink} </td></tr></table></td></tr>\n"; } // show all the operators chats: $q = "SELECT livehelp_users.* FROM livehelp_users,livehelp_operator_channels WHERE livehelp_users.user_id=livehelp_operator_channels.userid AND livehelp_users.status='chat' AND livehelp_operator_channels.user_id=" . $operatorsarray['user_id'] . " ORDER by showedup"; $sth = $mydatabase->query($q); while ($chatters = $sth->fetchRow(DB_FETCHMODE_ASSOC)) { // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $chatters['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($data_check->numrows() == 0) { // we are not in the department that this user is chatting in.. } else { // see if we are chatting with them $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE user_id='{$myid}' And channel='" . $chatters['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); $checkbox = ""; $actionlinkouter = ""; if ($counting->numrows() == 0) { $chatting = "<img src=images/noton.gif width=19 height=18 border=0>"; $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators={$operators}&action=activiate&who=" . $chatters['user_id'] . "&whatchannel=" . $chatters['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "&conferencein=yes><font color=007700>Join Chat</font></a>]\n"; $actionlinkouter = $actionlink; } else { $chatboxes++; $rowof = $counting->fetchRow(DB_FETCHMODE_ASSOC); $chatting = "<table cellpadding=0 cellspacing=0 border=0 bgcolor=" . $rowof['channelcolor'] . "><tr><td><img src=images/active.gif width=19 height=18 border=0></td></tr></table>\n"; $actionlink = ""; $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $chatters['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() > 1) { $actionlink = "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators={$operators}&action=leave&who=" . $chatters['user_id'] . "&whatchannel=" . $chatters['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . ">Un-Conference</a>]\n "; } $checkbox = "<input type=checkbox name=session__" . $chatters['user_id'] . " value=" . $chatters['sessionid'] . " border=0>"; $actionlink .= "[<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators={$operators}&action=stop&who=" . $chatters['user_id'] . "&whatchannel=" . $chatters['onchannel'] . "&showvisitors=" . $UNTRUSTED['showvisitors'] . "><font color=990000>" . $lang['stop'] . "</font></a>]\n"; } // see if anyone is chatting with this person. $sqlquery = "SELECT * FROM livehelp_operator_channels WHERE channel='" . $chatters['onchannel'] . "'"; $counting = $mydatabase->query($sqlquery); if ($counting->numrows() == 0 && !in_array($chatters['user_id'], $ignorelist_array)) { } else { if ($myid != $operatorsarray['user_id']) { $html .= "<tr bgcolor=#EFEFEF><td> </td><td><img src=images/blank.gif width=5 height=5 border=0></td><td nowrap=nowrap>{$chatting}</td><td width=90% align=left><a href=javascript:seepages(" . $chatters['user_id'] . ") onMouseOver=\" try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $chatters['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $chatters['username'] . "');} catch(dam){} return true;\">" . $chatters['username'] . "</a> {$actionlinkouter} </td></tr>\n"; } else { $lasthtml .= "<tr bgcolor=#EFEFEF><td> </td><td>{$checkbox}</td><td nowrap=nowrap>{$chatting}</td><td width=90% align=left><a href=javascript:seepages(" . $chatters['user_id'] . ") onMouseOver=\"try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $chatters['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $chatters['username'] . "'); } catch(dam){} return true;\">" . $chatters['username'] . "</a> {$actionlink} </td></tr>\n"; } } } $sqlquery = "SELECT * from livehelp_users WHERE sessionid='" . $chatters['sessionid'] . "'"; $user_info = $mydatabase->query($sqlquery); $user_info = $user_info->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $chatters['sessionid'] . "' Order by whendone DESC LIMIT 1"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $chatters['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $DIVS .= "<DIV ID=\"info-" . $chatters['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n<TABLE BORDER=\"0\" WIDTH=\"250\"><TR BGCOLOR=\"#000000\"><TD> \n<TABLE BORDER=\"0\" WIDTH=\"248\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n<FONT COLOR=\"#000000\">\n<b>" . $lang['referer'] . ":</b><br>" . $user_info['camefrom'] . "<br>\n<b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n<b>Url:</b><br><a href=" . $page['location'] . " target=_blank>" . $page['location'] . "</a><br>"; $now = date("YmdHis"); if ($user_info['lastaction'] == "" || $user_info['lastaction'] < 20002020202020) { $user_info['lastaction'] = $now; } $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['txt65'] . ":</b><br>{$thediff} " . $lang['Seconds'] . "<br>\n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; } } } $html .= $lasthtml . "</table>"; $html .= "<DIV ID=\"chattersdiv\" STYLE=\"z-index: 2;\">"; if ($UNTRUSTED['hidechatters'] != 1 && $chatboxes > 0) { $html .= "<table cellpadding=0 cellspacing=0 border=0>"; $html .= "<tr><td><img src=images/blank.gif width=18 height=22 border=0></td><td align=left><img src=images/arrow_ltr.gif width=38 height=22><select name=whattodochat onchange=updatepeople(1)>"; $html .= "<option value=\"\">" . $lang['txt207'] . ":</option>"; $html .= "<option value=stop>" . $lang['stop_chat'] . "</option>"; $html .= "<option value=transfer>" . $lang['transfer_chat'] . "</option>"; $html .= "<option value=conference>" . $lang['conference_chats'] . "</option>"; $html .= "</select> <a href=javascript:updatepeople(1)><img src=images/go.gif border=0 width=20 height=20></a></td></tr>"; $html .= "</table>"; } $html .= "</DIV>"; ///-------------------------------------------------------------------------------------------------- // get the count of active visitors in the system right now. $timeof = rightnowtime(); $prev = mktime(date("H"), date("i") - 4, date("s"), date("m"), date("d"), date("Y")); $oldtime = date("YmdHis", $prev); $sqlquery = "SELECT * FROM livehelp_users WHERE lastaction>'{$oldtime}' AND status!='chat' AND isoperator!='Y' "; // make list of ignored visitors: $ipadd = explode(",", $CSLH_Config['ignoreips']); for ($i = 0; $i < count($ipadd); $i++) { if (!empty($ipadd[$i])) { $sqlquery .= " AND ipaddress NOT LIKE '" . $ipadd[$i] . "%' "; } } $sqlquery .= " ORDER by lastaction DESC"; $visitors = $mydatabase->query($sqlquery); $onlinenow = $visitors->numrows(); $hiddennow = 0; $html .= "<table width=100% cellpadding=0 cellspacing=0 bgcolor=" . $color_alt2 . "><tr><td>"; if ($UNTRUSTED['showvisitors'] == 1) { $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators=" . $UNTRUSTED['operators'] . "&showvisitors=2><img src=images/minus.gif border=0></a>"; } else { $html .= "<a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators=" . $UNTRUSTED['operators'] . "&showvisitors=1><img src=images/plus.gif border=0></a>"; } if ($UNTRUSTED['showvisitors'] == 1) { $html .= "</td><td><b>" . $lang['visit'] . " <font color=007700>[onlinenow] " . $lang['online'] . "</font> <font color=777777>[hiddennow] " . $lang['Hidden'] . "</font> </td></tr></table>"; $html .= "<table width=100%><tr bgcolor={$color_background}><td> </td><td><b>ID</b></td><td><b>" . $lang['status'] . ":</b></td><td><b>pages</b></td>"; if ($CSLH_Config['maxrequests'] < 9999) { $html .= "<td>rq#</td>"; } $html .= "</tr>"; while ($visitor = $visitors->fetchRow(DB_FETCHMODE_ASSOC)) { $chatting = ""; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $visitor['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($visitor['department'] != 0 && $data_check->numrows() == 0) { $hiddennow++; $onlinenow--; } else { if (empty($visitor['user_alert'])) { $visitor['user_alert'] = 0; } if ($visitor['isoperator'] != "Y" && $visitor['user_alert'] != 1) { $onload = " setTimeout(\"doorbell();\",700); "; if ($user_alert == "N" || $user_alert == "") { if ($show_arrival != "N") { $insitewav = "<SCRIPT type=\"text/javascript\">\n"; $insitewav .= "var MSIE=navigator.userAgent.indexOf(\"MSIE\");\n"; $insitewav .= "var NETS=navigator.userAgent.indexOf(\"Netscape\");\n"; $insitewav .= "var OPER=navigator.userAgent.indexOf(\"Opera\");\n"; $insitewav .= "if((MSIE>-1) || (OPER>-1)) {\n"; $insitewav .= "document.write(\"<BGSOUND SRC=sounds/" . $alertinsite . " LOOP=1>\");\n"; $insitewav .= "} else {\n"; $insitewav .= "document.write(\"<EMBED SRC=sounds/" . $alertinsite . " AUTOSTART=TRUE HIDDEN=true VOLUME=100 LOOP=FALSE><noembed><BGSOUND SRC=" . $alertinsite . " LOOP=1></noembed>\");\n"; $insitewav .= "}\n"; $insitewav .= "</SCRIPT>\n"; } } $sql = "UPDATE livehelp_users SET user_alert='1' WHERE user_id='" . $visitor['user_id'] . "' "; $mydatabase->query($sql); } $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "'"; $my_count = $mydatabase->query($sqlquery); $my_count = $my_count->numrows(); $html .= "<tr><td width=10><input type=checkbox name=session__" . $visitor['user_id'] . " value=" . $visitor['sessionid'] . " border=0></td><td>"; $html .= "<a href=javascript:seepages(" . $visitor['user_id'] . ") onMouseOver=\" try { hide('visitorsdiv');hide('chattersdiv');show(event, 'info-" . $visitor['username'] . "'); } catch(dam){} return true;\" onMouseOut=\"try { showit('chattersdiv');showit('visitorsdiv');hide('info-" . $visitor['username'] . "'); } catch(dam){} return true;\">" . $visitor['username'] . "</a>"; $sqlquery = "SELECT * from livehelp_users WHERE user_id='" . $visitor['user_id'] . "'"; $user_info = $mydatabase->query($sqlquery); $user_info = $user_info->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_visit_track WHERE sessionid='" . $visitor['sessionid'] . "' Order by whendone DESC"; $page_trail = $mydatabase->query($sqlquery); $page = $page_trail->fetchRow(DB_FETCHMODE_ASSOC); $sqlquery = "SELECT * from livehelp_departments WHERE recno='" . $visitor['department'] . "'"; $tmp = $mydatabase->query($sqlquery); $nameof = $tmp->fetchRow(DB_FETCHMODE_ASSOC); $nameof = $nameof['nameof']; $query = "SELECT whendone from livehelp_visit_track WHERE sessionid='" . filter_sql($visitor['sessionid']) . "' Order by whendone LIMIT 1"; $page_tmprow = $mydatabase->query($query); $tmprow = $page_tmprow->fetchRow(DB_FETCHMODE_ASSOC); $later = $tmprow['whendone']; $DIVS .= "<DIV ID=\"info-" . $visitor['username'] . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n<TABLE BORDER=\"0\" WIDTH=\"300\"><TR BGCOLOR=\"#000000\"><TD> \n<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=0 CELLSPACING=0 BORDER=0><TR><TD width=1 BGCOLOR=#" . $color_alt2 . "><img src=images/blank.gif width=7 height=120></TD><TD BGCOLOR=\"#" . $color_alt2 . "\" valign=top>\n<FONT COLOR=\"#000000\">\n<b>Referer:</b><br>" . $user_info['camefrom'] . "<br>"; if (empty($page['location'])) { $page['location'] = ""; } $DIVS .= "<b>" . $lang['timeonline'] . ":</b>" . secondstoHHmmss(timediff($later, date("YmdHis"))) . "<br> \n<b>" . $lang['txt43'] . ":</b><br>{$nameof}<br>\n<b>url:</b><br>" . $page['location'] . "<br>"; $now = date("YmdHis"); $thediff = $now - $user_info['lastaction']; $DIVS .= "<b>" . $lang['lastact'] . ":</b><br>{$thediff} " . $lang['Seconds'] . "<br>\n </FONT></TD></TR></TABLE></TD></TR></TABLE></DIV>"; $html .= "</td>"; switch ($visitor['status']) { case "DHTML": $html .= "<td>L:<img src=images/invited.gif> "; break; case "request": $html .= "<td>P:<img src=images/invited.gif> "; break; case "invited": $html .= "<td><img src=images/invited2.gif> "; break; case "qna": $html .= "<td><img src=images/qna.gif>"; break; case "stopped": $html .= "<td><img src=images/stopped.gif> "; break; case "message": $html .= "<td><img src=images/message.gif> "; break; default: $html .= "<td><a href=layer.php?selectedwho=" . $visitor['user_id'] . " target=_blank>" . $lang['invite'] . "</a> "; break; } $html .= "</td>"; $html .= "<td>{$my_count}</td>"; if ($CSLH_Config['maxrequests'] < 9999) { if ($user_info['visits'] > $CSLH_Config['maxrequests'] - 16) { if ($user_info['visits'] < $CSLH_Config['maxrequests']) { $html .= "<td><font color=#770000>" . $user_info['visits'] . "</font><br><a href=javascript:resetpages(" . $visitor['user_id'] . ")>reset</a></td>"; } else { $html .= "<td><font color=#CC0000><b>" . $user_info['visits'] . "</b></font><br><a href=javascript:resetpages(" . $visitor['user_id'] . ")>reset</a></td>"; } } else { $html .= "<td>" . $user_info['visits'] . "</td>"; } } $html .= "</tr>"; } } $html = str_replace("[onlinenow]", $onlinenow, $html); $html = str_replace("[hiddennow]", $hiddennow, $html); $html .= "</table>"; $html .= "<DIV ID=\"visitorsdiv\" STYLE=\"z-index: 2;\">"; if ($onlinenow > 0) { $html .= "<table>"; $html .= "<tr><td><img src=images/arrow_ltr.gif width=38 height=22><select name=whattodo onchange=updatepeople(2)>"; $html .= "<option value=\"\">" . $lang['txt207'] . ":</option>"; $html .= "<option value=DHTML>" . $lang['Invite'] . ":" . $lang['layer'] . "</option>"; $html .= "<option value=pop>" . $lang['Invite'] . ":" . $lang['popup'] . "</option>"; $html .= "</select> <a href=javascript:updatepeople(2)><img src=images/go.gif border=0 width=20 height=20></a></td></tr>"; $html .= "</table><center><a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators=" . $UNTRUSTED['operators'] . "&showvisitors=2>" . $lang['txt208'] . "</a><br></center>"; } $html .= "</DIV>"; } else { while ($visitor = $visitors->fetchRow(DB_FETCHMODE_ASSOC)) { $chatting = ""; // see if we are in the same department as this user.. $sqlquery = "SELECT * FROM livehelp_operator_departments WHERE user_id='{$myid}' AND department='" . $visitor['department'] . "' "; $data_check = $mydatabase->query($sqlquery); if ($visitor['department'] != 0 && $data_check->numrows() == 0) { $hiddennow++; $onlinenow--; } } $html .= "</td><td><b>" . $lang['visit'] . " <font color=007700>{$onlinenow} " . $lang['online'] . "</font> <font color=777777>{$hiddennow} " . $lang['Hidden'] . "</font></b></td></tr></table>"; $html .= "<table width=100%><tr bgcolor={$color_background}><td colspan=4 align=center><font color=#990000><i>" . $lang['Hidden'] . "</i></a></font><br><a href=admin_users_refresh.php?hidechatters=" . $hidechatters . "&ignorelist={$ignorelist}&numchats={$numchatsnow}&operators=" . $UNTRUSTED['operators'] . "&showvisitors=1>" . $lang['txt209'] . "</a></td></tr></table>"; } $html = $html . $DIVS; return $html; }