function doit() { include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iCurrentYear = $objGame->get_year_history(); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); include_once 'inc/classes/clsAge.php'; $objNewAge = new clsAge(); $objNewAge->loadAge($iAgeNumber); $iFirstYear = $objNewAge->getFirstYear(); $iLastYear = $objNewAge->getLastYear(); // Alla genom history $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY year ASC"); // Lista Alla För att summera i PHP $old_id = 0; $count = 0; while ($arrRow = mysql_fetch_assoc($resSQL2)) { $new_id = $arrRow['alli_id']; if ($new_id != $old_id) { // prepare for new alliance $count++; // Copy SQL result row $arrAlliance[$count] = $arrRow; // add a starting year column to display period, eg 100 - 106 OE $arrAlliance[$count]['starting_year'] = $arrRow['year']; // add an ending year column to display period, eg 100 - 106 OE $arrAlliance[$count]['ending_year'] = $arrRow['year']; // add a year counter column, starting value = 1 $arrAlliance[$count]['years'] = 1; // Save alliance id for next loop $old_id = $new_id; } elseif ($new_id == $old_id) { // add another year to our counter column $arrAlliance[$count]['years']++; // update ending year column $arrAlliance[$count]['ending_year'] = $arrRow['year']; } } //====================================================================== // Sort the array //====================================================================== // Obtain the column to sorty by foreach ($arrAlliance as $key => $row) { $years[$key] = $row['starting_year']; } // Sort the data with years descending // Add $arrAlliance as the last parameter, to sort by the common key array_multisort($years, SORT_ASC, $arrAlliance); //====================================================================== // Done sorting ;) //====================================================================== echo "<h2>Timeline</h2>"; echo "<table class=\"big\" cellpadding=\"0\" cellspacing=\"0\">"; $count = 1; foreach ($arrAlliance as $arrAlliance) { echo "<tr class=\"data\">"; echo "<td class=\"left\">(" . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . " OE) </td>"; echo "<th>" . stripslashes($arrAlliance['alli_name']) . "</th>"; echo "<td class=\"left\">" . "(#<A HREF=\"main.php?cat=game&page=alliance&aid=" . $arrAlliance['alli_id'] . "\">" . $arrAlliance['alli_id'] . "</A>)" . "</td>"; echo "<td>" . $arrAlliance['years'] . " years on top </td>"; $count++; echo "</tr>"; } echo "</table>"; }
function include_game_up() { global $page, $strTitle; $objSrcUser =& $GLOBALS['objSrcUser']; // clsGame for gametime include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iGameHours = $objGame->get_game_time(HOUR_COUNTER); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); $strPaused = $objGame->get_game_switch(GLOBAL_PAUSE); // clsAge for age counters include_once 'inc/classes/clsAge.php'; $objAge = new clsAge(); $blnCheck = $objAge->loadAge($iAgeNumber); // either FALSE or TRUE // orkTime for some time functions include_once 'inc/functions/orktime.php'; $arrOrkDate = hoursToYears($iGameHours); // Months $strMonths = ""; if ($arrOrkDate['months'] > 0) { $strMonths = "Month " . $arrOrkDate['months'] . ", "; } $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck); if ($strPaused == ON) { $arrAgeDisplays['str_age_extra'] .= ' <span class="positive">PAUSED</span>'; } // Alliance $arrGameHistorys = $objGame->get_historys($arrOrkDate['years']); if ($arrGameHistorys[ALLI_NAME] == NULL) { // Martel: Prevent year-change lag $arrGameHistorys = $objGame->get_historys($arrOrkDate['years'] - 1); } $strTopAlliance = 'Top Alliance: ' . $arrGameHistorys[ALLI_NAME] . ' (#<a href="main.php?cat=game&page=alliance&aid=' . $arrGameHistorys[ALLI_ID] . '">' . $arrGameHistorys[ALLI_ID] . '</a>)'; // Design stuff if (isset($objSrcUser)) { $arrDesign = $objSrcUser->get_designs(); } if (!isset($arrDesign[COLOR])) { $arrDesign[COLOR] = 'forest_v1'; } if (!isset($arrDesign[WIDTH]) || $arrDesign[WIDTH] == "") { $arrDesign[WIDTH] = '750'; } if (!isset($arrDesign[ALIGNMENT])) { $arrDesign[ALIGNMENT] = 'center'; } ?> <script language="JavaScript" type="text/javascript"> <!--- var serverDate=new Date('<?php echo date("F d, Y H:i:s", time()); ?> ') //--> </script> <script language="JavaScript" type="text/javascript" src="orkfiaJS.php"></script> <link rel="stylesheet" type="text/css" media="all" href="css/<?php echo $arrDesign[COLOR]; ?> .css?version=1" /> <link rel="stylesheet" type="text/css" media="all" href="css/style.css?version=1" /> <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/ie.css" /><![endif]--> <?php //If my new menu works I will put it here. I will also remove the ID part when a first good part is done. if ($objSrcUser->get_userid() == 7160 && $_SERVER['SERVER_NAME'] == DEV_SERVER_NAME) { ?> <link rel="stylesheet" type="text/css" media="all" href="css/harrytesting.css" /> <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="css/harryie.css" /><![endif]--> <?php } ?> </head> <body onload="clockStart();"> <div id="<?php echo 'container' . $arrDesign[WIDTH] . $arrDesign[ALIGNMENT]; ?> "> <div id="header"> <h1 style="margin: 0; padding: 0;"><img src="<?php echo HOST_PICS . 'head' . $arrDesign[WIDTH] . '.jpg'; ?> " alt="ORKFiA" /></h1> <ul id="gameStats"> <li style="color: #000;">Time: <span style="color: #000;" id="ClockTime"><?php echo date('H:i:s', time()); ?> </span></li> <li><br /></li> <li><a href="main.php?cat=game&page=rankings&show=annual&type=currentage"><?php echo $arrAgeDisplays['str_age']; ?> </a> <em><?php echo $arrAgeDisplays['str_age_extra']; ?> </em></li> <li><strong><?php echo $strMonths; ?> Year <?php echo $arrOrkDate['years']; ?> OE</strong> <em><?php echo $strTopAlliance; ?> </em></li> </ul> </div> <div id="menu"> <?php include_game_menu(); ?> </div> <div id="upper_shadow"></div> <div id="portal"> <div class="center"> <h2 style="margin: 0;"><img src="<?php echo HOST_PICS; ?> gryph_l.gif" alt=""/><img src="<?php echo HOST_PICS . $page; ?> .gif" alt="<?php echo $strTitle; ?> " /><img src="<?php echo HOST_PICS; ?> gryph_r.gif" alt="" /></h2> </div> <?php }
function doit() { include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iCurrentYear = $objGame->get_year_history(); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); include_once 'inc/classes/clsAge.php'; $objNewAge = new clsAge(); $objNewAge->loadAge($iAgeNumber); $iFirstYear = $objNewAge->getFirstYear(); $iLastYear = $objNewAge->getLastYear(); // Alla genom history $resSQL2 = mysql_query("SELECT year, alli_id, alli_name, alli_desc FROM rankings_history WHERE alli_id > 10 AND year >= {$iFirstYear} AND year <= {$iLastYear} GROUP BY year ASC"); // Lista Alla För att summera i PHP $old_id = 0; $iCount = 0; while ($arrRow = mysql_fetch_assoc($resSQL2)) { $new_id = $arrRow['alli_id']; if ($new_id != $old_id) { // prepare for new alliance $iCount++; // Copy SQL result row $arrAlliance[$iCount] = $arrRow; // add a starting year column to display period, eg 100 - 106 OE $arrAlliance[$iCount]['starting_year'] = $arrRow['year']; // add an ending year column to display period, eg 100 - 106 OE $arrAlliance[$iCount]['ending_year'] = $arrRow['year']; // add a year counter column, starting value = 1 $arrAlliance[$iCount]['years'] = 1; // Save alliance id for next loop $old_id = $new_id; } elseif ($new_id == $old_id) { // add another year to our counter column $arrAlliance[$iCount]['years']++; // update ending year column $arrAlliance[$iCount]['ending_year'] = $arrRow['year']; } } //====================================================================== // Sort the array //====================================================================== // Obtain the column to sorty by foreach ($arrAlliance as $key => $row) { $years[$key] = $row['starting_year']; } // Sort the data with years descending // Add $arrAlliance as the last parameter, to sort by the common key array_multisort($years, SORT_ASC, $arrAlliance); //====================================================================== // Done sorting ;) //====================================================================== // echo '<div class="center"><h2>Timeline</h2></div>'; echo '<br />'; $strTimelineCurrentTable = '<table class="big" cellpadding="0" cellspacing="0">' . '<tr class="header">' . '<th colspan="5">Timeline</th>' . '</tr>' . '<tr class="subheader">' . '<th>Period</th>' . '<th>Alliance Name</th>' . '<th>Alliance Description</th>' . '<th>#</th>' . '<th class="right">Years</th>' . '</tr>'; $iCount = 1; foreach ($arrAlliance as $arrAlliance) { $strTimelineCurrentTable .= '<tr class="data">' . '<td class="left">(' . $arrAlliance['starting_year'] . ' - ' . $arrAlliance['ending_year'] . ' OE) </td>' . '<th>' . stripslashes($arrAlliance['alli_name']) . '</th>' . '<td class="left">' . stripslashes($arrAlliance['alli_desc']) . '</td>' . '<td class="left">' . '(#<a href="main.php?cat=game&page=alliance&aid=' . $arrAlliance['alli_id'] . '">' . $arrAlliance['alli_id'] . '</a>)</td>' . '<td>' . $arrAlliance['years'] . ' years on top </td>' . '</tr>'; $iCount++; } $strTimelineCurrentTable .= '</table>'; echo $strTimelineCurrentTable; }
function include_main_text() { global $Host; include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $strLoginSwitch = $objGame->get_game_switch(LOGIN_STOPPER); include_once 'inc/functions/races.php'; //$arrRaces = getRaces(); //$strRace = $arrRaces[$iRand = rand(1,15)]; //$arrRandRace = getUnitVariables($strRace); //changed to use clsRace - AI require_once 'inc/races/clsRace.php'; $arrRaces = clsRace::getActiveRaces(); $strRace = $arrRaces[$iRand = rand(1, count($arrRaces) - 1)]; $arrRandRace = getUnitVariables($strRace); ?> <div id="text" style="height: 85px;"> <div id="login"> <h2><img src="<?echo $Host;?>first_login.gif" alt="Login" height="26" /></h2> <p> <?php if ($strLoginSwitch == 'on' && !isset($_GET['stagepass'])) { ?> <em style="color: lightgreen;">Logins are temporarily disabled.</em> </h2> <p>(We're probably just updating the game so be back soon!)</p> <?php } else { ?> <form action="main.php?cat=main&page=login2" method="post"> <label for="1" class="hidden">Username</label> <input maxlength="20" name="login[username]" size="9" class="login" id="1"/> <label for="2" class="hidden">Password</label> <input maxlength="20" name="login[password]" size="9" type="password" class="password" id="2"/> <input type="submit" name="LoginButton" value="Login" align="middle" class="submit" /> or <a href="main.php?cat=main&page=register1">Sign Up!</a> </form> </p> <?php } /* $age1 = mktime(0,0,0,9,3,2006); //hours,mins,secs,month,day,year $timediff = $age1 - time(); $days = intval($timediff / 86400); $remain = $timediff % 86400; $hours = intval($remain / 3600); $remain = $remain % 3600; $mins = intval($remain / 60); if ($timediff > 0) echo ' <i style="color: lightgreen;">New Age Start: <br/>'; if ($days > 1) echo $days . ' days left'; elseif ($days == 1) echo $days . ' day left'; elseif ($hours > 1) echo $hours . ' hours left'; elseif ($hours == 1) echo $hours . ' hour left'; elseif ($hours == 0 && $mins > 0) echo $mins . ' minutes left!'; if ($timediff > 0) echo "</i>"; */ // Martel: Safety caution - Do not help kiddies find usernames or guess pws if (isset($_GET['error'])) { switch ($_GET['error']) { case 'error': echo '<p>' . 'Wrong name or password, please try again.' . '</p>'; break; case 'empty': echo '<p>' . 'Empty form, please fill in and try again.' . '</p>'; break; } } ?> </div> <div id="teaser"> <p>ORKFiA is an excellent <strong>online strategy game</strong> in a fantasy setting. Play in alliances together with your friends, at work, in school or at home, and become the greatest leader of all.</p> </div> </div> <div id="columns"> <div id="intro"> <div class="center"> <h2>Global Game News</h2> </div> <?php include_once 'inc/pages/global_news.inc.php'; // Show Global News echo showGlobalNews('tiny'); ?> <div id="text"> <h2><img src="<?echo $Host;?>first_join.gif" alt="Join" height="26" /></h2 <p>Create and lead your very own tribe inside Orkfia, for absolutely no cost. Go here to <a href="main.php?cat=main&page=sponsors">Sign Up!</a></p> <h2><img src="<?echo $Host;?>first_chat.gif" alt="Chat" height="26" /></h2> <p>Talk to staff and active players in our IRC-channel: <a href="irc://irc.netgamers.org/orkfia" target="_blank" class="newWindowLink">#orkfia</a></p> </div <div class="center" style="text-align: left;"> <h2 style="margin: 0px auto; margin-top: 10px; text-align: center;">Game Stats</h2> <?php //========================================================================== // Martel, December 07, 2006 // Age display, identical except for "month" to what is in layout.php //========================================================================== include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); $iGameHours = $objGame->get_game_time(HOUR_COUNTER); $iAgeNumber = $objGame->get_game_time(AGE_NUMBER); // age stuff include_once 'inc/classes/clsAge.php'; $objAge = new clsAge(); $blnCheck = $objAge->loadAge($iAgeNumber); // either FALSE or TRUE // display stuff include_once 'inc/functions/orktime.php'; $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck); $arrOrkDate = hoursToYears($iGameHours); // Months $strMonths = ""; if ($arrOrkDate['months'] > 0) { $strMonths = "Month " . $arrOrkDate['months'] . ", "; } $arrAgeDisplays = get_age_displays($objGame, $objAge, $blnCheck); // Alliance $arrGameHistorys = $objGame->get_historys($arrOrkDate['years']); $strTopAlliance = 'Top Alliance: ' . $arrGameHistorys[ALLI_NAME] . ' (#' . $arrGameHistorys[ALLI_ID] . ')'; // queries for stats $strSQL1 = 'SELECT (COUNT(id) / 2) as wars FROM war WHERE target > 0 LIMIT 1'; $strSQL2 = 'SELECT COUNT(id) as alliances FROM ' . ALLIANCE . ' WHERE id > 10 LIMIT 1'; $strSQL3 = 'SELECT COUNT(id) as players FROM user LIMIT 1'; $strSQL4 = 'SELECT COUNT(id) as oldies FROM user WHERE hours > 948 LIMIT 1'; $strSQL5 = 'SELECT AVG(land) as avg_land FROM build,user WHERE user.hours > 948 LIMIT 1'; $iWars = intval(mysql_result(mysql_query($strSQL1), 0)); $iAlliances = mysql_result(mysql_query($strSQL2), 0); $iPlayers = mysql_result(mysql_query($strSQL3), 0); $iOldies = mysql_result(mysql_query($strSQL4), 0); $iAvgLand = mysql_result(mysql_query($strSQL5), 0); echo '<p>' . "Currently in ORKFiA there are <strong style=\"font-size: 1.5em;\">{$iWars}</strong> ongoing wars, <strong style=\"font-size: 1.5em;\">{$iAlliances}</strong> alliances and <strong style=\"font-size: 1.5em;\">{$iPlayers}</strong> tribes." . '</p>'; // '<h2>Game Configuration</h2>' . // '<p>' . // "Max alliances: " . MAX_ALLIANCES . " <br />" . // "Tribes per alliance: " . MAX_ALLIANCE_SIZE . " <br />" . // "Average tribes per alliance: " . round($iPlayers / $iAlliances) . " <br />" . // "Average size of tribes with 5 years to live: " . number_format($iAvgLand) . " acres <br />" . // '</p>'; //========================================================================== // end nonsense ;) //========================================================================== ?> </div> </div> <div id="donate"> <div id="text" style="text-align: left;"> <h2><img src="<?echo $Host;?>first_intro.gif" alt="Strategy Game Introduction" height="26" /></h2> <p><span class="highlight">Grow your tribe in a real time environment</span>, teamed together with friends in an effort to become the largest, strongest and most famous of all alliances!</p> <p>You have to execute the right strategy to grow large, strong and famous. There are <span class="highlight">many strategies to choose</span>. Your tribe can grow by the valuables your citizens find in the mines, or they can do research in many fields to improve your efficiency, defense, power and production.</p> <p>The other possibility is to <span class="highlight">kill those who oppose you</span>. Once all your enemies have perished, you will <span class="highlight">be the greatest leader the world has ever seen</span>.</p> </div> </div> </div> <?php }