Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stats.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. require_once('config.php');
  3. include_once('classes/SmartIRC.php');
  4. $irc = &new Net_SmartIRC();
  5. //$irc->startBenchmark();
  6. //$irc->setDebug(SMARTIRC_DEBUG_ALL);
  7. $irc->setUseSockets(TRUE);
  8. //$irc->setBenchmark(TRUE);
  9. $irc->connect($CONF['irc_network'], $CONF['irc_port']);
  10. $irc->login($CONF['irc_nick'], $CONF['irc_realname'], 0, $CONF['irc_nick'], $CONF['irc_pass']);
  11. $irc->getList($CONF['irc_channel']);
  12. $result_count = $irc->listenFor(SMARTIRC_TYPE_LIST);
  13. $irc->disconnect();
  14. //$irc->stopBenchmark();
  15. if (is_array($result_count)) {
  16. $ircdata = $result_count[0];
  17. $count = $ircdata->rawmessageex[4];
  18. $topic = "";
  19. for ($i = 6; $i < sizeof($ircdata->rawmessageex); $i++)
  20. {
  21. $topic .= " ".$ircdata->rawmessageex[$i];
  22. }
  23. //$topic = mirc2html(trim($topic));
  24. $topic = preg_replace_callback("/(\x03)(\d\d?,\d\d?|\d\d?)(\s?.*?)(?(?=\x03)|$)/","color_rep",trim($topic));
  25. $irc_data = $db->select('irc', "1=? ORDER BY id DESC LIMIT 1", array("1"));
  26. if ($irc_data['max_nicks'] < $count)
  27. {
  28. $max_count = $count;
  29. }
  30. else
  31. {
  32. $max_count = $irc_data['max_nicks'];
  33. }
  34. if (empty($topic))
  35. {
  36. $topic = $irc_data['topic'];
  37. }
  38. $db->insert(array('max_nicks' => $max_count, 'cur_nicks' => $count, 'topic' => $topic, 'check_date' => date("Y-m-d H:i:s",time())), 'irc');
  39. }
  40. ?>