Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Help with Mysql and php

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
0
cstallings
Asked:
cstallings
  • 7
  • 5
1 Solution
 
soapergemCommented:
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.
0
 
cstallingsAuthor Commented:
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++;
}
0
 
soapergemCommented:
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cstallingsAuthor Commented:
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.
0
 
soapergemCommented:
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.
0
 
cstallingsAuthor Commented:
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');
0
 
cstallingsAuthor Commented:
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
0
 
cstallingsAuthor Commented:
Here is the phpadmin dump

http://www.blackholenews.com/dump.doc.zip
0
 
soapergemCommented:
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++;
}
//--------------------------------------------------------------
0
 
cstallingsAuthor Commented:
$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.
0
 
cstallingsAuthor Commented:
Also where would I place that code??
0
 
soapergemCommented:
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.
--------------------------------------
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now