php script help please :/

Results 1 to 1 of 1
  1. #1
    Proficient Member ShinyDemon is offline
    MemberRank
    Feb 2008 Join Date
    PlutoLocation
    164Posts

    php script help please :/

    I'm trying to fill in the box's with my information so the server status works on my 127.0.0.1.com website... but some things i dont understand... I think i have to fill in all the stuff next to the arrows to make it work but im not sure. Sorry im such a noob... just trying to learn

    PHP Code:
    <?php
    error_reporting
    (0);
    define("KALSITE""1"true);
    $root substr(getcwd(), 0strlen(getcwd()) - 4);
    include(
    $root."/config.php");
    if(
    $_SERVER['REMOTE_ADDR'] != $config['emulator_ip']) die("Access denied");
    include(
    $root."/includes/class_db.php");
    include(
    $root."/includes/exp_table.php");
    $db = new DataBase();                                  <<<< ? dont understand that
    $db
    ->dbType $config['DBType'];                      <<< dont understand that :/
    $db->odbcDSN "DB";                                      DB hmm
    $db
    ->dbHost $config['MSSQLHost'];              <<guessing its my server name in sql
    $db
    ->dbUser $config['db_User'];                          <<<< sa?
    $db->dbPass $config['db_Pass'];                          <<<<< password for sa login
    $db
    ->odbcAuthDSN $config['odbc_Auth'];                        << KAL_AUTH maybe?
    $db->odbcDbDSN $config['odbc_DB'];                          <<< KAL_DB maybe?
    $db->dbName $config['db_data_Name'];                          <<<< huhxD
    $db
    ->db_Connect();                                       <<<< my server name againo.O?
    $db->db_Select();                                                <<<<<<<<<< O.o?
    include(
    $root."/includes/class_playerinfo.php");
    include(
    $root."/includes/class_kosp.php");
    $kosp = new KOSP();
    $kosp->kosp_host $config['kosp_host'];
    $kosp->kosp_user $config['kosp_user'];
    $kosp->kosp_pass $config['kosp_pass'];
    $kosp->kosp_port $config['kosp_port'];
    $kosp->kosp_timeout $config['kosp_timeout'];
    $kosp->Get_KOSP_Stats();
    if(
    $kosp->playersOnline 0)
    {
     
    $players = array();
     for(
    $i 0$i count($kosp->playerList); $i++)
     {
      
    $temp = new PlayerInfo();
      
    $thePlayer $kosp->playerList[$i];
      
    $player_query $db->db_Query("SELECT * FROM [Player] WHERE [Name] = '$thePlayer'");
      
    $temp->SetInfo($db->db_fetch_array($player_query)); 
      
    $players[] = $temp
     }
    }
    else
    {
     
    $players "<center><b>There are Currently, No Players Online.</b></center>";
    }
    if(
    $kosp->gmOnline 0)
    {
     
    $gamemasters = array();
     for(
    $i 0$i count($kosp->gmList); $i++)
     {
      
    $temp = new PlayerInfo();
      
    $thePlayer $kosp->gmList[$i];
      
    $player_query $db->db_Query("SELECT * FROM [Player] WHERE [Name] = '$thePlayer'");
      
    $temp->SetInfo($db->db_fetch_array($player_query)); 
      
    $gamemasters[] = $temp
     }
    }
    else
    {
     
    $gamemasters "<center><b>There are Currently, No Game Masters Online.</b></center>";
    }
    $total_player_query $db->db_Query("SELECT COUNT(*) FROM [Player]");
    $total_player_result $db->db_fetch_array($total_player_query);
    $total_guild_query $db->db_Query("SELECT COUNT(*) FROM [Guild]");
    $total_guild_result $db->db_fetch_array($total_guild_query);
    $total_guild_member_query $db->db_Query("SELECT COUNT(*) FROM [GuildMember] WHERE [GID] != '0'");
    $total_guild_member_result $db->db_fetch_array($total_guild_member_query);
    $total_gamemaster_query $db->db_Query("SELECT * FROM [Player] WHERE [Admin] != '0'");
    $total_gamemaster 0;
    while(
    $total_gamemaster_result $db->db_fetch_array($total_gamemaster_query))
    {
     
    $total_gamemaster++;
     
    $gamemaster_id[$total_gamemaster_result['PID']] = $total_gamemaster_result['PID'];
    }
    $total_geon_query $db->db_Query("SELECT [Num], [PID] FROM [Item] WHERE [Index] = '31'");
    $total_geons 0;
    while(
    $total_geon_data $db->db_fetch_array($total_geon_query))
    {
     if(!
    in_array($total_geon_data['PID'], $gamemaster_id))
     {
      
    $total_geons += $total_geon_data['Num'];
     }
    }
    $total_guild_members $db->GetVal($total_guild_member_result);
    $total_players $db->GetVal($total_player_result);
    $total_guilds $db->GetVal($total_guild_result);
    $avg_player_guild = @round($total_guild_members $total_guilds);
    $avg_player_geon = @round($total_geons $total_players);
    $content '<table width="95%" border="0" cellspacing="3" cellpadding="3">
    <tr>
    <td><strong>Total Players</strong></td>
    <td>'
    .$total_players.'</td>
    <td><strong>Current Players Online</strong></td>
    <td>'
    .$kosp->playersOnline.'</td>
    <td><strong>Total Currency</strong></td>
    <td>'
    .number_format($total_geons0).'</td>
    </tr>
    <tr>
    <td><strong>Total Game Masters</strong></td>
    <td>'
    .$total_gamemaster.'</td>
    <td><strong>Current Game Masters Online</strong></td>
    <td>'
    .$kosp->gmOnline.'</td>
    <td><strong>Average Player Weath</strong></td>
    <td>'
    .number_format($avg_player_geon,0).'</td>
    </tr>
    <tr>
    <td><strong>Total Guilds</strong></td>
    <td>'
    .$total_guilds.'</td>
    <td><strong>Total Guild Members</strong></td>
    <td>'
    .$total_guild_members.'</td>
    <td><strong>Average Players Per Guild</strong></td>
    <td>'
    .$avg_player_guild.'</td>
    </tr>
    <tr>
    <td colspan="6">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="6"><div align="center"><strong>Current Players Online</strong></div></td>
    </tr>
    <tr>
    <td colspan="6">'
    ;
    if(
    is_array($players))
    {
     
    $content .= '<table width="100%" border="0" cellspacing="1" cellpadding="1">
     <tr>
     <td width="20%"><strong>Name</strong></td>
     <td width="20%"><strong>Guild</strong></td>
     <td width="20%"><strong>Class</strong></td>
     <td width="20%"><strong>Level</strong></td>
     <td width="20%"><strong>Level Progress</strong></td>
     </tr>'
    ;
     for(
    $i=0$i count($players); $i++)
     {
      
    $content .= '<tr>
      <td>'
    .$players[$i]->playerName.'</td>
      <td>'
    .$players[$i]->Normalize_Guild($db).'</td>
      <td>'
    .$players[$i]->Normalize_Class().'</td>
      <td>'
    .$players[$i]->playerLevel.'</td>
      <td><img src="http://forum.ragezone.com/images/red_01.gif"><img src="http://forum.ragezone.com/images/green_02.gif" height="10" width="'
    .(@round(($players[$i]->playerEXP $level[$players[$i]->playerLevel 1] * 100))).'"><img src="http://forum.ragezone.com/images/red_02.gif" height="10" width="'.((100 - @round((($players[$i]->playerEXP $level[$players[$i]->playerLevel 1]) * 100)))).'"><img src="http://forum.ragezone.com/images/red_03.gif" height="10"></td>
      </tr>'
    ;
     }
     
    $content .= '</table>';
    }
    else
    {
     
    $content .= $players;
    }
    $content .= '</td>
    </tr>
    <tr>
    <td colspan="6">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="6"><div align="center"><strong>Current Game Masters Online</strong></div></td>
    </tr>
    <tr>
    <td colspan="6">'
    ;
    if(
    is_array($gamemasters))
    {
     
    $content .='<table width="100%" border="0" cellspacing="1" cellpadding="1">
     <tr>
     <td><strong>Name</strong></td>
     <td><strong>Class</strong></td>
     <td><strong>Level</strong></td>
     </tr>'
    ;
     for(
    $i=0$i count($gamemasters); $i++)
     {
      
    $content .= '<tr>
      <td>'
    .$gamemasters[$i]->playerName.'</td>
      <td>'
    .$gamemasters[$i]->Normalize_Class().'</td>
      <td>'
    .$gamemasters[$i]->playerLevel.'</td>
      </tr>'
    ;
     }
     
    $content .= '</table>';
    }
    else
    {
     
    $content .= $gamemasters;
    }
    $content .= '</td></tr></table>';
    $list = @fopen($root."/status.txt""w");
    fwrite($list$contentstrlen($content));
    fclose($list);
    ?>
    Last edited by ShinyDemon; 08-07-10 at 11:01 PM.




Advertisement