Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Stuff
Saturday, February 20th, 2010 at 1:57:27pm MST 

  1. <?PHP
  2.  
  3. /********************************************/
  4. # Widgets Beta 0.1
  5. # An Iteractive Logging system for Mu Online
  6.  
  7. # Created by john_d
  8. # Site: http://www.mmowebs.com/
  9. # if you delete this you're a douche.
  10.  
  11. /********************************************/
  12. $_config['APPL_NAME'] = 'Widgets';
  13.  
  14. include('config.php');
  15. include('includes/functions.php');
  16. include('includes/dbconnect.php');
  17. include_once $_config['server_type'].'/define.php';
  18. $PREFIX = 'GAMESERVER.';
  19. //$db->debug=1;
  20. $db->Execute('SET ANSI_NULLS ON');
  21. $db->Execute('SET ANSI_WARNINGS ON');
  22.  
  23. define('_Stats01',"select distinct Login, count(*) as COUNT from cabal_auth_table group by Login");
  24. define('_Stats03',"Select count(*) as COUNT from cabal_character_table");
  25. define('_Stats04',"Select count(*) as COUNT from Guild");
  26. define('_WTOP_HERO',"select NAME,Lev,RESETS,style,CharacterIDX from  cabal_character_table where nation != 3 order by RESETS desc, lev desc");
  27. define('_WTOP_GUILD',"select GUILDNAME, GUILDNO, ( select count(*) from  GuildMember as gm where gm.GuildNo = g.GuildNo )  as MEMB from Guild as g order by MEMB desc");
  28.  
  29. switch(@$_GET['callback']){
  30. case 'servstats':
  31.        
  32.         //$gs =  @fsockopen($_config[0]['ip'], $_config[0]['gs_port'], $errno, $errstr,0.5);
  33.  
  34.  
  35.  
  36.  $rs = $db->Execute(_Stats01);
  37. // $login = array('Logout','Logined');
  38.         foreach ($rs as $row) {
  39.         if ($row['LOGIN'] ==1) $stats['Logined'] = $row['COUNT'];
  40.         else $stats['Logined'] = 0;
  41.         $total += $row['COUNT'];
  42.         }
  43.         $stats['Accounts'] =$total;
  44.  
  45.  
  46.         $rs = $db2->Execute(_Stats03);
  47.         $row = $rs->FetchRow();
  48.         $stats['Characters'] = $row['COUNT'];
  49.  
  50.  
  51.         $rs = $db2->Execute(_Stats04);
  52.         $row = $rs->FetchRow();
  53.         $stats['Guilds'] = $row['COUNT'];
  54.        
  55.  
  56.         switch (@$_GET['style']) {
  57.                 default:
  58.                 case 'inline':
  59.                 echo 'document.write(\'<div class="mulabel">';
  60.                 foreach ($stats as $s1 => $s) echo ' <label>'.$s1.':</label> <b>'.$s.'</b>';
  61.                 echo '</div>\');';
  62.  
  63.                 break;
  64.                 case 'li':
  65.                 case '2':
  66.                 echo 'document.write(\'<ul class="mulabel">';
  67.                 foreach ($stats as $s1 => $s) echo ' <li>'.$s1.': <b>'.$s.'</b></li>';
  68.                 echo '</ul>\');';
  69.  
  70.  
  71.                 break;
  72.                 case 'json':
  73.                 echo 'servStats({"data":[';
  74.                 foreach ($stats as $s1 => $s) echo '{"label":"'.$s1.'","value":"'.$s.'"},';
  75.  
  76.                 echo '{}]})';
  77.  
  78.                 break;
  79.        
  80.         }
  81.   break;
  82.   case 'tophero':
  83.         $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
  84.         $rs = $db2->SelectLimit(_WTOP_HERO, $top,0,array() );
  85.         $row = $rs->GetArray();
  86.         $result =  array();
  87.         foreach ($row as $r1 => $r) {
  88.                         $style = decode_style($r['style']);
  89.                         $result[$r1]['CL'] = $style['Class'];
  90.                         $result[$r1]['CLNO'] =  $style['Class_Name'];
  91.                         foreach ($r as $r2 => $r3)
  92.                                 if (ctype_upper($r2)) $result[$r1][$r2] = $r3;        
  93.         }
  94.         echo 'topHero({"CharList":'.array2json($result).'})'; 
  95.   break;
  96.   case 'topguild':
  97.   $db->debug=1;
  98.         $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
  99.         $rs = $db2->SelectLimit(_WTOP_GUILD,$top,0,array());
  100.         $row = $rs->GetArray();
  101.         $result =  array();
  102.         foreach ($row as $r1 => $r) {
  103.                
  104.                         //$result[$r1]['GMARK'] = urlencode(bin2hex($r['G_MARK']));;
  105.                         foreach ($r as $r2 => $r3)
  106.                                 if (ctype_upper(preg_replace('/_/i','',$r2))) $result[$r1][$r2] = $r3;        
  107.         }
  108.         echo 'topGuilds({"GuildList":'.array2json($result).'})'; 
  109.   break;
  110.  
  111.   default:
  112.     $rs = $db->Execute(_Stats01);
  113. // $login = array('Logout','Logined');
  114.         foreach ($rs as $row) {
  115.         if ($row['LOGIN'] ==1) $stats['Logined'] = $row['COUNT'];
  116.         else $stats['Logined'] = 0;
  117.         $total += $row['COUNT'];
  118.         }
  119.         $stats['Accounts'] =$total;
  120.         $rs = $db2->Execute(_Stats03);
  121.         $row = $rs->FetchRow();
  122.         $stats['Characters'] = $row['COUNT'];
  123.         $rs = $db2->Execute(_Stats04);
  124.         $row = $rs->FetchRow();
  125.         $stats['Guilds'] = $row['COUNT'];
  126.         $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
  127.         $rs = $db2->SelectLimit(_WTOP_HERO, $top,0,array() );
  128.         $row = $rs->GetArray();
  129.         $cresult =  array();
  130.         foreach ($row as $r1 => $r) {
  131.                
  132.                         $style = decode_style($r['style']);
  133.                         $cresult[$r1]['CL'] = $style['Class'];
  134.                         $cresult[$r1]['CLNO'] =  $style['Class_Name'];
  135.                         foreach ($r as $r2 => $r3)
  136.                                 if (ctype_upper($r2)) $cresult[$r1][$r2] = $r3;      
  137.         }
  138.         $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
  139.         $rs = $db2->SelectLimit(_WTOP_GUILD,$top,0,array());
  140.         $row = $rs->GetArray();
  141.         $result =  array();
  142.         foreach ($row as $r1 => $r) {
  143.                         foreach ($r as $r2 => $r3)
  144.                                 if (ctype_upper(preg_replace('/_/i','',$r2))) $result[$r1][$r2] = $r3;        
  145.         }
  146.        
  147.         $result = array('GuildList'=>$result,'CharList'=>$cresult,'Stats'=>$stats);
  148.         echo 'srvFeed('.array2json($result).')'; 
  149.  
  150.   break;
  151. }
  152. $db->close;
  153. $db2->close;
  154.  
  155.  
  156.  
  157.  
  158.  
  159. ?>

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right