[Znote AAC] Simple serverinfo

Discussion in 'Website Applications' started by Raggaer, Sep 17, 2012.

Tags:
  1. Raggaer

    Raggaer Godly Member

    Joined:
    Jul 25, 2012
    Messages:
    1,521
    Likes Received:
    865
    Best Answers:
    8
    I made this simple serverinfo page to practise skills, to install you need to configure your server path in
    *Note: this will just work with servers using exp stages, ( lazy )

    PHP:
    1. $path = 'C:\Users\Asus\Desktop\Daneria Land';
    add your path.

    - Photo -

    Untitled-2.jpg

    - Install -

    Add this to your serverinfo page ( erase all first )

    PHP:
    1. <?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
    2.  
    3. <h1>Server Information</h1>
    4. <?php
    5.  
    6. $path = 'C:\Users\Asus\Desktop\Daneria Land';
    7. echo '<table cellpadding="0"><tr class="yellow"><td><center>From level</center></td><td><center>To level</center></td><td><center>Rate</center></td></tr>';
    8. if (is_dir($path)) {
    9.  
    10.    
    11.     $xml1 = simplexml_load_file($path."\data\xml\stages.xml");
    12.     foreach ($xml1->world->children() as $stage1) {
    13.         if ($stage1['maxlevel'] == '') {
    14.         $stage1['maxlevel'] = 'Infinite';  
    15.         }
    16.         echo '<tr><td><center>'.$stage1['minlevel'].'</center></td><td><center>'.$stage1['maxlevel'].'</center></td><td><center>'.$stage1['multiplier'].'</center></td></tr>'; 
    17.         }
    18.     $word = 'a';
    19.     $loadconfig = file($path.'\config.lua');
    20.     $key = 'rateMagic';
    21.     $key2 = 'rateLoot';
    22.     $key3 = 'rateSkill';
    23.     $found = false;
    24.     foreach ($loadconfig as $lineNumber => $e) {
    25.     if (strpos($e,$key) !== false) {
    26.        $found = true;
    27.        break;
    28.     }
    29. }
    30.  
    31.     foreach ($loadconfig as $lineNumberr => $ee) {
    32.     if (strpos($ee,$key2) !== false) {
    33.        $found = true;
    34.        break;
    35.     }
    36. }
    37.  
    38.     foreach ($loadconfig as $lineNumberrr => $eee) {
    39.     if (strpos($eee,$key3) !== false) {
    40.        $found = true;
    41.        break;
    42.     }
    43. }
    44.  
    45. if ($found) {
    46.    echo '<table cellpadding="0"><tr class="yellow"><td><center>Magic rate</center></td><td><center>Skills rate</center></td><td><center>Loot rate</center></td></tr>';
    47.    echo '<tr><td><center>'.$loadconfig[$lineNumber].'</center></td><td><center>'.$loadconfig[$lineNumberrr].'</center></td><td><center>'.$loadconfig[$lineNumberr].'</center></td></tr>';
    48. }
    49.    
    50.     $getallplayers = mysql_query("SELECT COUNT(*) as MAX FROM players");
    51.     $parseallplayers = mysql_fetch_assoc($getallplayers);
    52.     $getallaccounts = mysql_query("SELECT COUNT(*) as MEX FROM accounts");
    53.     $parseallaccounts = mysql_fetch_assoc($getallaccounts);
    54.     $getallguilds = mysql_query("SELECT COUNT(*) as MOX FROM guilds");
    55.     $parseallguilds = mysql_fetch_assoc($getallguilds);
    56.    
    57.     echo '</table></tr>';
    58.     echo '<table cellpadding="0"><tr class="yellow"><td><center>Total accounts</center></td><td><center>Total players</center></td><td><center>Total guilds</center></td></tr>';
    59.     echo '<tr><td><center>'.$parseallplayers['MAX'].'</center></td><td><center>'.$parseallaccounts['MEX'].'</center></td><td><center>'.$parseallguilds['MOX'].'</center></td></tr>';
    60.     echo '</table></tr>';
    61.    
    62.     $talkactions = simplexml_load_file($path.'/data/talkactions/talkactions.xml');
    63.     echo '<table cellpadding="0"><tr class="yellow"><td><center>Player commands</center></td></center></tr>';
    64.     foreach ($talkactions as $commands) {
    65.         if (empty($commands['access'])) {
    66.     echo '<center><tr><td><center>'.$commands['words'].'</center></td></tr></center>';
    67.         }
    68.     }
    69.     echo '</table></tr>';
    70.    
    71. } else {
    72.    
    73. echo '<br><b>Invalid path!</b>';
    74.    
    75. }
    76. ?>
    77. <?php include 'layout/overall/footer.php'; ?>
    Tested and 0 errors showed up
     
  2. Znote

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    Approved.

    Looks great. :)

    Got something to learn here, never used XML with PHP before. :p
     
  3. Evan

    Evan A splendid one to behold Premium User

    Joined:
    May 6, 2009
    Messages:
    7,010
    Likes Received:
    944
    Best Answers:
    0
    Should check if stages is on/off.
    If it's off, there's no reason to display the information and confuse the players.
     
  4. Raggaer

    Raggaer Godly Member

    Joined:
    Jul 25, 2012
    Messages:
    1,521
    Likes Received:
    865
    Best Answers:
    8

    I was thinking on that but it was late,, xD
     
  5. gelendizer

    gelendizer The ass kicker

    Joined:
    Nov 2, 2011
    Messages:
    335
    Likes Received:
    10
    Best Answers:
    0
  6. Elexonic

    Elexonic Well-Known Member

    Joined:
    Jun 18, 2008
    Messages:
    1,919
    Likes Received:
    54
    Best Answers:
    0
    Very god =)
    Just missing the frags for my taste
    solo faltaria para mi gusto las frags,red,black,duracion etc.
     
  7. Esparda

    Esparda Member

    Joined:
    Jun 9, 2008
    Messages:
    188
    Likes Received:
    9
    Best Answers:
    0
    thx but dont show talkaction i dont know why i use otx 2.2
     
  8. Raggaer

    Raggaer Godly Member

    Joined:
    Jul 25, 2012
    Messages:
    1,521
    Likes Received:
    865
    Best Answers:
    8
    $path = 'C:\Users\Asus\Desktop\Daneria Land';
    add your path?
     
  9. Esparda

    Esparda Member

    Joined:
    Jun 9, 2008
    Messages:
    188
    Likes Received:
    9
    Best Answers:
    0
    yeah show the rest of info but the talkactions dont appear

    web.jpg

    i use itx based on tfs_03
     
  10. Bica

    Bica Member

    Joined:
    Jul 22, 2009
    Messages:
    555
    Likes Received:
    20
    Best Answers:
    0
    Here is the point, we're always learn something from others :)
     
  11. killing

    killing Member

    Joined:
    Feb 23, 2012
    Messages:
    817
    Likes Received:
    7
    Best Answers:
    0
  12. Dyabl0

    Dyabl0 Dyablo

    Joined:
    Sep 22, 2009
    Messages:
    1,867
    Likes Received:
    273
    Best Answers:
    9
    Awesome! Worked =)
     
  13. Dalt0n

    Dalt0n Hiho:)

    Joined:
    Dec 14, 2011
    Messages:
    536
    Likes Received:
    29
    Best Answers:
    0
    Excellent raggaer, thanks for this;)
     
  14. edycerpa

    edycerpa New Member

    Joined:
    May 5, 2009
    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    I got this error =(
    Screenshot_3.jpg
     
  15. Esparda

    Esparda Member

    Joined:
    Jun 9, 2008
    Messages:
    188
    Likes Received:
    9
    Best Answers:
    0
    you can hide the warning with
    Code (Text):
    1. error_reporting(0);
    after the top <?php
     
  16. Master-m

    Master-m Need help? Just ask!

    Joined:
    May 28, 2007
    Messages:
    4,339
    Likes Received:
    17
    Best Answers:
    0
    or edit the config of the webserver to disable errors. Or even better, fix the code so it doesn't give the warning haha:p
     
  17. edycerpa

    edycerpa New Member

    Joined:
    May 5, 2009
    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    I prefer fix the error, but can works for a while :)

    Yes, I want to fix it, the problem it's: I don't know NOTHING about php hahaha
     
  18. veCt

    veCt New Member

    Joined:
    Jun 7, 2010
    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    wow, thanks!
     
  19. kito2

    kito2 https://mtibia.online

    Joined:
    Mar 9, 2009
    Messages:
    3,582
    Likes Received:
    174
    Best Answers:
    1
    Not working at linux, problem with path.
     
  20. Clorens

    Clorens Member

    Joined:
    Oct 5, 2011
    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    So I installed it and got this error..

    Code (Text):
    1. Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "C:/Users/root/Desktop/swev/config.lua/data/talkactions/talkactions.xml" in C:\xampp\htdocs\serverinfo.php on line 62
    2.  
    3. Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\serverinfo.php on line 64
    Looks like this Swev
     

Share This Page

Loading...