Jump to content

[-razer-]Blade

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

[-razer-]Blade's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?php include("settings.php"); if ($disable = "true") {printf("The Website you are trying to reach is currently unavailible"); exit;} if ($update = "true") {printf("The Website you are trying to reach is currently being updated"); exit;} if ($disbale = "false") { elseif ($update = "false") {header( 'Location: pass.html' ) ;} } ?> Try this. I'm still kinda new to php but I think that might work.
  2. I have been reading my book and tons of articles on the net. I just can't seem to get the hang of joining tables correctly. :'( Anyway here is the problem I face. I have 3 tables. One table holds the leagues that my team plays in another holds the maps that we play on and the last one is my match table that tells us information about the match Ex: what league it is in what map it's on date time etc. We have two maps that we could possibly play on. But when I echo the second one it just displays the first one again. here is my code. <?php include 'dbconnect.php'; $match_id = $_GET['match_id']; $query = mysql_query("SELECT * FROM leagues, matches, maps WHERE matches.match_id = '$match_id' AND maps.map_id = matches.match_map AND matches.match_league = leagues.league_id"); while($row = mysql_fetch_array($query)) { $map_image = $row['map_image']; $league_small_image = $row['league_small_image']; $match_status = $row['match_status']; $match_date = $row['match_date']; $match_opponent = $row['match_opponent']; $match_opponent_tag = $row['match_opponent_tag']; $match_map = $row['map_name']; $match_map_two = $row['map_name']; $our_score = $row['our_score']; $their_score = $row['their_score']; if($match_status == '1'){$match_status = "Played";} else {$match_status = "<i>Pending</i>";} if($match_status == '<i>Pending</i>'){$match_result = "<i>Pending</i>";} elseif($our_score > $their_score){$match_result = '<img src="images/win.gif">';} elseif($our_score < $their_score){$match_result = '<img src="images/loss.gif">';} elseif($our_score == $their_score){$match_result = '<img src="images/draw.gif">';} ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="12"><img src="images/content_top_left.png" width="12" height="12" alt="" /></td> <td class="content_top"></td> <td width="12"><img src="images/content_top_right.png" alt="" width="11" height="12" /></td> </tr> <tr> <td class="content_left"></td> <td class="content_main"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td rowspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><img src="images/maps/<?php echo $map_image; ?>" width="140" height="78"></td> </tr> <tr> <td align="center"><img src="<?php echo $league_small_image; ?>" width="18" height="16"></td> </tr> </table></td> <td>Status:</td> <td><?php echo $match_status; ?></td> </tr> <tr> <td>Date:</td> <td><?php echo date("D. M. jS", strtotime($match_date)); ?></td> </tr> <tr> <td>Time:</td> <td><?php echo date("g:i a", strtotime($match_date)); ?> EST</td> </tr> <tr> <td>Opponent:</td> <td><?php echo $match_opponent; ?></td> </tr> <tr> <td>Opponent Tag:</td> <td><?php echo $match_opponent_tag; ?></td> </tr> <tr> <td>Map One:</td> <td><?php echo $match_map; ?></td> </tr> <tr> <td>Map Two:</td> <td><?php echo $match_map_two; ?></td> </tr> <tr> <td>Result:</td> <td><?php echo $match_result; ?></td> </tr> <tr> <td>Our Score:</td> <td><?php echo $our_score; ?></td> </tr> <tr> <td>Their Score:</td> <td><?php echo $their_score; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table></td> <td class="content_right"></td> </tr> <tr> <td width="12"><img src="images/content_bottom_left.png" alt="" width="12" height="25" /></td> <td class="content_bottom"></td> <td width="12"><img src="images/content_bottom_right.png" alt="" width="11" height="25" /></td> </tr> </table> <?php } ?>
  3. I'm still pretty new to it myself but I can say that reading the tutorials on this site and just browsing the web for free tutorials has helped me out a lot. I also recommend www.good-tutorials.com they have quite a few php flash photoshop and more different types of tutorials.
  4. Yes, I have been reading my my php and mysql for dummies book about the table joins but for some reason they just confuse me :'( maybe this will help. Here is the code I was using before I made my database like this. $query = mysql_query("SELECT * FROM news ORDER BY news_id DESC LIMIT 0,5"); while($row = mysql_fetch_array($query)) { $news_id = $row['news_id']; $news_title = $row['news_title']; $news_text = $row['news_text']; $news_postedby = $row['news_postedby']; $news_date = $row['news_date']; ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="12"><img src="images/content_top_left.png" width="12" height="12" alt="" /></td> <td class="content_top"></td> <td width="12"><img src="images/content_top_right.png" alt="" width="11" height="12" /></td> </tr> <tr> <td class="content_left"></td> <td class="content_main"><div id="header" align="center"><?php echo $news_title; ?></div> <?php echo $news_text; ?> <div align="center">Posted by:<?php echo $news_postedby; ?> on <?php echo $news_date; ?></div></td> <td class="content_right"></td> </tr> <tr> <td width="12"><img src="images/content_bottom_left.png" alt="" width="12" height="25" /></td> <td class="content_bottom"></td> <td width="12"><img src="images/content_bottom_right.png" alt="" width="11" height="25" /></td> </tr> </table> <?php } ?>
  5. Ok I am trying to display my news and who posted it. But when the news is entered into my database, instead of posting the users name in there I put their ID. So what I want to do is match up their id with the one in the news table so it will then display their username instead of their id. The reason I do it this way is in case the member ever changes their name it will automatically be updated in the news table as well. any help is appreciated.
  6. ok, well I need to sort my player list by name, kills, kia, etc... well here is the code i'm using now. any help is much appreciated. <?php include 'ect/options.php'; function startTag($parser, $name, $attrs) { global $stack; $tag=array("name"=>$name,"attrs"=>$attrs); array_push($stack,$tag); } function cdata($parser, $cdata) { global $stack; $stack[count($stack)-1]['cdata'] .= $cdata; } function endTag($parser, $name) { global $stack; $stack[count($stack)-2]['children'][] = $stack[count($stack)-1]; array_pop($stack); } $stack = array(); $playerstats = array(); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startTag", "endTag"); xml_set_character_data_handler($xml_parser, "cdata"); $xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid"; $data = xml_parse($xml_parser,file_get_contents($xmllink)); if(!$data) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); xml_parser_free($xml_parser); for($i = 0; $i < sizeof($stack[0][children][2][children]); $i++) { for($x = 0; $x < sizeof($stack[0][children][2][children][$i][children]); $x++) { $valname=$stack[0][children][2][children][$i][children][$x][name]; $value=$stack[0][children][2][children][$i][children][$x][cdata]; if($valname=="PLAYERID") $pid=$value; $playerstats[$pid][$valname]=$value; } } foreach($playerstats as $key => $value) { $playername=$playerstats[$key][PLAYERNAME]; $playerhonor=$playerstats[$key][PLAYERHONOR]; $playerurl=$playerstats[$key][PLAYERSTATSURL]; $playerkills=$playerstats[$key][PLAYERKILLS]; $playertime=$playerstats[$key][PLAYERTIME]; $playerdeaths=$playerstats[$key][PLAYERDEATHS]; $playerscore=$playerstats[$key][PLAYERSCORE]; $playergoalscore=$playerstats[$key][PLAYERGOALSCORE]; $playerleaderscore=$playerstats[$key][PLAYERLEADERSCORE]; $playerid=$playerstats[$key][PLAYERID]; $playerfragrate=round($playerkills/$playerdeaths, 2); $playerhours = $playertime/3600; $totalkills +=$playerkills; $totaldeaths +=$playerdeaths; $totalscore +=$playerscore; $totalleader +=$playerleaderscore; $totalgoals +=$playergoalscore; $totalhours +=$playerhours; $avgkdratio = $totalkills/$totaldeaths; $playercount ++; $avggoals = $totalgoals/$playercount; $avgleader = $totalleader/$playercount; $avgscore = $totalscore/$playercount; $avgdeaths = $totaldeaths/$playercount; $avgkills = $totalkills/$playercount; $avghours = $totalhours/$playercount; } if($playerstats[$key][PLAYERSTATUS]=="1") $statuspic="ponline.gif"; else $statuspic="poffline.gif"; ?> <table cellpadding="4" cellspacing="1" width="100%" class="border"> <tr align="left"> <td width="100%">Memberlist of Razer Clan</td> </tr> </table> <hr width="100%" color="#000000" noShade size=1> <table cellpadding="4" cellspacing="1" width="100%" class="border"> <tr align="center"> <td align="center" width="28%" class="border"><b>Username</b></td> <td align="center" width="5%" class="border"><b>Honor</b></td> <td align="center" width="5%" class="border"><b>Kills</b></td> <td align="center" width="5%" class="border"><b>KIA</b></td> <td align="center" width="5%" class="border"><b>FR</b></td> <td align="center" width="5%" class="border"><b>Score</b></td> <td align="center" width="5%" class="border"><b>Leader</b></td> <td align="center" width="5%" class="border"><b>Goals</b></td> <td align="center" width="5%" class="border"><b>HP</b></td> <td align="center" width="4%" class="border"><b>#</b></td> </tr> <? foreach($playerstats as $key => $value) { $playername=$playerstats[$key][PLAYERNAME]; $playerhonor=$playerstats[$key][PLAYERHONOR]; $playerurl=$playerstats[$key][PLAYERSTATSURL]; $playerkills=$playerstats[$key][PLAYERKILLS]; $playertime=$playerstats[$key][PLAYERTIME]; $playerdeaths=$playerstats[$key][PLAYERDEATHS]; $playerscore=$playerstats[$key][PLAYERSCORE]; $playergoalscore=$playerstats[$key][PLAYERGOALSCORE]; $playerleaderscore=$playerstats[$key][PLAYERLEADERSCORE]; $playerid=$playerstats[$key][PLAYERID]; $playerhours = $playertime/3600; if(round($playerkills/$playerdeaths, 2) <= 1) $font = "red"; elseif(round($playerkills/$playerdeaths, 2) >= 2) $font = "green"; else $font = "#ea7500"; ?> <tr align="left"> <td><a href="http://aaotracker.com/usertracker.php?userid=<? echo $playerid; ?>" target="_blank"><? echo $playername; ?></a></td> <td align="center"><? echo $playerhonor; ?> </td> <td align="right"><? echo number_format($playerkills); ?> </td> <td align="right"><? echo number_format($playerdeaths); ?> </td> <td align="center"><font color="<? echo $font; ?>"><b><? echo round($playerkills/$playerdeaths, 2); ?> </b></font></td> <td align="right"><? echo number_format($playerscore); ?></td> <td align="right"><? echo number_format($playerleaderscore); ?></td> <td align="right"><? echo number_format($playergoalscore); ?></td> <td align="center"><? echo number_format($playerhours); ?> </td> <td align="center"><? echo '<img border="0" src="images/'.$statuspic.'" width="16" height="16">'; } ?></td> </tr> </table>
  7. Wow man, you're awesome. once again thanks a lot!
  8. I have one more problem with this script...I need a way to count how many Players there are...any help would be awesome.
  9. My problem is that I can't figure out how to add up everyone's kills to get the total kill. Same for deaths and score Here is the xml document: http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=57691 Here is my code: <?php $clanid="57691"; function startTag($parser, $name, $attrs) { global $stack; $tag=array("name"=>$name,"attrs"=>$attrs); array_push($stack,$tag); } function cdata($parser, $cdata) { global $stack; $stack[count($stack)-1]['cdata'] .= $cdata; } function endTag($parser, $name) { global $stack; $stack[count($stack)-2]['children'][] = $stack[count($stack)-1]; array_pop($stack); } $stack = array(); $claninfo = array(); $clanstats = array(); $playerstats = array(); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startTag", "endTag"); xml_set_character_data_handler($xml_parser, "cdata"); $xmllink="http://aaotracker.4players.de/livefeed/xml_clanprofile.php?clanid=$clanid"; $data = xml_parse($xml_parser,file_get_contents($xmllink)); if(!$data) die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); xml_parser_free($xml_parser); // Get Clan Info Data for($i = 0; $i < sizeof($stack[0][children][0][children]); $i++) { $valname=$stack[0][children][0][children][$i][name]; $claninfo[$valname]=$stack[0][children][0][children][$i][cdata]; } // Get Clan Stats Data for($i = 0; $i < sizeof($stack[0][children][1][children]); $i++) { $valname=$stack[0][children][1][children][$i][name]; $clanstats[$valname]=$stack[0][children][1][children][$i][cdata]; } // Get Player Data for($i = 0; $i < sizeof($stack[0][children][2][children]); $i++) { for($x = 0; $x < sizeof($stack[0][children][2][children][$i][children]); $x++) { $valname=$stack[0][children][2][children][$i][children][$x][name]; $value=$stack[0][children][2][children][$i][children][$x][cdata]; if($valname=="PLAYERID") $pid=$value; $playerstats[$pid][$valname]=$value; } } // Make Clan Info Variables foreach($claninfo as $key => $value) { $clanid=$claninfo[CLANID]; $clanname=$claninfo[CLANNAME]; $clantag=$claninfo[CLANTAG]; $clancountry=$claninfo[CLANCOUNTRY]; } // Make Clan Stats Variables foreach($clanstats as $key => $value) { $avghonor=$clanstats[HONOR]; $avgscore=$clanstats[sCORE]; $avgkills=$clanstats[KILLS]; $avgdeaths=$clanstats[DEATHS]; $avgkdratio=$clanstats[KDRATIO]; $avgroe=$clanstats[ROE]; } // Make Player Stats variables foreach($playerstats as $key => $value) { $playername=$playerstats[$key][PLAYERNAME]; $playerhonor=$playerstats[$key][PLAYERHONOR]; $playerurl=$playerstats[$key][PLAYERSTATSURL]; $playerkills=$playerstats[$key][PLAYERKILLS]; $playertime=$playerstats[$key][PLAYERTIME]; $playerdeaths=$playerstats[$key][PLAYERDEATHS]; $playerscore=$playerstats[$key][PLAYERSCORE]; $playergoalscore=$playerstats[$key][PLAYERGOALSCORE]; $playerleaderscore=$playerstats[$key][PLAYERLEADERSCORE]; $playerid=$playerstats[$key][PLAYERID]; $playerhours = $playertime/3600; } ?> <table width="100%" class="border"> <tr> <td>Clanname:</td> <td><? echo $clanname; ?> </td> </tr> <tr> <td>Clantag:</td> <td><? echo $clantag; ?> </td> </tr> </table> <hr width="100%" color="#000000" noShade size=1> <table width="100%" class="border"> <tr> <td>Total Kills: </td> <td> </td> </tr> <tr> <td>Total Deaths: </td> <td> </td> </tr> <tr> <td>Total Score:</td> <td> </td> </tr> <tr> <td>Total Leader:</td> <td> </td> </tr> <tr> <td>Total Goals: </td> <td> </td> </tr> </table> <hr width="100%" color="#000000" noShade size=1> <table width="100%" class="border"> <tr> <td>Average Honor: </td> <td><? echo $avghonor; ?> </td> </tr> <tr> <td>Average Kills:</td> <td><? echo $avgkills; ?> </td> </tr> <tr> <td>Average Deaths: </td> <td><? echo $avgdeaths; ?> </td> </tr> <tr> <td>Average Fragrate: </td> <td><? echo $avgkdratio; ?> </td> </tr> <tr> <td>Average Score: </td> <td><? echo $avgscore; ?> </td> </tr> <tr> <td>Average Leader: </td> <td> </td> </tr> <tr> <td>Average Goals: </td> <td> </td> </tr> <tr> <td>Average ROE: </td> <td><? echo $avgroe; ?> </td> </tr> <tr> <td>Average Hours Online:</td> <td> </td> </tr> </table>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.