Question

Help with Mysql and php

Asked by: cstallings

I am running a gaming server. Here is the link. Now when you look at a pilots profile it will award them medals depending on what they do in the game. I would like to depending on what level they are on have it change to a different medal or add another medal that is different.  Here is the link to the site.  http://www.aceshigh.ws/run2/stats/index.php
Here is a link to one of the players details page as you can see dependent on a medals txt file that has the different levels he gets the little white ace's http://www.aceshigh.ws/run2/stats/playerdetails.php?id=35 . I would also like if they bomb so many ships get a different kind of medal or something like that. Any ideas would be greatly appreciated. Please let me know what you need and I will gladly get it to you. Thanks.

Here is the code for the player details page.  

<?php
/*************************************************
$Id: playerdetails.php,v 1.1 2004/12/16 01:07:50 administrator Exp $
file: playerdetails.php

description: Displayes a players details and stats
**************************************************/

/*
%actionid = (
        kia         => 1,
        crash       => 2,
        mia         => 3,
        enemyk      => 4,
        teamk       => 5,
        aik         => 6,
        vulchk      => 7,
        chutek      => 8,
        bail        => 9,
        land        => 10,
        wing        => 11,
        controls    => 12,
        escape      => 13,
        disconnect  => 14
);
*/


// Get set up and under way
require('../config.php');
$image = "images/playerdetails.gif";
$page_title = "FBD Stats - $site_name";
include('./includes/header.inc');
include('./includes/player.inc');

$player = get_player($_REQUEST['id']);

?>

<table width=90% align=center border=0 cellspacing=0 cellpadding=0>
<tr valign=top>
        <td width=50%><font face="Arial, sans-serif" size=4 class=fontTitle><b>
<?php

$img  = preg_replace("/\s/", "%20", $player['country']);
$img .= ".gif";


echo "<a href='./playerdetails.php?id=".$player['id']."'>".$player['callsign']."</a> &nbsp;&nbsp;";

if ($player['country'] != "0") {
      echo "<img src='images/flags/$img'>&nbsp;&nbsp;";
}

$cnt = 0;
while ($cnt < $player['medals']) {
      echo " <img border=0 src='./images/medal-kills-1.gif'>";
      $cnt++;
}
   
?></b></font></td>

        <td width=50% align=right><font face="Arial, sans-serif" size=4 class=fontNormal>Player Details</font></td>
</tr>
</table><p>
<br>

<?php

// Dont do details in list mode
if ($_REQUEST['list'] < 1 || $_REQUEST['list'] > 4) {
    print_details($player);

?>

<table width=90% align=center border=0 cellspacing=0 cellpadding=0>
    <tr>
      <td width=22.5% valign=top align=left colspan=2><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal><b>Enemy Victories</font></td>
      <td width=22.5% valign=top align=right><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal>Top 10</font></td>

      <td width=10% valign=top align=left>&nbsp;</td>
      <td width=22.5% valign=top align=left colspan=2><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal><b>Enemy Defeats</font></td>
      <td width=22.5% valign=top align=right><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal>Top 10</font></td>
    </tr>
    <tr>
      <td width=5%></td>
      <td width=35% valign=top align=left colspan=2>
        &nbsp;<br>

        <div align=center>
          <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
            <tr>
              <td bgcolor=#000000 valign=top align=left><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Callsign</b></font></td>
              <td bgcolor=#000000 valign=top align=right><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Times</b></font></td>
            </tr>

<?php

}
else {
   
// ********************************************************
?>

        <div align=center>
          <table border=0 cellpadding=2 cellspacing=1 width=75% bgcolor=#333333>
          <tr>
              <td bgcolor=#FFFFFF valign=top align=Center colspan=2><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontNormal><b>

<?php
    if ($_REQUEST['list'] == 1) {
        echo "Enemy Victories";
    }
    else if ($_REQUEST['list'] == 2) {
        echo "Enemy Defeats";
    }
    else if ($_REQUEST['list'] == 3) {
        echo "Friendly Victims";
    }
    else if ($_REQUEST['list'] == 4) {
        echo "Friendly Attackers";
    }
   

?>
                </b></font></td>
         
          </tr>
        <tr>
              <td bgcolor=#000000 valign=top align=left><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Callsign</b></font></td>
              <td bgcolor=#000000 valign=top align=right><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Times</b></font></td>
            </tr>

<?php

    if ($_REQUEST['list'] == 1) {
        $query = "SELECT archivestats.callsign, COUNT(*) as count, playerdetails.victimid FROM playerdetails, archivestats WHERE playerdetails.killerid ='" . $_REQUEST['id'] . "' AND playerdetails.victimid = archivestats.id AND playerdetails.typeofactionid='4' GROUP BY playerdetails.victimid ORDER BY count DESC";
    }
    else if ($_REQUEST['list'] == 2) {
        $query = "SELECT archivestats.callsign, COUNT(*) as count, playerdetails.killerid FROM playerdetails, archivestats WHERE playerdetails.victimid='" . $_REQUEST['id'] . "' AND playerdetails.killerid = archivestats.id AND playerdetails.typeofactionid = '4' GROUP BY playerdetails.killerid ORDER BY count DESC";
    }
    else if ($_REQUEST['list'] == 3) {
        $query = "SELECT archivestats.callsign, COUNT(*) as count, playerdetails.victimid FROM playerdetails, archivestats WHERE playerdetails.killerid ='" . $_REQUEST['id'] . "' AND playerdetails.victimid = archivestats.id AND playerdetails.typeofactionid='5' GROUP BY playerdetails.victimid ORDER BY count DESC";
    }
    else if ($_REQUEST['list'] == 4) {
        $query = "SELECT archivestats.callsign, COUNT(*) as count, playerdetails.killerid FROM playerdetails, archivestats WHERE playerdetails.victimid='" . $_REQUEST['id'] . "' AND playerdetails.killerid = archivestats.id AND playerdetails.typeofactionid = '5' GROUP BY playerdetails.killerid ORDER BY count DESC LIMIT 0, 10";
    }
    $result = @mysql_query($query);
    if (!$result) {
        print_error("Mysql croaked: " . mysql_error());
    }

    $bgcolor = "#000000";
    while ($row = mysql_fetch_row($result)) {
          if ($bgcolor == "#202020") {
                $bgcolor = "#000000";
      }
      else {
                $bgcolor = "#202020";
        }
        echo "<tr bgcolor=$bgcolor>
        <td align=left valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
        <a href='./playerdetails.php?id=$row[2]'>$row[0]</a></font></td>
        <td align=right valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>$row[1]</font></td>
        </tr>";
    }
    mysql_free_result($result);

?>
          </table>
        </div>
<?php

    include('./includes/footer.inc');
    exit(0);

// ********************************************************
}

// Top 10 kills
$result = @mysql_query("SELECT archivestats.callsign, COUNT(*) as count, playerdetails.victimid FROM playerdetails, archivestats WHERE playerdetails.killerid ='" . $_REQUEST['id'] . "' AND playerdetails.victimid = archivestats.id AND playerdetails.typeofactionid='4' GROUP BY playerdetails.victimid ORDER BY count DESC LIMIT 0, 10");
if (!$result) {
    print_error("Mysql croaked: " . mysql_error());
}

$bgcolor = "#000000";
$cnt = 0;
while ($row = mysql_fetch_row($result)) {
      if ($bgcolor == "#202020") {
            $bgcolor = "#000000";
      }
      else {
            $bgcolor = "#202020";
      }
    echo "<tr bgcolor=$bgcolor>
    <td align=left valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=$row[2]'>$row[0]</a></font></td>
    <td align=right valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>$row[1]</font></td>
    </tr>";
    $cnt++;
}
mysql_free_result($result);

if ($cnt == 10) {
    echo "</table><table><tr><td align=center valign=top colspan=2>
    <font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=".$player['id']."&list=1'>Show All</a></font></td></tr>";
}

?>

          </table>
        </div>
      </td>
      <td width=10%>&nbsp;<br>
      </td>
      <td width=5% valign=top align=left>

      </td>
      <td width=35% valign=top align=left colspan=2>
      &nbsp;<br>
      <div align=center>
        <center>
        <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
          <tr>
              <td width=50% bgcolor=#000000 valign=top align=left><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Callsign</b></font></td>

              <td width=50% bgcolor=#000000 valign=top align=right><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Times</b></font></td>
          </tr>
<?php

// Top 10 killed by's
$result = @mysql_query("SELECT archivestats.callsign, COUNT(*) as count, playerdetails.killerid FROM playerdetails, archivestats WHERE playerdetails.victimid='" . $_REQUEST['id'] . "' AND playerdetails.killerid = archivestats.id AND playerdetails.typeofactionid = '4' GROUP BY playerdetails.killerid ORDER BY count DESC LIMIT 0, 10");
if (!$result) {
    print_error("Mysql croaked: " . mysql_error());
}

$bgcolor="#000000";
$cnt = 0;
while ($row = mysql_fetch_row($result)) {
          if ($bgcolor == "#202020") {
                $bgcolor = "#000000";
      }
      else {
                $bgcolor = "#202020";
        }
    echo "<tr bgcolor=$bgcolor>
    <td align=left valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=$row[2]'>$row[0]</a></font></td>
    <td align=right valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>$row[1]</font></td>
    </tr>";
    $cnt++;
}
mysql_free_result($result);

if ($cnt == 10) {
    echo "</table><table><tr><td align=center valign=top colspan=2>
    <font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=".$player['id']."&list=2'>Show All</a></font></td></tr>";
}
?>        
        </table>
        </center>
      </div>
      </td>
    </tr>
  </table>
  <p>
  <br>

<table width=90% align=center border=0 cellspacing=0 cellpadding=0>
    <tr>
      <td width=22.5% valign=top align=left colspan=2><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal><b>Friendly Victims</font></td>
      <td width=22.5% valign=top align=right><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal>Top 10</font></td>
      <td width=10% valign=top align=left>&nbsp;</td>
      <td width=22.5% valign=top align=left colspan=2><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal><b>Friendly Attackers</font></td>
      <td width=22.5% valign=top align=right><font face="Verdana, Arial, sans-serif" size=2 class=fontNormal>Top 10</font></td>

    </tr>
    <tr>
      <td width=5%></td>
      <td width=35% valign=top align=left colspan=2>
        &nbsp;<br>
        <div align=center>
          <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
            <tr>
              <td bgcolor=#000000 valign=top align=left><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Callsign</b></font></td>

              <td bgcolor=#000000 valign=top align=right><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Times</b></font></td>
            </tr>


<?php

// Top 10 TK's
$result = @mysql_query("SELECT archivestats.callsign, COUNT(*) as count, playerdetails.victimid FROM playerdetails, archivestats WHERE playerdetails.killerid ='" . $_REQUEST['id'] . "' AND playerdetails.victimid = archivestats.id AND playerdetails.typeofactionid='5' GROUP BY playerdetails.victimid ORDER BY count DESC LIMIT 0, 25");
if (!$result) {
    print_error("Mysql croaked: " . mysql_error());
}

$bgcolor="#000000";
$cnt = 0;
while ($row = mysql_fetch_row($result)) {
          if ($bgcolor == "#202020") {
                $bgcolor = "#000000";
      }
      else {
                $bgcolor = "#202020";
        }
    echo "<tr bgcolor=$bgcolor>
    <td align=left valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=$row[2]'>$row[0]</a></font></td>
    <td align=right valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>$row[1]</font></td>
    </tr>";
    $cnt++;
}
mysql_free_result($result);

if ($cnt == 10) {
    echo "</table><table><tr><td align=center valign=top colspan=2>
    <font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=".$player['id']."&list=3'>Show All</a></font></td></tr>";
}
?>

          </table>
        </div>
      </td>
      <td width=10%>&nbsp;<br>
      </td>
      <td width=5% valign=top align=left>

      </td>
      <td width=35% valign=top align=left colspan=2>
      &nbsp;<br>
      <div align=center>
        <center>
        <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
          <tr>
              <td width=50% bgcolor=#000000 valign=top align=left><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Callsign</b></font></td>

              <td width=50% bgcolor=#000000 valign=top align=right><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Times</b></font></td>
          </tr>
<?php

// Top 10 TK'ed by
$result = @mysql_query("SELECT archivestats.callsign, COUNT(*) as count, playerdetails.killerid FROM playerdetails, archivestats WHERE playerdetails.victimid='" . $_REQUEST['id'] . "' AND playerdetails.killerid = archivestats.id AND playerdetails.typeofactionid = '5' GROUP BY playerdetails.killerid ORDER BY count DESC LIMIT 0, 10");
if (!$result) {
    print_error("Mysql croaked: " . mysql_error());
}

$bgcolor="#000000";
$cnt = 0;
while ($row = mysql_fetch_row($result)) {
          if ($bgcolor == "#202020") {
                $bgcolor = "#000000";
      }
      else {
                $bgcolor = "#202020";
        }
    echo "<tr bgcolor=$bgcolor>
    <td align=left valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=$row[2]'>$row[0]</a></font></td>
    <td align=right valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>$row[1]</font></td>
    </tr>";
    $cnt++;
}
mysql_free_result($result);

if ($cnt == 10) {
    echo "</table><table><tr><td align=center valign=top colspan=2>
    <font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
    <a href='./playerdetails.php?id=".$player['id']."&list=4'>Show All</a></font></td></tr>";
}
?>

        </table>
        </center>
      </div>
      </td>
    </tr>
  </table>

  <p>
  <br><br>
        <!-- Sorties flown cell -->
            <table width=90% align=center border=0 cellspacing=0 cellpadding=0>
                <tr>
                    <td valign=top align=left><font face=Verdana, arial, sans-serif size=2 class=fontNormal><b>Last 25 Sorties Flown</b><br>&nbsp;</font></td>
                </tr>

            </table>
          <table border=0 align=center cellpadding=2 cellspacing=1 width=85% bgcolor=#333333>
          <tr>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>&sort=1'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>MISSION</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>START TIME</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>&sort=2'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>ARMY</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>&sort=3'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>PLANE</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>&sort=4'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>SCORE</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>&sort=5'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>AIRCRAFT KILLS</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><a href='playerdetails.php?id=<?php echo $_REQUEST['id'];  ?>&sort=6'><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall>GROUND KILLS</a></font></b></td>
                <td bgcolor=#FFFFFF valign=top align=center><b><font color=#000000 face=Verdana, Arial, sans-serif size=1 class=fontSmall> SORTIE </font></b></td>          </tr>


<?php

$query = "SELECT
                            missionid.missionname ,
                            missionstats.id as sid,
                            archivestats.callsign,
                            sortiestats.*,
                            aircraftid.aircraft,
                            (eAir + eSAir) AS airkills,
                            (eTank + eCar + eArt + eAaa + eWag + eShip) as groundkills,
                            (fAir + fSAir + fTank + fCar + fArt + fAaa + fWag + fShip) as friendlykills
                        FROM
                            sortiestats,
                            archivestats,
                            missionstats,
                            missionid,
                            aircraftid
                        WHERE
                            sortiestats.playerid = ".$_REQUEST['id']."
                            AND archivestats.id         = sortiestats.playerid
                            AND missionstats.starttime  = sortiestats.missionstarttime
                            AND missionid.id            = missionstats.missionid
                            AND aircraftid.id           = sortiestats.plane
                        ORDER BY ";

if ($_REQUEST['sort'] == 1) {
    $query .= "missionid.missionname, sortieid DESC";
}
elseif ($_REQUEST['sort'] == 2) {
    $query .= "army, sortieid DESC";
}
elseif ($_REQUEST['sort'] == 3) {
    $query .= "aircraft, sortieid DESC";
}
elseif ($_REQUEST['sort'] == 4) {
    $query .= "score DESC, sortieid DESC";
}
elseif ($_REQUEST['sort'] == 5) {
    $query .= "airkills DESC, sortieid DESC";
}
elseif ($_REQUEST['sort'] == 6) {
    $query .= "groundkills DESC, sortieid DESC";
}
else {
    $query .= "sortieid DESC";
}


$query .= " LIMIT 0, 25";

$result = @mysql_query($query);

//MissionID stored in $row[0]
$bgcolor = "#000000";
if ($result) {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $bgcolor = $bgcolor == "#202020" ? "#000000" : "#020202";
        $army = $row['army'] == 1 ? "Blue" : "Red";
        $plink = "<a href='missiondetails.php?id=".$row['sid']."'>".$row['missionname']."</a>";
        $slink = "<a href='sortiedetails.php?id=".$row['sortieid']."&playerid=".$row['playerid']."'>[SORTIE]</a>";
        echo "
        <tr>
              <td bgcolor=$bgcolor valign=top align=left><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>$plink</font></td>
              <td bgcolor=$bgcolor valign=top align=left><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>" . strftime("%b %d - %I:%M %p", $row['sortieid']) . "</font></td>
              <td bgcolor=$bgcolor valign=top align=left><font color=$army face=Verdana, Arial, sans-serif size=1 class=fontSmall>$army</font></td>
              <td bgcolor=$bgcolor valign=top align=left><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>".$row['aircraft']."</font></td>
              <td bgcolor=$bgcolor valign=top align=right><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>".$row['score']."</font></td>
              <td bgcolor=$bgcolor valign=top align=right><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>".$row['airkills']."</font></td>
              <td bgcolor=$bgcolor valign=top align=right><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>".$row['groundkills']."</font></td>
              <td bgcolor=$bgcolor valign=top align=center><font color=#FFFFFF face=Verdana, Arial, sans-serif size=1 class=fontSmall>$slink</font></td>
        </tr> \n";

    }
    mysql_free_result($result);
}
else {
    print_error("Mysql croaked: " . mysql_error());
}

?>
            </table>
            </td>
            </tr>
          </table>
<p>
<br>


<?php
include('./includes/footer.inc');

// ***************************************************************************************************************************
// ***************************************************************************************************************************
// print details
// ***************************************************************************************************************************
// ***************************************************************************************************************************
function print_details ($player) {
?>

<table width=90% align=center border=0 cellspacing=0 cellpadding=0>
    <tr>
      <td width=22.5% valign=top align=left colspan=2><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><b>Information</b></font></td>
      <td width=22.5% valign=top align=right><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>&nbsp;</font></td>
      <td width=10% valign=top align=left>&nbsp;</td>

      <td width=22.5% valign=top align=left colspan=2><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><b>Statistics</b></font></td>
      <td width=22.5% valign=top align=right><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>&nbsp;</font></td>
    </tr>
    <tr>
      <td width=5%></td>
      <td width=35% valign=top align=left colspan=2>
        &nbsp;<br>
        <div align=center>

          <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Stats ID</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['id']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Country</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php
              if ($player['country'] != "0") { echo $player['country']; }
            else { echo "Unknown"; }
            echo "</font></td>"; ?>
          </tr>

          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Last Sighting</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo date("F jS Y h:i A", $player['currenttime']); ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Total Time Played</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo number_format($player['totaltimeplayed']/3600, 1, ".", "") ?> hours</font></td>
          </tr>

          </table>
        </div>
        &nbsp;
        <div align=center>
          <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>K/D Ratio</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>
<?php

    // K/D ratio
    if ($player['deaths'] != 0) {
        echo number_format(($player['enemyaircraftkills'] / $player['deaths']), 1, ".", "");
    }
    else {
        echo $player['enemyaircraftkills'] . ".0";
    }
                 
           
?>
            </font></td>
          </tr>

          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Hit %</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>

<?php

    // Hit %
    if ($player['firedbullets']) {
        echo number_format((($player['hitbullets'] / $player['firedbullets']) * 100), 1, ".", "");
    }
    else {
        echo "0.0";
    }
   
?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Hit Air %</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>

<?php

    // Hit air %
    if ($player['firedbullets']) {
        echo number_format((($player['hitairbullets'] / $player['firedbullets']) * 100), 1, ".", "");
    }
    else {
        echo "0.0";
    }
   
?></font></td>
          </tr>

          </table>
        </div>
        &nbsp;
        <div align=center>
          <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>
          <tr><td bgcolor=#000000 valign=top align=left><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Aircraft Flown</b></font></td>
              <td bgcolor=#000000 valign=top align=right><font color=#EEEEEE face="Verdana, Arial, sans-serif" size=1 class=fontSmall><b>Top 10</b></font></td>
          </tr>

<?php

// Top 10 Aircraft
$result = @mysql_query("SELECT aircraftid.aircraft, aircraftstats.count, aircraftid.id FROM aircraftid, aircraftstats WHERE playerid ='" . $_REQUEST['id'] . "' AND aircraftid.id=aircraftstats.aircraft ORDER BY count DESC LIMIT 0, 10");
if (!$result) {
    print_error("Mysql croaked: " . mysql_error());
}

$bgcolor = "#000000";
$cnt = 0;
while ($row = mysql_fetch_row($result)) {
          if ($bgcolor == "#202020") {
                $bgcolor = "#000000";
      }
      else {
                $bgcolor = "#202020";
        }
    echo "<tr bgcolor=$bgcolor>
    <td align=left valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal><a href='aircraftdetails.php?id=$row[2]'>
    $row[0]</a></font></td>
    <td align=right valign=top><font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>$row[1]</font></td>
    </tr>";
    $cnt++;
}
mysql_free_result($result);

//if ($cnt == 10) {
//    echo "</table><table><tr><td align=center valign=top colspan=2>
//    <font face='Verdana, Arial, sans-serif' size=2 class=fontNormal>
//    <a href='./playerdetails.php?id=".$player['id']."&list=3'>Show All</a></font></td></tr>";
//}
?>

          </table>
        </div>&nbsp;
      </td>
      <td width=10%>&nbsp;<br>
      </td>

      <td width=5% valign=top align=left>
      </td>
      <td width=35% valign=top align=left colspan=2>
      &nbsp;<br>
      <div align=center>
        <center>
        <table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=#333333>

          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Enemy Aircraft Kills</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemyaircraftkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Killed In Action</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['deaths']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Friendly Aircraft Kills</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['friendlyaircraftkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Killed By Friendly Aircraft</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['tdeaths']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Enemy Static Aircraft Kills</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemystaticaircraftkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Friendly Static Aircraft Kills</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['friendlystaticaircraftkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Tanks Destroyed</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemytankkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Vehicles Destroyed</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemycarkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Artillery Destroyed</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemyartillerykills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>AAA Destroyed</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemyaaakills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Train Cars Destroyed</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemywagonkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Ships Sunk</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['enemyshipkills']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Fired Bullets</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['firedbullets']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Hit Bullets</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['hitbullets']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Hit Air Bullets</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['hitairbullets']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Fired Rockets</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['firedrockets']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Direct Hit Rockets</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['hitrockets']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Dropped Bombs</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['droppedbombs']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Landed Safely</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['landings']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Crashed</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['crashes']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Bailed Out</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['bails']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Missing in Action</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['miadeaths']; ?></font></td>
          </tr>
          <tr><td align=left valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal>Escaped From Enemy</font></td>
              <td align=right valign=top bgcolor=#000000><font face=Verdana, Arial, sans-serif size=2 class=fontNormal><?php echo $player['escapes']; ?></font></td>
          </tr>

        </table>
        </center>

      </div>
      </td>
    </tr>
  </table><p>
<br>


<?php

}   // End of player_details
?>


Here is the TXT file for the award levels:
LevelOne=5
LevelTwo=20
LevelThree=50
LevelFour=100
LevelFive=200

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-04-24 at 09:30:01ID21825110
Tags

mysql

,

table

Topic

PHP Scripting Language

Participating Experts
1
Points
500
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. What is MySQL?
    What is MYSQL? and what is the difference between MYSQL and SQL Server?
  2. php and mySql
    Hiii.....i am learning php, and i am not so god yet....... can somebdy help me with this warning...? Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\xampp\htdocs\DriftsSystem\Oblig\handler\DbHandle...
  3. MySQL & PHP
    Experts, I just installed MySQL and PHP5 on Windows Server 2003. How do I configure PHP to interface with MySql?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: soapergemPosted on 2006-04-24 at 12:23:04ID: 16528283

Personally, I think you're asking too much of us by saying "here's an eight-page PHP file; make it work." I think you need to either refine your question or just pay someone to do it for you. What you've posted is A LOT of reading. But who knows, maybe someone will come by and spend the time to actually post a solution. But I'm of the opinion that you're asking too much.

 

by: cstallingsPosted on 2006-04-24 at 12:31:41ID: 16528381

Th is is where it references the medals, but I do not know enough about PHP.

}

$cnt = 0;
while ($cnt < $player['medals']) {
     echo " <img border=0 src='./images/medal-kills-1.gif'>";
     $cnt++;
}

 

by: soapergemPosted on 2006-04-24 at 12:57:30ID: 16528697

Well, just to clarify: if you wanted to give out more medals, you'd first have to images for each of these medals. You have the picture of the white ace at:
http://www.aceshigh.ws/run2/stats/images/medal-kills-1.gif

Maybe you could make some new medals and post them at:
http://www.aceshigh.ws/run2/stats/images/medal-kills-2.gif
http://www.aceshigh.ws/run2/stats/images/medal-kills-3.gif
.
.
.

Next, we'd have to modify that code fragment a bit, but in order to do that, I think we need some more information. What the code fragment does, currently, is this:
* $player['medals'] is some number (the number of medals that player has earned)
* $cnt is set to zero
* check whether $cnt is less than $player['medals']
    * if so, display the medal image, add 1 to $cnt, and then repeat this step
    * if not, move on to the next code fragment

So it keeps adding one to $cnt until $cnt is no longer less than $player['medals']. That's how PHP works. What we need to do is add something in the while { } statement to check what the player's level is. Something like:

if ( $player['level'] == SOME_NUMBER )
{
    // display some other image
}
else
{
    // display the original image
}

Or you could make it more complex yet if you wanted to display multiple images. Unfortuantely, I literally just made up the variable $player['level']. I have no idea if that exists or not. Nowhere in that code could I find any variable that represents what the player's "level" is. To really answer your question, we would need to know this. I saw a number of variables referenced, like this: $player['country'], $player['id'], $player['callsign'], $player['medals'], etc.

You might take a look at some of the other pages to see if you can find some variable relating to the player's level. Or just look at the basic structure of your MySQL database and see where that information is stored (which table, which column).

And about the other part, I have to assume that the number of times they "bombed so many ships" is the number described as "Dropped Bombs" on the stats page. If so, you could use code like this (I've styled it to be consistent with what's already in use):

$cnt = 0;
while ($cnt < $player['droppedbombs']) {
     echo " <img border=0 src='./images/bomb_image.gif'>";
     $cnt++;
}

But again, obviously, you'd have to create a file called bomb_image.gif (or whatever you want to call it) to use that.

 

by: cstallingsPosted on 2006-04-24 at 13:05:18ID: 16528761

So what code would you need to better know what needs to be done with this. I can get you anything you need. I am more html oriented. I can send you the php files and the mysql.txt. Thanks for all your help this far, more than I ever expected.

 

by: soapergemPosted on 2006-04-24 at 13:34:56ID: 16529028

Okay, my comments/questions:

* If you want to give out different medals, make sure you have image files ready (the current medal is the picture of the white ace, find some other pictures/make your own pictures for new medals and upload them, or at least let us know where you plan to upload them to). It's hard to give out medals that don't exist.
* This code very obviously interacts with a MySQL database. Some of the information about that would be helpful, because a user's level would probably be stored in there somehow. Obviously you don't need to post the actual data contained in the table--since some of that may or may not be sensitive information. But it would be helpful to post the structure of the tables. (structure, not data) Many web hosts have a program called phpMyAdmin installed which provides a very convenient way to look at the structure and data in your MySQL database. If this is installed on your server, all you would need to do is use it to open up your database and press "Export." You could un-check all the boxes related to data, and only export the structure. Then copy/paste that here. If you don't have phpMyAdmin, well...dang. Then I guess find some other way to get us the structure of the tables, if possible.

Your tables would be structured like this:
* missionid
   - id
   - missionname
   - etc.
* archivestats
   - id
   - callsign
   - etc.
.
.
.

* Lastly, you mentioned a TXT file that is referenced. However, nowhere in the code do I actually see any reference to this file. Could you maybe find where it is actually included? The thing to search for would just be the name of the TXT file.

 

by: cstallingsPosted on 2006-04-24 at 13:42:50ID: 16529097

MYSQL Create table file.

#
# Table structure for table `activestats`
#

CREATE TABLE `activestats` (
  `id` int(10) NOT NULL default '0',
  `mapid` int(50) NOT NULL default '0',
  `score` int(8) NOT NULL default '0',
  `statusofaircraft` varchar(20) NOT NULL default '0',
  `country` varchar(50) NOT NULL default '0',
  `currentarmy` varchar(10) NOT NULL default '0',
  `ping` int(8) NOT NULL default '0',
  `aircraft` int(5) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;

#
# Table structure for table `aircraftid`
#

CREATE TABLE `aircraftid` (
  `id` int(11) NOT NULL auto_increment,
  `aircraft` varchar(25) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `aircraftstats`
#

CREATE TABLE `aircraftstats` (
  `id` int(11) NOT NULL auto_increment,
  `playerid` int(11) NOT NULL default '0',
  `aircraft` int(5) NOT NULL default '0',
  `count` int(10) NOT NULL default '0',
  `currenttime` int(10) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `archivestats`
#

CREATE TABLE `archivestats` (
  `id` int(10) NOT NULL auto_increment,
  `callsign` varchar(50) NOT NULL default 'Unknown',
  `mapid` int(50) NOT NULL default '0',
  `currenttime` int(50) NOT NULL default '0',
  `connecttime` int(50) NOT NULL default '0',
  `score` int(8) NOT NULL default '0',
  `enemyaircraftkills` int(10) NOT NULL default '0',
  `enemystaticaircraftkills` int(10) NOT NULL default '0',
  `enemytankkills` int(10) NOT NULL default '0',
  `enemycarkills` int(10) NOT NULL default '0',
  `enemyartillerykills` int(10) NOT NULL default '0',
  `enemyaaakills` int(10) NOT NULL default '0',
  `enemywagonkills` int(10) NOT NULL default '0',
  `enemyshipkills` int(10) NOT NULL default '0',
  `friendlyaircraftkills` int(10) NOT NULL default '0',
  `friendlystaticaircraftkills` int(10) NOT NULL default '0',
  `friendlytankkills` int(10) NOT NULL default '0',
  `friendlycarkills` int(10) NOT NULL default '0',
  `friendlyartillerykills` int(10) NOT NULL default '0',
  `frienldyaaakills` int(10) NOT NULL default '0',
  `friendlywagonkills` int(10) NOT NULL default '0',
  `friendlyshipkills` int(10) NOT NULL default '0',
  `firedbullets` int(20) NOT NULL default '0',
  `hitbullets` int(20) NOT NULL default '0',
  `hitairbullets` int(20) NOT NULL default '0',
  `firedrockets` int(20) NOT NULL default '0',
  `hitrockets` int(20) NOT NULL default '0',
  `droppedbombs` int(20) NOT NULL default '0',
  `directhitbombs` int(20) NOT NULL default '0',
  `ipaddress` varchar(20) NOT NULL default '0',
  `country` varchar(50) NOT NULL default '0',
  `ping` int(8) NOT NULL default '0',
  `totaltimeplayed` int(20) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `awards`
#

CREATE TABLE `awards` (
  `id` int(11) NOT NULL auto_increment,
  `type` int(11) NOT NULL default '0',
  `name` varchar(50) NOT NULL default '0',
  `nametwo` varchar(50) NOT NULL default '0',
  `count` int(11) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `gamechat`
#

CREATE TABLE `gamechat` (
  `id` int(11) NOT NULL auto_increment,
  `chat` varchar(100) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `medals`
#

CREATE TABLE `medals` (
  `id` int(11) NOT NULL auto_increment,
  `type` int(11) NOT NULL default '0',
  `level` int(11) NOT NULL default '0',
  `playerid` int(11) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `missionid`
#

CREATE TABLE `missionid` (
  `id` int(11) NOT NULL auto_increment,
  `missionname` varchar(50) NOT NULL default '0',
  `bplanes` int(5) NOT NULL default '0',
  `bpilots` int(5) NOT NULL default '0',
  `bobjectives` int(2) NOT NULL default '0',
  `bwagons` int(5) NOT NULL default '0',
  `baaa` int(5) NOT NULL default '0',
  `btanks` int(5) NOT NULL default '0',
  `bartillery` int(5) NOT NULL default '0',
  `bcars` int(5) NOT NULL default '0',
  `bships` int(5) NOT NULL default '0',
  `rplanes` int(5) NOT NULL default '0',
  `rpilots` int(5) NOT NULL default '0',
  `robjectives` int(5) NOT NULL default '0',
  `rwagons` int(5) NOT NULL default '0',
  `raaa` int(5) NOT NULL default '0',
  `rtanks` int(5) NOT NULL default '0',
  `rartillery` int(5) NOT NULL default '0',
  `rcars` int(5) NOT NULL default '0',
  `rships` int(5) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `missionstats`
#

CREATE TABLE `missionstats` (
  `id` int(11) NOT NULL auto_increment,
  `missionid` int(15) NOT NULL default '0',
  `winner` int(1) NOT NULL default '0',
  `starttime` int(15) NOT NULL default '0',
  `duration` int(15) NOT NULL default '0',
  `endtime` int(15) NOT NULL default '0',
  `bplanes` int(5) NOT NULL default '0',
  `bpilots` int(5) NOT NULL default '0',
  `bwagons` int(5) NOT NULL default '0',
  `baaa` int(5) NOT NULL default '0',
  `btanks` int(5) NOT NULL default '0',
  `bartillery` int(5) NOT NULL default '0',
  `bcars` int(5) NOT NULL default '0',
  `bships` int(5) NOT NULL default '0',
  `bobjectives` int(2) NOT NULL default '0',
  `rplanes` int(5) NOT NULL default '0',
  `rpilots` int(5) NOT NULL default '0',
  `rwagons` int(5) NOT NULL default '0',
  `raaa` int(5) NOT NULL default '0',
  `rtanks` int(5) NOT NULL default '0',
  `rartillery` int(5) NOT NULL default '0',
  `rcars` int(5) NOT NULL default '0',
  `rships` int(5) NOT NULL default '0',
  `robjectives` int(2) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `playerdetails`
#

CREATE TABLE `playerdetails` (
  `id` int(11) NOT NULL auto_increment,
  `currenttime` int(10) NOT NULL default '0',
  `missionid` int(10) NOT NULL default '0',
  `killerid` int(6) NOT NULL default '0',
  `victimid` int(6) NOT NULL default '0',
  `killersortieid` int(10) NOT NULL default '0',
  `victimsortieid` int(10) NOT NULL default '0',
  `typeofactionid` int(2) NOT NULL default '0',
  `killerplane` int(5) NOT NULL default '0',
  `victimplane` int(5) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Table structure for table `reset`
#

CREATE TABLE `reset` (
  `id` int(11) NOT NULL default '0',
  `type` int(2) NOT NULL default '0',
  `time` int(15) NOT NULL default '0',
  KEY `id` (`id`)
) TYPE=MyISAM;

#
# Table structure for table `sortiestats`
#

CREATE TABLE `sortiestats` (
  `id` int(11) NOT NULL auto_increment,
  `playerid` int(8) NOT NULL default '0',
  `missionid` int(8) NOT NULL default '0',
  `missionstarttime` int(10) NOT NULL default '0',
  `sortieendtime` int(10) NOT NULL default '0',
  `sortieid` int(10) NOT NULL default '0',
  `score` int(6) NOT NULL default '0',
  `eAir` int(5) NOT NULL default '0',
  `eSAir` int(5) NOT NULL default '0',
  `eTank` int(5) NOT NULL default '0',
  `eCar` int(5) NOT NULL default '0',
  `eArt` int(5) NOT NULL default '0',
  `eAaa` int(5) NOT NULL default '0',
  `eWag` int(5) NOT NULL default '0',
  `eShip` int(5) NOT NULL default '0',
  `fAir` int(5) NOT NULL default '0',
  `fSAir` int(5) NOT NULL default '0',
  `fTank` int(5) NOT NULL default '0',
  `fCar` int(5) NOT NULL default '0',
  `fArt` int(5) NOT NULL default '0',
  `fAaa` int(5) NOT NULL default '0',
  `fWag` int(5) NOT NULL default '0',
  `fShip` int(5) NOT NULL default '0',
  `FiBull` int(7) NOT NULL default '0',
  `HiBull` int(7) NOT NULL default '0',
  `HiABull` int(7) NOT NULL default '0',
  `FiRock` int(7) NOT NULL default '0',
  `HiRock` int(7) NOT NULL default '0',
  `FiBomb` int(7) NOT NULL default '0',
  `HiBomb` int(7) NOT NULL default '0',
  `army` varchar(8) NOT NULL default '0',
  `plane` varchar(50) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=0 ;

#
# Dumping data for table `archivestats`
#

INSERT INTO `archivestats` VALUES (1, 'DISCONNECT', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (2, 'KIA', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (3, 'TANK', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (4, 'SHIP', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (5, 'ARTILLERY', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (6, 'AAA', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (7, 'CRASH', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (8, 'ESCAPE', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (9, 'MIA', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (10, 'BAIL', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (11, 'LAND', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (12, 'MISSIONEND', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (13, 'eSAir', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (14, 'fSAir', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (15, 'eWag', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (16, 'fWag', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (17, 'eShip', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (18, 'fShip', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (19, 'eAaa', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (20, 'fAaa', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (21, 'eTank', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (22, 'fTank', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (23, 'eArt', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (24, 'fArt', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (25, 'eCar', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);
INSERT INTO `archivestats` VALUES (26, 'fCar', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', '0', 0, 0);

#
# Dumping data for table `aircraftid`
#

INSERT INTO `aircraftid` VALUES (1, 'None');

 

by: cstallingsPosted on 2006-04-24 at 13:44:26ID: 16529122

as far as the medals go they will go in the same place as the other one. I can create those if you just give me an idea as to the coding I can sub in the appropiate gif. The location will be the same as the ace one. The txt file is called medal_levels.txt and it has the following in it:

LevelOne=5
LevelTwo=20
LevelThree=50
LevelFour=100
LevelFive=200

 

by: cstallingsPosted on 2006-04-24 at 13:53:36ID: 16529195

 

by: soapergemPosted on 2006-04-24 at 19:21:32ID: 16531124

Okay...in need of some clarification. Let me get this straight. Right now, the user you sent us, RAF_Rgaa, as an example has three aces shown. These aces are called "medals." Do you want it so that if he has up to five of these "medals," that one image is shown (i.e. the white aces), if he has between 6 and 20 medals, then some other image is shown, if he has between 21 and 50 medals, yet another image is shown, and so on? Is this what you want, or something else?

Also, perhaps I wasn't clear when I asked before. The file "medal_levels.txt", which you have now included twice--is this a file that is already in use somewhere in the code? That is, does the system call this file somewhere, or did you just create it yourself and you would like to use it as an easy way to customize things. Sorry.

If you answered yes to the question in my first paragraph, and also you created the file medal_levels.txt, then I have included some code that would do it for you below. But again, I'm not really sure that's what you wanted. I'm not really sure *what* you wanted. But I included code to do what I think it is you wanted below. I dunno, give me feedback.

However, if that's not the case, then please try to explain because I'm still a little confused. And it seems you went ahead and exported all the data along with the table structures (above). :) Oh well. Guess it's better to include more info than to not include enough.

//--------------------------------------------------------------
//  each of these images need to be created
$images = array('LevelOne' => 'images/medal-kills-1.gif',
                    'LevelTwo' => 'images/medal-kills-2.gif',
                    'LevelThree' => 'images/medal-kills-3.gif',
                    'LevelFour' => 'images/medal-kills-4.gif',
                    'LevelFive' => 'images/medal-kills-5.gif');

$levels = array();
$lines = file('medals_level.txt');
$i = 0;
//  read in the file; store to array
foreach ($lines as $line)
{
    $level = array();      //      clear
    if ( preg_match('/([A-Za-z]+) *= *([0-9]+)/', $line, $level) )
    {
        $levels[$i]['name'] = $level[1];
            $levels[$i]['count'] = $level[2];
    }
      $i++;
}
unset($level);
//  end read
$i = 0;
do
{
      $image = $images[$levels[$i]['name']];
      $i++;
}
while ( $player['medals'] < $levels[$i]['count'] && $i < count($levels) );
unset($levels);
unset($images);
//      Original code
$cnt = 0;
while ($cnt < $player['medals']) {
     echo " <img border=0 src='./$image'>";
     $cnt++;
}
//--------------------------------------------------------------

 

by: cstallingsPosted on 2006-04-25 at 06:20:36ID: 16533943

$cnt = 0;
while ($cnt < $medals[0]) {
      echo " <img border=0 src='./images/medal-kills-1.gif'>";
      $cnt++;
}

That is all I can find in the code. I am not sure that it even ever calls that file. Sorry dumb dumb when it comes to php. I am looking exactly for what you are saying. If they are level one they have a certain medal, when they are leve two they get another one and so on. Also maybe for like so many bomb kills things like that. I have a basica understanding of this stuff, but no idea how to code it. I hope that helps. Thank you so much for you help with this.

 

by: cstallingsPosted on 2006-04-25 at 08:22:08ID: 16535163

Also where would I place that code??

 

by: soapergemPosted on 2006-04-25 at 14:14:12ID: 16538708

Before I have you go placing code, I need clarify this:

Did YOU create the file "medal_levels.txt" as something new you want to add, or was it there already as a part of the system?

--------------------------------------
IF: You created it
THEN: Okay, I'll revise that code above and tell you where to put it
--------------------------------------
ELSE: It was already there
THEN: The file you included above which is called "playerdetails.php" does not mention "medal_levels.txt." However, if it uses this file, then somewhere....in some part of the code, it has to access "medal_levels.txt". This means that SOME OTHER file accesses it. Please look through the .PHP files and do a search for the text "medal_levels.txt" (without quotes). If you find it, please post the contents of that PHP file.
--------------------------------------

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...