db.php
Code: Select all
<?phpfunction db_connect(){ if (mysql_connect('localhost', 'user','password')){ if(mysql_select_db('db_name')){ return true; } else { return false; } } else { return false; }} ?>
Code: Select all
<?phpinclude_once('includes/db.php');include_once('header.php');echo ("<META HTTP-EQUIV=Refresh CONTENT='300; URL=castles.php'>");?> <div id="page_content"> <div class="spacer"> <table align="center" id="tabel_continut"> <tr> <td class="leftcol"> <h1 align="center">Castle Control</h1><br><br> <p align="left"> <font color="red">Updated every 5 minutes</font></p> <br/><br/> <?php $rowdata = mysql_query("select a.clan_name, a.clan_level, a.clan_id, a.ally_name, a.leader_id, b.char_name, b.accesslevel, c.siegeDate, c.taxPercent, c.id as idcastel, c.name FROM clan_data as a, characters as b, castle as c WHERE ((a.clan_id = b.clanId) AND (b.accesslevel = 0) AND (c.id = a.hasCastle)) ORDER BY name ASC"); //echo $rowdata; $img_castele = array(1 => "Gludio.bmp", 2 => "Dion.bmp", 3 => "Giran.bmp", 4 => "Oren.bmp", 5 => "Aden.gif", 6 => "Innadril.gif", 7 => "Goddard.gif", 8 => "Rune.gif", 9 => "Schuttgart.gif"); //print_r ($img_castele); $i = 1;//set a variable to identify images if(mysql_num_rows($rowdata) > 0 ) { echo "<table id='castel_status' cellpadding='5'>"; while($row = mysql_fetch_array($rowdata)) { echo "<tr><td style='width:230px;'><img src='images/castle/".$img_castele[$row['idcastel']]."' /></td>"; echo "<td style='width:310px;'>"; echo "<h2 style='font-size:14px; color:#F63; margin:0; padding:0; font-weight:bold; margin-bottom:5px;'>".$row['name']." Castle</h2>"; echo "<strong>Next Siege : </strong>".date('D\ j M Y H\:i',$row['siegeDate']/1000)."<br />"; echo "<strong>Clan Owner : </strong>". $row['clan_name']."<br />"; echo "<strong>Clan Level : </strong>".$row['clan_level']."<br />"; echo "<strong>Leader : </strong>". $row['char_name']."<br />"; echo "<strong>Tax : </strong>".$row['taxPercent']."%<br />"; echo "<strong>Alliance : </strong>". $row['ally_name']."<br /></td></tr>"; $i++; } echo "</table>"; } else { echo "<br />No records in the database."; }?> </table></div></div>
