Jump to content

zackcez

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Everything posted by zackcez

  1. Thank you very much, it's all working good now .
  2. I just found out why it wasn't work...If there's no votes for that server in the table, then it doesn't do anything...is there anyway I can just have it return zero...Sorry I didn't even think of that I thought there was still a few rows in it :s.
  3. I think it's used to initiate a certain function etc in a php class but I'm not sure :s.
  4. <?php $result = mysql_query("SELECT * FROM server_status AS s CROSS JOIN (SELECT server_id, SUM(IF(vote=1,1,0))-SUM(IF(vote=-1,1,0)) AS score FROM server_votes GROUP BY server_id) AS v ON s.owner_id = v.server_id ORDER BY s.up, v.score DESC") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo $row['server_name']; // That's a column in the server_status table... echo("hmm"); } ?> Nothing at all :s.
  5. Sorry but...I thought I had it but it doesn't output anything :s: $result = mysql_query("SELECT * FROM server_status AS s CROSS JOIN (SELECT server_id, SUM(IF(vote=1,1,0))-SUM(IF(vote=-1,1,0)) AS score FROM server_votes GROUP BY server_id) AS v ON s.owner_id = v.server_id ORDER BY s.up, v.score DESC"); while($row = mysql_fetch_array($result)) { echo $row['server_name']; // That's a column in the server_status table... }
  6. $db is the database class of vbulletin...it's just a normal mysql_query pretty much.
  7. so it would look like this :s? $result = $db->query_read("SELECT s.*, v.score FROM server_status AS s CROSS JOIN (SELECT server_id, SUM(IF(vote=1,1,0))-SUM(IF(vote=-1,1,0)) AS score FROM server_votes GROUP BY server_id) AS v ON s.owner_id = v.server_id ORDER BY s.up, v.score DESC"); What would I need to change in order to make it work with my fetch_array then?
  8. I'm not sure if this would matter, but within server_status the "server_id" column is actually called "owner_id".
  9. Alright, thanks; But how exactly does the cross join syntax work...I've never used that before ;s.
  10. Would you explain that for me if you could please?
  11. One holds the servers data and the other one holds the servers ranking or "votes"...
  12. Do you mean echoing the rows outside of the while loop or what exactly do you mean?
  13. Well I've done this before I'm just not remembering how...Takes too much thinking for me right now I have this: $result = $db->query_read("SELECT * FROM server_status ORDER BY up DESC"); And this function: function getVotes($id) { $gVotes = mysql_query("SELECT * FROM server_votes WHERE vote='1' AND server_id='" . $id . "'"); $bVotes =mysql_query("SELECT * FROM server_votes WHERE vote='-1' AND server_id='" . $id . "'"); $goodVotes = mysql_num_rows($gVotes); $badVotes = mysql_num_rows($bVotes); return ($goodVotes - $badVotes); } I know that function is ugly but at the moment that's not what I care about. I'd like to know how I can have it order by "up" (which is either a 1 or a 0) and then order by "getVotes"...
  14. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://weblogin.runescape.com/login.ws'); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=REMOVED&password=REMOVED'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec ($ch); curl_close ($ch); if (preg_match("/successful/", $content)) { echo("<br /><b>Correct password"); } else { echo("FAIL"); } ?> No idea how to use curl, but when I have the correct data inputed, I want it to say Correct password...It says fail...I'm thinking i'm Doing it wrong... https://weblogin.runescape.com/login.ws Is where the username and pass are parsed etc...
  15. <?PHP header("Content-type: image/png"); $msn = $_GET['a']; $msn = str_replace(".png", "", $msn); $Back = "background.png"; $Back2 = "background2.png"; $Font = "font.ttf"; $Size = getimagesize($Background); $img = imagecreatetruecolor($Size[0], $Size[1]); $imgBack = imagecreatefrompng($Background); $Green = imagecolorallocate($img, 0, 255, 51); $contents = ''; $handle = fopen("http://www.checkmsnstatus.com/msn-status-checker.php?msn=$msn&check=Check+Status","r"); if($handle){ while (!feof($handle)) { $contents .= fread($handle, 8192);} fclose($handle);} if (stristr($contents, ">Online<")) { $imgBack = imagecreatefrompng($Back); imagecopy($img, $imgBack, 0, 0, 0, 0, $Size[0], $Size[1]); imagettftext($img, 10, 0, 5, 19, 0, $Font, $msn); imagettftext($img, 10, 0, 225, 19, $Green, $Font, "Online"); } else { $imgBack = imagecreatefrompng($Back2); imagecopy($img, $imgBack, 0, 0, 0, 0, $Size[0], $Size[1]); imagettftext($img, 10, 0, 5, 19, 0, $Font, $msn); imagettftext($img, 10, 0, 225, 19, 0, $Font, "Offline"); } imagepng($img); imagedestroy($img); ?> The image “http://127.0.0.1/msn.php?a=mickvickfan@hotmail.com.png” cannot be displayed, because it contains errors. Help is appreciated
  16. I'm just wondering how I can order by two fields Explain: I'm ordering by Level, there's two rows with the same 'Level', then if that happens I want it to order by 'exp'...Example: Bob - Level: 1234 Exp: 432 Sue - Level: 1234 Exp: 1234 Tim - Level: 12 Exp: 5000 I would like it to have Sue ahead, then Bob, then Tim. So basically I want it to first order by "level" if there's more than one row with the same thing, then order those by 'exp' All help is appreciated, Zack
  17. Here's the code: /* Variables */ $search = str_replace("select", "", str_replace("union", "", mysql_real_escape_string($_GET['search']))); $user = str_replace("select", "", str_replace("union", "", mysql_real_escape_string($_GET['user']))); $compare = str_replace("select", "", str_replace("union", "", mysql_real_escape_string($_GET['with']))); $action = str_replace("select", "", str_replace("union", "", mysql_real_escape_string($_GET['action']))); $loggedgroupid = $vbulletin->userinfo['usergroupid']; //Logged in users vBulletin groupid $username = $vbulletin->userinfo['username']; //Logged in users vBulletin username $userid = $vbulletin->userinfo['userid']; //Logged in users vBulletin userid $overallRank = getRank($user, Total); //Gets the total level rank for indivial players $skillNames = array("Attack", "Defence", "Strength", "Hitpoints", "Range", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecrafting"); $miniGames = array("Kills", "Deaths"); foreach ($skillNames as $skill) { $PlayerRank[$skill] = getRank($user, $skill); } foreach ($skillNames as $skill) { $result = mysql_query("SELECT * FROM user WHERE username='$user'") or die(mysql_error()); $row = mysql_fetch_array($result); $PlayerXp[$skill] = number_format($row[$skill . "xp"]); } /* Functions */ function getRank($user, $skill) { if ($skill == 'Total') { $end = "Attackxp + Woodcuttingxp + Defencexp + Strengthxp + Hitpointsxp + Rangexp + Prayerxp + Magicxp + Cookingxp + Fletchingxp + Fishingxp + Firemakingxp + Craftingxp + Smithingxp + Miningxp + Herblorexp + Agilityxp + Thievingxp + Slayerxp + Farmingxp + Runecraftingxp"; } else if($skill == 'Kills' || $skill == 'Deaths') { $end = strtolower($skill); } else { $end = $skill . "xp"; } $rank = 1; $getRankQuery = mysql_query("SELECT * FROM user ORDER BY $end DESC") or die(mysql_error()); while ($rankData = mysql_fetch_array($getRankQuery)) { $groupQuery = mysql_query("SELECT * FROM usergroup WHERE usergroupid='" . $rankData['usergroupid'] . "'") or die(mysql_error()); $groupData = mysql_fetch_array($groupQuery); $endRank[$rankData['username']] = $rank++; } return number_format($endRank["$user"]); } function getPre($id) { $prefixQuery = mysql_query("SELECT * FROM usergroup WHERE usergroupid='$id'"); $groupPreData = mysql_fetch_array($prefixQuery); return $groupPreData['opentag']; } function getSuf($id) { $suffixQuery = mysql_query("SELECT * FROM usergroup WHERE usergroupid='$id'"); $groupSufData = mysql_fetch_array($suffixQuery); return $groupSufData['closetag']; } if(!$username){ echo "No Direct Access"; exit(); } switch ($action) { case user: /* Variables and Ints */ $result = mysql_query("SELECT * FROM user WHERE username='$user'") or die(mysql_error()); $row = mysql_fetch_array($result); $Totallvl = $row[Attacklvl] + $row[Defencelvl] + $row[Woodcuttinglvl] + $row[strengthlvl] + $row[Hitpointslvl] + $row[Rangelvl] + $row[Prayerlvl] + $row[Magiclvl] + $row[Cookinglvl] + $row[Fletchinglvl] + $row[Fishinglvl] + $row[Firemakinglvl] + $row[Craftinglvl] + $row[smithinglvl] + $row[Mininglvl] + $row[Herblorelvl] + $row[Agilitylvl] + $row[Thievinglvl] + $row[slayerlvl] + $row[Farminglvl] + $row[Runecraftinglvl]; $Totalxp = $row[Attackxp] + $row[Woodcuttingxp] + $row[Defencexp] + $row[strengthxp] + $row[Hitpointsxp] + $row[Rangexp] + $row[Prayerxp] + $row[Magicxp] + $row[Cookingxp] + $row[Fletchingxp] + $row[Fishingxp] + $row[Firemakingxp] + $row[Craftingxp] + $row[smithingxp] + $row[Miningxp] + $row[Herblorexp] + $row[Agilityxp] + $row[Thievingxp] + $row[slayerxp] + $row[Farmingxp] + $row[Runecraftingxp]; $TotalLevel = number_format($Totallvl); $TotalXP = number_format($Totalxp); if ($row['username'] == "") { echo"<center>Viewing User: INVALID</center>"; echo"<table class=\"tborder\" align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr align=\"center\"><td align=\"center\" class=\"tcat\" width=\"3%\">Skill</td><td align=\"center\" class=\"tcat\" width=\"18%\">Rank</td><td align=\"center\" class=\"tcat\" width=\"15%\">Level</td><td align=\"center\" class=\"tcat\" width=\"25%\">Xp</td></tr>"; echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">Total</td><td class=\"alt2\" rowspan=\"22\" colspan=\"3\"><center>The data you've happened to 'stumble' upon doesn't match our databases nor any pages of our site; feel free to try again though.</center></td>"; foreach ($skillNames as $skill) { echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">".$skill."</td>"; } echo"</table>"; } else { $pre = getPre($row['usergroupid']); $suf = getSuf($row['usergroupid']); $usernamer = $pre."".$row['username']."".$suf; if ($row['ServerOnline'] == '1') { $on_server = "<font color=\"green\">Online (World 1)</font>"; } elseif($row['ServerOnline'] == '2') { $on_server = "<font color=\"green\">Online (World 2)</font>"; } else { $on_server = "<font color=\"red\">Offline</font>"; } echo"<center>Viewing User: $usernamer | On Server: $on_server</center>"; echo"<table class=\"tborder\" align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr align=\"center\"><td align=\"center\" class=\"tcat\" width=\"3%\">Skill</td><td align=\"center\" class=\"tcat\" width=\"18%\">Rank</td><td align=\"center\" class=\"tcat\" width=\"15%\">Level</td><td align=\"center\" class=\"tcat\" width=\"25%\">Xp</td></tr>"; echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">Total</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">$overallRank</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">$TotalLevel</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">$TotalXP</td>"; foreach ($skillNames as $skill) { echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">".$skill."</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">" . $PlayerRank[$skill] . "</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">" . $row[$skill.'lvl'] . "</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">" . $PlayerXp[$skill] . "</td>"; } echo"<tr align=\"center\"><td align=\"center\" class=\"tcat\" width=\"3%\">Name</td><td align=\"center\" class=\"tcat\" width=\"18%\">Rank</td><td align=\"center\" class=\"tcat\" colspan=\"2\" width=\"15%\">Score</td></tr>"; foreach ($miniGames as $games) { $d = strtolower($games); echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">".$games."</td><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">" . getRank($row['username'], $games) . "</td><td class=\"alt1\" colspan=\"2\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">" . $row[$d] . "</td>"; } echo"</table>"; unset($usernamer); unset($pre); unset($suf); } break; default: $perPage = 25; $data_Query = mysql_query("SELECT * FROM user"); $totalUsers = mysql_num_rows($data_Query); $totalPages = $totalUsers/$perPage; $totalPages = ceil($totalPages); $currentPage = str_replace("select", "", str_replace("union", "", mysql_real_escape_string($_GET['page']))); $m_stat = str_replace("select", "", str_replace("union", "", mysql_real_escape_string($_GET['stat']))); if((!$currentPage) || (is_numeric($currentPage) == false) || ($currentPage < 1) || ($currentPage > $totalPages)) { $currentPage = 1; } $limits = ($p - 1) * $max; $resultsLeft = ($currentPage - 1) * $perPage; $nextPage = $currentPage+1; $prevPage = $currentPage-1; $c = strtolower($m_stat); if(in_array($c, $skillNames) || in_array($m_stat, $skillNames)) { $stat = $m_stat.'xp'; $skill_name = $m_stat; $skill_lvl = $m_stat.'lvl'; } else if(in_array($c, $miniGames) || in_array($m_stat, $miniGames)) { $stat = $c; $skill_name = $m_stat; $skill_lvl = $m_stat; } else { $totalXP = $hsPlayerData[Attackxp] + $hsPlayerData[Woodcuttingxp] + $hsPlayerData[Defencexp] + $hsPlayerData[strengthxp] + $hsPlayerData[Hitpointsxp] + $hsPlayerData[Rangexp] + $hsPlayerData[Prayerxp] + $hsPlayerData[Magicxp] + $hsPlayerData[Cookingxp] + $hsPlayerData[Fletchingxp] + $row[Fishingxp] + $hsPlayerData[Firemakingxp] + $hsPlayerData[Craftingxp] + $hsPlayerData[smithingxp] + $hsPlayerData[Miningxp] + $hsPlayerData[Herblorexp] + $hsPlayerData[Agilityxp] + $hsPlayerData[Thievingxp] + $hsPlayerData[slayerxp] + $hsPlayerData[Farmingxp] + $hsPlayerData[Runecraftingxp] + $hsPlayerData[Hunterxp] + $hsPlayerData[Constructionxp] + $hsPlayerData[summoningxp]; $totalLevel = $hsPlayerData[Attacklvl] + $hsPlayerData[Defencelvl] + $hsPlayerData[Woodcuttinglvl] + $hsPlayerData[strengthlvl] + $hsPlayerData[Hitpointslvl] + $hsPlayerData[Rangelvl] + $hsPlayerData[Prayerlvl] + $hsPlayerData[Magiclvl] + $hsPlayerData[Cookinglvl] + $hsPlayerData[Fletchinglvl] + $hsPlayerData[Fishinglvl] + $hsPlayerData[Firemakinglvl] + $hsPlayerData[Craftinglvl] + $hsPlayerData[smithinglvl] + $hsPlayerData[Mininglvl] + $hsPlayerData[Herblorelvl] + $hsPlayerData[Agilitylvl] + $hsPlayerData[Thievinglvl] + $hsPlayerData[slayerlvl] + $hsPlayerData[Farminglvl] + $hsPlayerData[Runecraftinglvl] + $hsPlayerData[Hunterlvl] + $hsPlayerData[Constructionlvl] + $hsPlayerData[summoningxp]; $skill_name = Overall; $skill_lvl = $totalLevel; $stat = "Attackxp + Woodcuttingxp + Defencexp + Strengthxp + Hitpointsxp + Rangexp + Prayerxp + Magicxp + Cookingxp + Fletchingxp + Fishingxp + Firemakingxp + Craftingxp + Smithingxp + Miningxp + Herblorexp + Agilityxp + Thievingxp + Slayerxp + Farmingxp + Runecraftingxp + Hunterxp + Constructionxp + Summoningxp"; } switch ($skill_name) { case Kills: echo "<table class=\"tborder\" align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr align=\"center\"><td align=\"center\" class=\"tcat\" width=\"3%\">Rank</td><td align=\"center\" class=\"tcat\" width=\"18%\">User Name</td><td align=\"center\" class=\"tcat\" width=\"15%\">$skill_name</td></tr>"; break; case Deaths: echo "<table class=\"tborder\" align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr align=\"center\"><td align=\"center\" class=\"tcat\" width=\"3%\">Rank</td><td align=\"center\" class=\"tcat\" width=\"18%\">User Name</td><td align=\"center\" class=\"tcat\" width=\"15%\">$skill_name</td></tr>"; break; default: echo "<table class=\"tborder\" align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr align=\"center\"><td align=\"center\" class=\"tcat\" width=\"3%\">Rank</td><td align=\"center\" class=\"tcat\" width=\"18%\">User Name</td><td align=\"center\" class=\"tcat\" width=\"15%\">$skill_name Level</td><td align=\"center\" class=\"tcat\" width=\"25%\">$skill_name Experience</td></tr>"; break; } $i = ($currentPage - 1) * $perPage; $highscoresQuery = $db->query_read("SELECT * FROM user ORDER BY $stat DESC LIMIT ".$resultsLeft.",$perPage"); while ($hsPlayerData = $db->fetch_array($highscoresQuery)) { $pre = getPre($hsPlayerData['usergroupid']); $suf = getSuf($hsPlayerData['usergroupid']); $usernamer = $pre."".$hsPlayerData['username']."".$suf; if ($skill_name != Overall) { $full_skill = number_format($hsPlayerData[$skill_lvl]); $full_number = number_format($hsPlayerData[$stat]); } else if ($skill_name == Overall) { $totalXP = $hsPlayerData[Attackxp] + $hsPlayerData[Woodcuttingxp] + $hsPlayerData[Defencexp] + $hsPlayerData[strengthxp] + $hsPlayerData[Hitpointsxp] + $hsPlayerData[Rangexp] + $hsPlayerData[Prayerxp] + $hsPlayerData[Magicxp] + $hsPlayerData[Cookingxp] + $hsPlayerData[Fletchingxp] + $hsPlayerData[Fishingxp] + $hsPlayerData[Firemakingxp] + $hsPlayerData[Craftingxp] + $hsPlayerData[smithingxp] + $hsPlayerData[Miningxp] + $hsPlayerData[Herblorexp] + $hsPlayerData[Agilityxp] + $hsPlayerData[Thievingxp] + $hsPlayerData[slayerxp] + $hsPlayerData[Farmingxp] + $hsPlayerData[Runecraftingxp] + $hsPlayerData[Hunterxp] + $hsPlayerData[Constructionxp] + $hsPlayerData[summoningxp]; $totalLevel = $hsPlayerData[Attacklvl] + $hsPlayerData[Defencelvl] + $hsPlayerData[Woodcuttinglvl] + $hsPlayerData[strengthlvl] + $hsPlayerData[Hitpointslvl] + $hsPlayerData[Rangelvl] + $hsPlayerData[Prayerlvl] + $hsPlayerData[Magiclvl] + $hsPlayerData[Cookinglvl] + $hsPlayerData[Fletchinglvl] + $hsPlayerData[Fishinglvl] + $hsPlayerData[Firemakinglvl] + $hsPlayerData[Craftinglvl] + $hsPlayerData[smithinglvl] + $hsPlayerData[Mininglvl] + $hsPlayerData[Herblorelvl] + $hsPlayerData[Agilitylvl] + $hsPlayerData[Thievinglvl] + $hsPlayerData[slayerlvl] + $hsPlayerData[Farminglvl] + $hsPlayerData[Runecraftinglvl] + $hsPlayerData[Hunterlvl] + $hsPlayerData[Constructionlvl] + $hsPlayerData[summoninglvl]; $full_skill = number_format($totalLevel); $full_number = number_format($totalXP); } $i++; //Increases Rank Count After Each User if(in_array($skill_name, $miniGames) { echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">$i</td>"; echo"<td class=\"alt1\" nowrap=\"nowrap\" width=\"15%\" align=\"left\"><a href=\"index.php?pageid=highscores&action=user&user=" . $hsPlayerData['username'] . "\">$usernamer</a></td>"; //Name echo"<td class=\"alt1\" nowrap=\"nowrap\" width=\"10%\" align=\"left\">$full_skill</td>"; } else { echo"<tr align=\"center\"><td class=\"alt1\" nowrap=\"nowrap\" width=\"5%\" align=\"left\">$i</td>"; //Rank echo"<td class=\"alt1\" nowrap=\"nowrap\" width=\"15%\" align=\"left\"><a href=\"index.php?pageid=highscores&action=user&user=" . $hsPlayerData['username'] . "\">$usernamer</a></td>"; //Name echo"<td class=\"alt1\" nowrap=\"nowrap\" width=\"10%\" align=\"left\">$full_skill</td>"; //Level echo"<td class=\"alt1\" nowrap=\"nowrap\" width=\"15%\" align=\"left\">$full_number</td></tr>"; //XP } } $db->free_result($highscoresQuery); unset($hsPlayerData); echo"</table>"; echo"<div class=\"alt2 block_row\" id=\"visitor_message_tab_footer\">"; echo"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">"; echo"<tr valign=\"bottom\"><td class=\"smallfont\" align=\"right\">"; echo"<div class=\"pagenav\" align=\"right\"><table class=\"tborder\" cellpadding=\"3\" cellspacing=\"1\" border=\"0\">"; echo"<tr>"; echo"<td class=\"vbmenu_control\" style=\"font-weight:normal\">Page $currentPage of $totalPages</td>"; $remSkill = "&stat=".$m_stat; if ($currentPage > 1) { $thePrev = $prevPage; echo"<td class=\"alt1\"><a class=\"smallfont\" href=\"index.php?pageid=highscores".$remSkill."&page=".$thePrev."\" title=\"Previous\"><</a></td>"; do { echo"<td class=\"alt1\"><a class=\"smallfont\" href=\"index.php?pageid=highscores".$remSkill."&page=".$thePrev."\" title=\"Current Results Showing Later\">$thePrev</a></td>"; $thePrev--; } while ($thePrev >= 1); } echo"<td class=\"alt2\"><span class=\"smallfont\" title=\"Showing ".$resultsLeft."\"><strong>$currentPage</strong></span></td>"; if ($nextPage <= $totalPages) { $theNext = $nextPage; do { echo"<td class=\"alt1\"><a class=\"smallfont\" href=\"index.php?pageid=highscores".$remSkill."&page=".$theNext."\" title=\"Current Results Showing Later\">$theNext</a></td>"; $theNext++; } while ($theNext <= $totalPages); echo"<td class=\"alt1\"><a class=\"smallfont\" href=\"index.php?pageid=highscores".$remSkill."&page=".$nextPage."\" title=\"Current Results Showing Later\">></a></td>"; } echo"<td class=\"vbmenu_control\" title=\"Go To\"><a name=\"PageNav\"></a></td>"; echo"</tr></table></td></tr></table></div></div>"; break; } Ik it's messy lol... Error: Parse error: syntax error, unexpected '{' in C:\www\vhosts\localhost\modules\highscores.php on line 162
  18. No, I just want it to get the name field, then tell the rest of the data for that 'NPCDef'
  19. Well basically I have an xml file that's set up like this: <NPCDef-array> <NPCDef> <name>Unicorn</name> <description>It's a unicorn</description> <command></command> <attack>21</attack> <strength>23</strength> <hits>19</hits> <defense>23</defense> <attackable>true</attackable> <aggressive>false</aggressive> <respawnTime>30</respawnTime> <sprites> <int>130</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> <int>-1</int> </sprites> <hairColour>0</hairColour> <topColour>0</topColour> <bottomColour>0</bottomColour> <skinColour>0</skinColour> <camera1>201</camera1> <camera2>230</camera2> <walkModel>6</walkModel> <combatModel>6</combatModel> <combatSprite>7</combatSprite> <drops> <ItemDropDef> <id>20</id> <amount>1</amount> <weight>0</weight> </ItemDropDef> <ItemDropDef> <id>466</id> <amount>1</amount> <weight>0</weight> </ItemDropDef> </drops> </NPCDef> There's about 10k entries though...I'm wondering if/how it's possible to retrieve something like...say I have a GET variable of name...I'd like it to then look through the file to find the entry with the name in the get...I've looked for quiet a bit and all I've managed to find is how to parse/output all data in table...
  20. Well here's the partial of my code: } else { if ($serverCount == '1') { if (!isset($_POST['server_name']) || !isset($_POST['server_ip']) || !isset($_POST['server_features']) { //Line with error //eror message stating please complete all required fields } else { $server_ip = $_POST['server_ip']; $fp = @fsockopen($server_ip, 43594, $errno, $errstr, 10); if ($fp) { $updateData = mysql_query("UPDATE server_status SET server_ip='".$_POST['server_ip']."', server_site='".$_POST['server_site']."', up='1', total_uptime='1', total_downtime='0', server_features='".$_POST['server_features']."' WHERE server_id='".$myData['server_id']."'"); } else { //Error saying something like server offline } } } elseif ($serverCount == '0') { if (!isset($_POST['server_name']) || !isset($_POST['server_ip']) || !isset($_POST['server_features']) { //eror message stating please complete all required fields } else { $server_ip = $_POST['server_ip']; $fp = @fsockopen($server_ip, 43594, $errno, $errstr, 10); if ($fp) { $insertData = mysql_query("INSERT INTO server_status (owner_id, server_ip, server_site, server_features) VALUES('".$userid."', '".$_POST['server_ip']."', '".$_POST['server_site']."', '".$_POST['server_features']."')"); } else { //erorr saying offline } } } else { die(); } } Proabably something stupid i missed, but if anyone can see it, please tell me lol
  21. Okay lets then say this is my code again: $percent = (total_uptime / (total_uptime + total_downtime)) * 100; Any ideas then lol?
  22. Also, here's the query $query = $db->query('SELECT * FROM server_status ORDER BY up && ".$percent." DESC');
  23. No it's still not working :s, here's my complete code with the values that are in my db: $percent = total_uptime / (total_uptime + total_downtime) * 100; //1 / by 1+0 = 1 * 100 = 100
×
×
  • 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.