- Stuff
- Saturday, February 20th, 2010 at 1:57:27pm MST
- <?PHP
- /********************************************/
- # Widgets Beta 0.1
- # An Iteractive Logging system for Mu Online
- # Created by john_d
- # Site: http://www.mmowebs.com/
- # if you delete this you're a douche.
- /********************************************/
- $_config['APPL_NAME'] = 'Widgets';
- include('config.php');
- include('includes/functions.php');
- include('includes/dbconnect.php');
- include_once $_config['server_type'].'/define.php';
- $PREFIX = 'GAMESERVER.';
- //$db->debug=1;
- $db->Execute('SET ANSI_NULLS ON');
- $db->Execute('SET ANSI_WARNINGS ON');
- define('_Stats01',"select distinct Login, count(*) as COUNT from cabal_auth_table group by Login");
- define('_Stats03',"Select count(*) as COUNT from cabal_character_table");
- define('_Stats04',"Select count(*) as COUNT from Guild");
- define('_WTOP_HERO',"select NAME,Lev,RESETS,style,CharacterIDX from cabal_character_table where nation != 3 order by RESETS desc, lev desc");
- 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");
- switch(@$_GET['callback']){
- case 'servstats':
- //$gs = @fsockopen($_config[0]['ip'], $_config[0]['gs_port'], $errno, $errstr,0.5);
- $rs = $db->Execute(_Stats01);
- // $login = array('Logout','Logined');
- foreach ($rs as $row) {
- if ($row['LOGIN'] ==1) $stats['Logined'] = $row['COUNT'];
- else $stats['Logined'] = 0;
- $total += $row['COUNT'];
- }
- $stats['Accounts'] =$total;
- $rs = $db2->Execute(_Stats03);
- $row = $rs->FetchRow();
- $stats['Characters'] = $row['COUNT'];
- $rs = $db2->Execute(_Stats04);
- $row = $rs->FetchRow();
- $stats['Guilds'] = $row['COUNT'];
- switch (@$_GET['style']) {
- default:
- case 'inline':
- echo 'document.write(\'<div class="mulabel">';
- foreach ($stats as $s1 => $s) echo ' <label>'.$s1.':</label> <b>'.$s.'</b>';
- echo '</div>\');';
- break;
- case 'li':
- case '2':
- echo 'document.write(\'<ul class="mulabel">';
- foreach ($stats as $s1 => $s) echo ' <li>'.$s1.': <b>'.$s.'</b></li>';
- echo '</ul>\');';
- break;
- case 'json':
- echo 'servStats({"data":[';
- foreach ($stats as $s1 => $s) echo '{"label":"'.$s1.'","value":"'.$s.'"},';
- echo '{}]})';
- break;
- }
- break;
- case 'tophero':
- $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
- $rs = $db2->SelectLimit(_WTOP_HERO, $top,0,array() );
- $row = $rs->GetArray();
- $result = array();
- foreach ($row as $r1 => $r) {
- $style = decode_style($r['style']);
- $result[$r1]['CL'] = $style['Class'];
- $result[$r1]['CLNO'] = $style['Class_Name'];
- foreach ($r as $r2 => $r3)
- if (ctype_upper($r2)) $result[$r1][$r2] = $r3;
- }
- echo 'topHero({"CharList":'.array2json($result).'})';
- break;
- case 'topguild':
- $db->debug=1;
- $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
- $rs = $db2->SelectLimit(_WTOP_GUILD,$top,0,array());
- $row = $rs->GetArray();
- $result = array();
- foreach ($row as $r1 => $r) {
- //$result[$r1]['GMARK'] = urlencode(bin2hex($r['G_MARK']));;
- foreach ($r as $r2 => $r3)
- if (ctype_upper(preg_replace('/_/i','',$r2))) $result[$r1][$r2] = $r3;
- }
- echo 'topGuilds({"GuildList":'.array2json($result).'})';
- break;
- default:
- $rs = $db->Execute(_Stats01);
- // $login = array('Logout','Logined');
- foreach ($rs as $row) {
- if ($row['LOGIN'] ==1) $stats['Logined'] = $row['COUNT'];
- else $stats['Logined'] = 0;
- $total += $row['COUNT'];
- }
- $stats['Accounts'] =$total;
- $rs = $db2->Execute(_Stats03);
- $row = $rs->FetchRow();
- $stats['Characters'] = $row['COUNT'];
- $rs = $db2->Execute(_Stats04);
- $row = $rs->FetchRow();
- $stats['Guilds'] = $row['COUNT'];
- $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
- $rs = $db2->SelectLimit(_WTOP_HERO, $top,0,array() );
- $row = $rs->GetArray();
- $cresult = array();
- foreach ($row as $r1 => $r) {
- $style = decode_style($r['style']);
- $cresult[$r1]['CL'] = $style['Class'];
- $cresult[$r1]['CLNO'] = $style['Class_Name'];
- foreach ($r as $r2 => $r3)
- if (ctype_upper($r2)) $cresult[$r1][$r2] = $r3;
- }
- $top = (ctype_digit($_GET['top'])) && ($_GET['top']<=50) ? $_GET['top'] : 5;
- $rs = $db2->SelectLimit(_WTOP_GUILD,$top,0,array());
- $row = $rs->GetArray();
- $result = array();
- foreach ($row as $r1 => $r) {
- foreach ($r as $r2 => $r3)
- if (ctype_upper(preg_replace('/_/i','',$r2))) $result[$r1][$r2] = $r3;
- }
- $result = array('GuildList'=>$result,'CharList'=>$cresult,'Stats'=>$stats);
- echo 'srvFeed('.array2json($result).')';
- break;
- }
- $db->close;
- $db2->close;
- ?>
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.
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.