it keep giving me this at every hiscore any idea how to fix?Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/arabiaxn/public_html/hiscores/index.php on line 178
|
now when i go hiscore my server players doesnt connect to the hiscores
www.arabiax.net/hiscores
It Does Not Load Players To Hiscores!
now it doesnt show anything idk why it connect correctly and my hiscoreshandler.java is
Code:package server.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import server.model.players.Client; /** * * @author Joshua F * @author PJNoMore * */ public class HiscoresHandler { private static boolean HiScores = true; private static final String DB = "arabiaxn_hiscore"; private static final String URL = "http://www.arabiax.net"; private static final String USER = "arabiaxn_hiscore"; private static final String PASS = "******"; private static final Properties prop; static { prop = new Properties(); prop.put("user", USER); prop.put("password", PASS); //prop.put("autoReconnect", "true"); //prop.put("maxReconnects", "4"); } public static Connection conn = null; /** * Connects to the database */ public static synchronized void connect() { try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://" + URL + "/" + DB, prop); System.out.println("Hiscores Handler: Success"); } catch (Exception e) { System.out.println("Hiscores Handler Error: "+ e); System.out.println("Setting hiscores to false to help not cause anymore errors."); HiScores = false; } } public static synchronized Connection getConnection() { try { if (conn == null || conn.isClosed()) { conn = DriverManager.getConnection("jdbc:mysql://" + URL + "/" + DB, prop); } } catch (SQLException e) { System.out.println(e); e.printStackTrace(); } return conn; } /** * The main method that is called upon logout */ public static void hiscoresHandler(Client c) { if (HiScores == true) { deleteHiscores(c); saveHiscores(c); } } /** * Part of the main method to save the hiscores */ private static synchronized void saveHiscores(Client c) { try { int overallLVL = 0; double overallXP = 0; for (int i = 0; i < 21; i++) { overallLVL += c.getLevelForXP(c.playerXP[i]); overallXP += c.playerXP[i]; } getConnection().createStatement().execute( "INSERT INTO `hiscores` VALUES ('" + c.playerName + "', '" + c.playerRights + "', '" + c.isDonator + "', '" + overallLVL + "', '" + overallXP + "', '" + c.playerXP[0] + "', '" + c.playerXP[1] + "', '" + c.playerXP[2] + "', '" + c.playerXP[3] + "', '" + c.playerXP[4] + "', '" + c.playerXP[5] + "', '" + c.playerXP[6] + "', '" + c.playerXP[7] + "', '" + c.playerXP[8] + "', '" + c.playerXP[9] + "', '" + c.playerXP[10] + "', '" + c.playerXP[11] + "', '" + c.playerXP[12] + "', '" + c.playerXP[13] + "', '" + c.playerXP[14] + "', '" + c.playerXP[15] + "', '" + c.playerXP[16] + "', '" + c.playerXP[17] + "', '" + c.playerXP[18] + "', '" + c.playerXP[19] + "', '" + c.playerXP[20] + "')"); } catch (Exception e) { e.printStackTrace(); } } /** * Part of the main method to save the hiscores */ private static synchronized void deleteHiscores(Client c) { try { getConnection().createStatement().execute( "DELETE FROM `hiscores` WHERE `playerName` = '" + c.playerName + "'"); } catch (Exception e) { e.printStackTrace(); } } /** * Will wipe out the hiscores table, therefor cleaning them */ public static synchronized void clearHiscores() { try { getConnection().createStatement().execute( "TRUNCATE TABLE `hiscores`"); } catch (Exception e) { e.printStackTrace(); } } }
This AND BELOW IS OLD AND NO MORE (DOWN)
Code:Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/arabiaxn/public_html/hiscores/index.php on line 178
MY hiscoreshandler.java have this code
this is my configCode:private static final String DB = "arabiaxn_hiscore"; private static final String URL = "www.arabiax.net"; private static final String USER = "arabiaxn_hiscore"; private static final String PASS = "*****";
and this is INDEX.PHPCode:<?php /** * Database information */ $host = "www.arabiax.net"; $username = "hiscore"; $password = "******"; $database = "arabiaxn_hiscore"; /** * Settings */ $sitename = "ArabiaX"; $homelink = "http://arabiax.net/"; $forumslink = "http://arabiax.net/forum"; $footertext = "Copyright © <a href='".$homelink."'>".$sitename."</a> 2011."; $minimun_xp = 13363; // http://www.tip.it/runescape/?page=xp_table.htm $highestrights = 3; // Highest playerRights that will count towards the highscores, mostly used so that those who use master don't show on the highscores /** * Ad settings */ $enableads = false; $ad_client = 'ca-pub-4485576586499330'; // google_ad_client $ad_slot = '4705518926'; // google_ad_slot $ad_width = 728; // google_ad_width $ad_height = 90; // google_ad_height /** * Group looks */ $user_prefix = ''; // Prefix for regular users $user_suffix = ''; // Suffix for regular users $donator_prefix = '<font color="gold">$</font> '; // Prefix for donators $donator_suffix = ''; // Suffix for donators $mod_prefix = '<img src="./imgs/crown_silver.gif" border="0" /> '; // Prefix for mods $mod_suffix = ''; // Suffix for mods $admin_prefix = '<img src="./imgs/crown_gold.gif" border="0" /> '; // Prefix for admins $admin_suffix = ''; // Suffix for admins $owner_prefix = '<img src="./imgs/crown_gold.gif" border="0" /> '; // Prefix for owners $owner_suffix = ''; // Suffix for owners ?>
here is my index.php
Code:<?php /*======================================================================*\ || #################################################################### || || # ----------------------------Hiscores---------------------------- # || || # Script by Joshua F # || || #################################################################### || \*======================================================================*/ require_once 'config.php'; require_once 'Hiscores.class.php'; require_once 'Skills.class.php'; $hiscores = new Hiscores(); $skills = new Skills(); if ($_GET['table'] == null || !is_numeric($_GET['table']) || $_GET['table'] > 20 || $_GET['table'] < 0) { $_GET['table'] = -1; } if ($_GET['from'] == null || empty($_GET['from']) || !is_numeric($_GET['from']) || $_GET['from'] < 1) { $_GET['from'] = 0; $rank = 1; } else { $rank = $_GET['from'] + 1; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="icon" type="image/x-icon" href="favicon.ico" /> <meta http-equiv="Content-Language" content="en, English"> <title><?php echo $sitename; ?></title> <style type="text/css">/*\*/@import url(css/global-30.css);/**/</style> <style type="text/css">/*\*/@import url(css/hiscores-28.css);/**/</style> <script type="text/javascript" src="http://www.jagex.com/js/jquery/jquery_1_4_2.js"></script> </head> <body id="navcommunity"> <div id="scroll"> <div id="head"> <?php if ($enableads) { echo '<script type="text/javascript">'; echo 'google_ad_client = "'.$ad_client.'";'; echo 'google_ad_slot = "'.$ad_slot.'";'; echo 'google_ad_width = '.$ad_width.';'; echo 'google_ad_height = '.$ad_height.';'; echo '</script>'; echo '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>'; } ?> <div id="menubox"> <ul id="menus"> <li class="top"><a href="<?php echo $homelink; ?>" id="home" class="tl"><span class="ts">Home</span> </a> </li> <li class="top"><a class="tl" href="#"><span class="ts">Play Now</span> <!--[if gt IE 6]><!--> </a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="http://arabiax.webs.com/webclient" class="fly"><span>Web Client</span> </a> </li> <li><a href="http://dl.dropbox.com/u/25090529/client.jar" class="fly"><span>Download Client</span> </a> </li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li> <li class="top"><a class="tl" href="#"><span class="ts">Community</span> <!--[if gt IE 6]><!--> </a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="<?php echo $forumslink; ?>" class="fly"><span>Forums</span> </a> </li> <li><a href="index.php" class="fly"><span>Highscores</span> </a> </li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li> </ul> </div> <div class="navigation"> <div class="location"> <b>Location: </b> <a href="<?php echo $homelink; ?>">Home</a> > <?php echo $sitename; ?> Hiscores </div> </div> </div> <div id="content"> <div id="article"> <div class="sectionHeader"> <div class="left"> <div class="right"> <div class="plaque"><?php echo $sitename; ?> Hiscores</div> </div> </div> </div> <div class="section"> <div class="brown_background"> <div id="hiscores_background" class="inner_brown_background"> <div class="center_container2"> <div id="skillsList_back" class="brown_box"> <div class="subsectionHeader">Skills</div> <div id="skillsList"> <ul> <li <?php if($_GET['table'] == -1) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php" target="_self" class="Overall ico">Overall</a></li> <li <?php if($_GET['table'] == 0) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=0" target="_self" class="Attack ico">Attack</a></li> <li <?php if($_GET['table'] == 1) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=1" target="_self" class="Defence ico">Defence</a></li> <li <?php if($_GET['table'] == 2) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=2" target="_self" class="Strength ico">Strength</a></li> <li <?php if($_GET['table'] == 3) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=3" target="_self" class="Hitpoints ico">Hitpoints</a></li> <li <?php if($_GET['table'] == 4) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=4" target="_self" class="Ranged ico">Ranged</a></li> <li <?php if($_GET['table'] == 5) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=5" target="_self" class="Prayer ico">Prayer</a></li> <li <?php if($_GET['table'] == 6) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=6" target="_self" class="Magic ico">Magic</a></li> <li <?php if($_GET['table'] == 7) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=7" target="_self" class="Cooking ico">Cooking</a></li> <li <?php if($_GET['table'] == 8) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=8" target="_self" class="Woodcutting ico">Woodcutting</a></li> <li <?php if($_GET['table'] == 9) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=9" target="_self" class="Fletching ico">Fletching</a></li> <li <?php if($_GET['table'] == 10) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=10" target="_self" class="Fishing ico">Fishing</a></li> <li <?php if($_GET['table'] == 11) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=11" target="_self" class="Firemaking ico">Firemaking</a></li> <li <?php if($_GET['table'] == 12) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=12" target="_self" class="Crafting ico">Crafting</a></li> <li <?php if($_GET['table'] == 13) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=13" target="_self" class="Smithing ico">Smithing</a></li> <li <?php if($_GET['table'] == 14) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=14" target="_self" class="Mining ico">Mining</a></li> <li <?php if($_GET['table'] == 15) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=15" target="_self" class="Herblore ico">Herblore</a></li> <li <?php if($_GET['table'] == 16) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=16" target="_self" class="Agility ico">Agility</a></li> <li <?php if($_GET['table'] == 17) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=17" target="_self" class="Thieving ico">Thieving</a></li> <li <?php if($_GET['table'] == 18) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=18" target="_self" class="Slayer ico">Slayer</a></li> <li <?php if($_GET['table'] == 19) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=19" target="_self" class="Farming ico">Farming</a></li> <li <?php if($_GET['table'] == 20) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=20" target="_self" class="Runecraft ico">Runecrafting</a></li> </ul> </div> </div> <div id="modeSelect_back" class="brown_box"> <div class="buttons"> <a id="button-left" href="#"> <span class="lev1a"></span> Skills </a> <a id="button-right" href="#"> <span class="lev1"></span> </a> </div> </div> <div id="playerList_back" class="brown_box"> <div id="scores_head" class="subsectionHeader" style="padding: 0px;"> <img src="imgs/hiscores/skill_icon_<?php echo $hiscores->getSkillnamebyid($_GET['table']); ?>1.gif"><?php echo ucWords($hiscores->getSkillnamebyid($_GET['table'])); ?> Hiscores </div> <table border="0" width="93%" class="table_back"> <tbody> <thead> <tr class="table_header"> <th class="rankHead">Rank</th> <th class="nameHead">Name</th> <th class="levelHead">Level</th> <th class="xpHead">XP</th> </tr> </thead> </tbody> <?php $row = $hiscores->listScores($_GET['table'], $_GET['from']) or die(mysqli_error()); $number = 1; while($result = $row->fetch_assoc()){ echo '<tr class="row row'.$number.'">'; echo '<td class="rankCol">'.$rank.'</td>'; if (ucWords(strtolower($_GET['user'])) == ucWords(strtolower($result['playerName']))) { echo '<td class="alL"><a href="personal.php?character='.$result['playerName'].'"><span class="ARow">'.$hiscores->formatPlayer($result['playerName']).'</span></a></td>'; } else { echo '<td class="alL"><a href="personal.php?character='.$result['playerName'].'">'.$hiscores->formatPlayer($result['playerName']).'</a></td>'; } if ($_GET['table'] == -1) { echo '<td class="alL">'.number_format($result['LVL']).'</td>'; echo '<td class="alL">'.number_format($result['XP']).'</td>'; } else { echo '<td class="alL">'.$skills->getLevelForXP($result[$_GET['table']]).'</td>'; echo '<td class="alL">'.number_format($result[$_GET['table']]).'</td>'; } echo '</tr>'; $rank++; $number++; } ?> </table> <div class="arrow_header"></div> <div class="arrow_back"> <div class="buttons_arrows"> <?php $u = $_GET['from']; if($u - 22 < 0) { $u = 0; } else { $u -= 22; } ?> <a id="button-up" href="index.php?table=<?php echo $_GET['table']; ?>&from=<?php echo $u; ?>"><span class="lev1_arrow"></span>U</a> <a id="button-down" href="index.php?table=<?php echo $_GET['table']; ?>&from=<?php echo $_GET['from'] + 22; ?>"><span class="lev1_arrow"></span>D</a> </div> </div> </div> <div id="search_back" class="brown_box"> <div class="subsectionHeader search_title">Search by Name</div> <div class="search_small"> <div class="searchContent"> <form method="get" action="personal.php"> <input class="textinput text" maxlength="12" type="text" name="character" id="character"><br /> <input class="buttonmedium" type="submit" value="Search"> </form> </div> </div> <div class="subsectionHeader search_title"><?php echo $sitename; ?> Forums</div> <div class="search_large" id="friends_search"> <div class="friendsContent"> To go to the<br> <?php echo $sitename; ?><br> Forums<br> <form action="<?php echo $forumslink; ?>" class="no_margin"> <input id="search_friends" type="submit" class="buttonmedium" value="Click Here"> </form> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div id="footer"> <div class="contain"> <div class="footerdesc"><?php echo $footertext; ?></div> </div> </div> </div> </body> </html>
it keep giving me this at every hiscore any idea how to fix?Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/arabiaxn/public_html/hiscores/index.php on line 178
Bump
Post your index.php, or line 178
here is my index.php
Code:<?php /*======================================================================*\ || #################################################################### || || # ----------------------------Hiscores---------------------------- # || || # Script by Joshua F # || || #################################################################### || \*======================================================================*/ require_once 'config.php'; require_once 'Hiscores.class.php'; require_once 'Skills.class.php'; $hiscores = new Hiscores(); $skills = new Skills(); if ($_GET['table'] == null || !is_numeric($_GET['table']) || $_GET['table'] > 20 || $_GET['table'] < 0) { $_GET['table'] = -1; } if ($_GET['from'] == null || empty($_GET['from']) || !is_numeric($_GET['from']) || $_GET['from'] < 1) { $_GET['from'] = 0; $rank = 1; } else { $rank = $_GET['from'] + 1; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="icon" type="image/x-icon" href="favicon.ico" /> <meta http-equiv="Content-Language" content="en, English"> <title><?php echo $sitename; ?></title> <style type="text/css">/*\*/@import url(css/global-30.css);/**/</style> <style type="text/css">/*\*/@import url(css/hiscores-28.css);/**/</style> <script type="text/javascript" src="http://www.jagex.com/js/jquery/jquery_1_4_2.js"></script> </head> <body id="navcommunity"> <div id="scroll"> <div id="head"> <?php if ($enableads) { echo '<script type="text/javascript">'; echo 'google_ad_client = "'.$ad_client.'";'; echo 'google_ad_slot = "'.$ad_slot.'";'; echo 'google_ad_width = '.$ad_width.';'; echo 'google_ad_height = '.$ad_height.';'; echo '</script>'; echo '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>'; } ?> <div id="menubox"> <ul id="menus"> <li class="top"><a href="<?php echo $homelink; ?>" id="home" class="tl"><span class="ts">Home</span> </a> </li> <li class="top"><a class="tl" href="#"><span class="ts">Play Now</span> <!--[if gt IE 6]><!--> </a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="http://arabiax.webs.com/webclient" class="fly"><span>Web Client</span> </a> </li> <li><a href="http://dl.dropbox.com/u/25090529/client.jar" class="fly"><span>Download Client</span> </a> </li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li> <li class="top"><a class="tl" href="#"><span class="ts">Community</span> <!--[if gt IE 6]><!--> </a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="<?php echo $forumslink; ?>" class="fly"><span>Forums</span> </a> </li> <li><a href="index.php" class="fly"><span>Highscores</span> </a> </li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li> </ul> </div> <div class="navigation"> <div class="location"> <b>Location: </b> <a href="<?php echo $homelink; ?>">Home</a> > <?php echo $sitename; ?> Hiscores </div> </div> </div> <div id="content"> <div id="article"> <div class="sectionHeader"> <div class="left"> <div class="right"> <div class="plaque"><?php echo $sitename; ?> Hiscores</div> </div> </div> </div> <div class="section"> <div class="brown_background"> <div id="hiscores_background" class="inner_brown_background"> <div class="center_container2"> <div id="skillsList_back" class="brown_box"> <div class="subsectionHeader">Skills</div> <div id="skillsList"> <ul> <li <?php if($_GET['table'] == -1) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php" target="_self" class="Overall ico">Overall</a></li> <li <?php if($_GET['table'] == 0) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=0" target="_self" class="Attack ico">Attack</a></li> <li <?php if($_GET['table'] == 1) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=1" target="_self" class="Defence ico">Defence</a></li> <li <?php if($_GET['table'] == 2) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=2" target="_self" class="Strength ico">Strength</a></li> <li <?php if($_GET['table'] == 3) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=3" target="_self" class="Hitpoints ico">Hitpoints</a></li> <li <?php if($_GET['table'] == 4) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=4" target="_self" class="Ranged ico">Ranged</a></li> <li <?php if($_GET['table'] == 5) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=5" target="_self" class="Prayer ico">Prayer</a></li> <li <?php if($_GET['table'] == 6) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=6" target="_self" class="Magic ico">Magic</a></li> <li <?php if($_GET['table'] == 7) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=7" target="_self" class="Cooking ico">Cooking</a></li> <li <?php if($_GET['table'] == 8) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=8" target="_self" class="Woodcutting ico">Woodcutting</a></li> <li <?php if($_GET['table'] == 9) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=9" target="_self" class="Fletching ico">Fletching</a></li> <li <?php if($_GET['table'] == 10) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=10" target="_self" class="Fishing ico">Fishing</a></li> <li <?php if($_GET['table'] == 11) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=11" target="_self" class="Firemaking ico">Firemaking</a></li> <li <?php if($_GET['table'] == 12) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=12" target="_self" class="Crafting ico">Crafting</a></li> <li <?php if($_GET['table'] == 13) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=13" target="_self" class="Smithing ico">Smithing</a></li> <li <?php if($_GET['table'] == 14) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=14" target="_self" class="Mining ico">Mining</a></li> <li <?php if($_GET['table'] == 15) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=15" target="_self" class="Herblore ico">Herblore</a></li> <li <?php if($_GET['table'] == 16) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=16" target="_self" class="Agility ico">Agility</a></li> <li <?php if($_GET['table'] == 17) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=17" target="_self" class="Thieving ico">Thieving</a></li> <li <?php if($_GET['table'] == 18) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=18" target="_self" class="Slayer ico">Slayer</a></li> <li <?php if($_GET['table'] == 19) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=19" target="_self" class="Farming ico">Farming</a></li> <li <?php if($_GET['table'] == 20) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=20" target="_self" class="Runecraft ico">Runecrafting</a></li> </ul> </div> </div> <div id="modeSelect_back" class="brown_box"> <div class="buttons"> <a id="button-left" href="#"> <span class="lev1a"></span> Skills </a> <a id="button-right" href="#"> <span class="lev1"></span> </a> </div> </div> <div id="playerList_back" class="brown_box"> <div id="scores_head" class="subsectionHeader" style="padding: 0px;"> <img src="imgs/hiscores/skill_icon_<?php echo $hiscores->getSkillnamebyid($_GET['table']); ?>1.gif"><?php echo ucWords($hiscores->getSkillnamebyid($_GET['table'])); ?> Hiscores </div> <table border="0" width="93%" class="table_back"> <tbody> <thead> <tr class="table_header"> <th class="rankHead">Rank</th> <th class="nameHead">Name</th> <th class="levelHead">Level</th> <th class="xpHead">XP</th> </tr> </thead> </tbody> <?php $row = $hiscores->listScores($_GET['table'], $_GET['from']) or die(mysqli_error()); $number = 1; while($result = $row->fetch_assoc()){ echo '<tr class="row row'.$number.'">'; echo '<td class="rankCol">'.$rank.'</td>'; if (ucWords(strtolower($_GET['user'])) == ucWords(strtolower($result['playerName']))) { echo '<td class="alL"><a href="personal.php?character='.$result['playerName'].'"><span class="ARow">'.$hiscores->formatPlayer($result['playerName']).'</span></a></td>'; } else { echo '<td class="alL"><a href="personal.php?character='.$result['playerName'].'">'.$hiscores->formatPlayer($result['playerName']).'</a></td>'; } if ($_GET['table'] == -1) { echo '<td class="alL">'.number_format($result['LVL']).'</td>'; echo '<td class="alL">'.number_format($result['XP']).'</td>'; } else { echo '<td class="alL">'.$skills->getLevelForXP($result[$_GET['table']]).'</td>'; echo '<td class="alL">'.number_format($result[$_GET['table']]).'</td>'; } echo '</tr>'; $rank++; $number++; } ?> </table> <div class="arrow_header"></div> <div class="arrow_back"> <div class="buttons_arrows"> <?php $u = $_GET['from']; if($u - 22 < 0) { $u = 0; } else { $u -= 22; } ?> <a id="button-up" href="index.php?table=<?php echo $_GET['table']; ?>&from=<?php echo $u; ?>"><span class="lev1_arrow"></span>U</a> <a id="button-down" href="index.php?table=<?php echo $_GET['table']; ?>&from=<?php echo $_GET['from'] + 22; ?>"><span class="lev1_arrow"></span>D</a> </div> </div> </div> <div id="search_back" class="brown_box"> <div class="subsectionHeader search_title">Search by Name</div> <div class="search_small"> <div class="searchContent"> <form method="get" action="personal.php"> <input class="textinput text" maxlength="12" type="text" name="character" id="character"><br /> <input class="buttonmedium" type="submit" value="Search"> </form> </div> </div> <div class="subsectionHeader search_title"><?php echo $sitename; ?> Forums</div> <div class="search_large" id="friends_search"> <div class="friendsContent"> To go to the<br> <?php echo $sitename; ?><br> Forums<br> <form action="<?php echo $forumslink; ?>" class="no_margin"> <input id="search_friends" type="submit" class="buttonmedium" value="Click Here"> </form> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div id="footer"> <div class="contain"> <div class="footerdesc"><?php echo $footertext; ?></div> </div> </div> </div> </body> </html>
Try this:
Also replace this with this:Code:<?php /*======================================================================*\ || #################################################################### || || # ----------------------------Hiscores---------------------------- # || || # Script by Joshua F # || || #################################################################### || \*======================================================================*/ require_once 'config.php'; require_once 'Hiscores.class.php'; require_once 'Skills.class.php'; $hiscores = new Hiscores(); $skills = new Skills(); if ($_GET['table'] == null || !is_numeric($_GET['table']) || $_GET['table'] > 20 || $_GET['table'] < 0) { $_GET['table'] = -1; } if ($_GET['from'] == null || empty($_GET['from']) || !is_numeric($_GET['from']) || $_GET['from'] < 1) { $_GET['from'] = 0; $rank = 1; } else { $rank = $_GET['from'] + 1; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="icon" type="image/x-icon" href="favicon.ico" /> <meta http-equiv="Content-Language" content="en, English"> <title><?php echo $sitename; ?></title> <style type="text/css">/*\*/@import url(css/global-30.css);/**/</style> <style type="text/css">/*\*/@import url(css/hiscores-28.css);/**/</style> <script type="text/javascript" src="http://www.jagex.com/js/jquery/jquery_1_4_2.js"></script> </head> <body id="navcommunity"> <div id="scroll"> <div id="head"> <?php if ($enableads) { echo '<script type="text/javascript">'; echo 'google_ad_client = "'.$ad_client.'";'; echo 'google_ad_slot = "'.$ad_slot.'";'; echo 'google_ad_width = '.$ad_width.';'; echo 'google_ad_height = '.$ad_height.';'; echo '</script>'; echo '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>'; } ?> <div id="menubox"> <ul id="menus"> <li class="top"><a href="<?php echo $homelink; ?>" id="home" class="tl"><span class="ts">Home</span> </a> </li> <li class="top"><a class="tl" href="#"><span class="ts">Play Now</span> <!--[if gt IE 6]><!--> </a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="http://arabiax.webs.com/webclient" class="fly"><span>Web Client</span> </a> </li> <li><a href="http://dl.dropbox.com/u/25090529/client.jar" class="fly"><span>Download Client</span> </a> </li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li> <li class="top"><a class="tl" href="#"><span class="ts">Community</span> <!--[if gt IE 6]><!--> </a> <!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <li><a href="<?php echo $forumslink; ?>" class="fly"><span>Forums</span> </a> </li> <li><a href="index.php" class="fly"><span>Highscores</span> </a> </li> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--></li> </ul> </div> <div class="navigation"> <div class="location"> <b>Location: </b> <a href="<?php echo $homelink; ?>">Home</a> > <?php echo $sitename; ?> Hiscores </div> </div> </div> <div id="content"> <div id="article"> <div class="sectionHeader"> <div class="left"> <div class="right"> <div class="plaque"><?php echo $sitename; ?> Hiscores</div> </div> </div> </div> <div class="section"> <div class="brown_background"> <div id="hiscores_background" class="inner_brown_background"> <div class="center_container2"> <div id="skillsList_back" class="brown_box"> <div class="subsectionHeader">Skills</div> <div id="skillsList"> <ul> <li <?php if($_GET['table'] == -1) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php" target="_self" class="Overall ico">Overall</a></li> <li <?php if($_GET['table'] == 0) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=0" target="_self" class="Attack ico">Attack</a></li> <li <?php if($_GET['table'] == 1) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=1" target="_self" class="Defence ico">Defence</a></li> <li <?php if($_GET['table'] == 2) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=2" target="_self" class="Strength ico">Strength</a></li> <li <?php if($_GET['table'] == 3) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=3" target="_self" class="Hitpoints ico">Hitpoints</a></li> <li <?php if($_GET['table'] == 4) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=4" target="_self" class="Ranged ico">Ranged</a></li> <li <?php if($_GET['table'] == 5) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=5" target="_self" class="Prayer ico">Prayer</a></li> <li <?php if($_GET['table'] == 6) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=6" target="_self" class="Magic ico">Magic</a></li> <li <?php if($_GET['table'] == 7) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=7" target="_self" class="Cooking ico">Cooking</a></li> <li <?php if($_GET['table'] == 8) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=8" target="_self" class="Woodcutting ico">Woodcutting</a></li> <li <?php if($_GET['table'] == 9) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=9" target="_self" class="Fletching ico">Fletching</a></li> <li <?php if($_GET['table'] == 10) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=10" target="_self" class="Fishing ico">Fishing</a></li> <li <?php if($_GET['table'] == 11) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=11" target="_self" class="Firemaking ico">Firemaking</a></li> <li <?php if($_GET['table'] == 12) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=12" target="_self" class="Crafting ico">Crafting</a></li> <li <?php if($_GET['table'] == 13) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=13" target="_self" class="Smithing ico">Smithing</a></li> <li <?php if($_GET['table'] == 14) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=14" target="_self" class="Mining ico">Mining</a></li> <li <?php if($_GET['table'] == 15) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=15" target="_self" class="Herblore ico">Herblore</a></li> <li <?php if($_GET['table'] == 16) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=16" target="_self" class="Agility ico">Agility</a></li> <li <?php if($_GET['table'] == 17) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=17" target="_self" class="Thieving ico">Thieving</a></li> <li <?php if($_GET['table'] == 18) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=18" target="_self" class="Slayer ico">Slayer</a></li> <li <?php if($_GET['table'] == 19) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=19" target="_self" class="Farming ico">Farming</a></li> <li <?php if($_GET['table'] == 20) { echo 'style="background-color: #4c350a"'; } ?>><a href="index.php?table=20" target="_self" class="Runecraft ico">Runecrafting</a></li> </ul> </div> </div> <div id="modeSelect_back" class="brown_box"> <div class="buttons"> <a id="button-left" href="#"> <span class="lev1a"></span> Skills </a> <a id="button-right" href="#"> <span class="lev1"></span> </a> </div> </div> <div id="playerList_back" class="brown_box"> <div id="scores_head" class="subsectionHeader" style="padding: 0px;"> <img src="imgs/hiscores/skill_icon_<?php echo $hiscores->getSkillnamebyid($_GET['table']); ?>1.gif"><?php echo ucWords($hiscores->getSkillnamebyid($_GET['table'])); ?> Hiscores </div> <table border="0" width="93%" class="table_back"> <tbody> <thead> <tr class="table_header"> <th class="rankHead">Rank</th> <th class="nameHead">Name</th> <th class="levelHead">Level</th> <th class="xpHead">XP</th> </tr> </thead> </tbody> <?php $row = $hiscores->listScores($_GET['table'], $_GET['from']) or die(mysql_error()); $number = 1; while($result = $row->fetch_assoc()){ echo '<tr class="row row'.$number.'">'; echo '<td class="rankCol">'.$rank.'</td>'; if (ucWords(strtolower($_GET['user'])) == ucWords(strtolower($result['playerName']))) { echo '<td class="alL"><a href="personal.php?character='.$result['playerName'].'"><span class="ARow">'.$hiscores->formatPlayer($result['playerName']).'</span></a></td>'; } else { echo '<td class="alL"><a href="personal.php?character='.$result['playerName'].'">'.$hiscores->formatPlayer($result['playerName']).'</a></td>'; } if ($_GET['table'] == -1) { echo '<td class="alL">'.number_format($result['LVL']).'</td>'; echo '<td class="alL">'.number_format($result['XP']).'</td>'; } else { echo '<td class="alL">'.$skills->getLevelForXP($result[$_GET['table']]).'</td>'; echo '<td class="alL">'.number_format($result[$_GET['table']]).'</td>'; } echo '</tr>'; $rank++; $number++; } ?> </table> <div class="arrow_header"></div> <div class="arrow_back"> <div class="buttons_arrows"> <?php $u = $_GET['from']; if($u - 22 < 0) { $u = 0; } else { $u -= 22; } ?> <a id="button-up" href="index.php?table=<?php echo $_GET['table']; ?>&from=<?php echo $u; ?>"><span class="lev1_arrow"></span>U</a> <a id="button-down" href="index.php?table=<?php echo $_GET['table']; ?>&from=<?php echo $_GET['from'] + 22; ?>"><span class="lev1_arrow"></span>D</a> </div> </div> </div> <div id="search_back" class="brown_box"> <div class="subsectionHeader search_title">Search by Name</div> <div class="search_small"> <div class="searchContent"> <form method="get" action="personal.php"> <input class="textinput text" maxlength="12" type="text" name="character" id="character"><br /> <input class="buttonmedium" type="submit" value="Search"> </form> </div> </div> <div class="subsectionHeader search_title"><?php echo $sitename; ?> Forums</div> <div class="search_large" id="friends_search"> <div class="friendsContent"> To go to the<br> <?php echo $sitename; ?><br> Forums<br> <form action="<?php echo $forumslink; ?>" class="no_margin"> <input id="search_friends" type="submit" class="buttonmedium" value="Click Here"> </form> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div id="footer"> <div class="contain"> <div class="footerdesc"><?php echo $footertext; ?></div> </div> </div> </div> </body> </html>
When you have files inside your webhost you only need to put localhost as the url.Code:private static final String DB = "arabiaxn_hiscore"; private static final String URL = "localhost"; private static final String USER = "arabiaxn_hiscore"; private static final String PASS = "*****";
Now when i added @y o l o
code my players does not save to hiscore ArabiaX
become empty with no players this is my hiscoreshandler
now when i go hiscore my server players doesnt connect to the hiscores
ArabiaX
now it doesnt show anything idk why it connect correctly and my hiscoreshandler.java is
Code:package server.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import server.model.players.Client; /** * * @author Joshua F * @author PJNoMore * */ public class HiscoresHandler { private static boolean HiScores = true; private static final String DB = "arabiaxn_hiscore"; private static final String URL = "www.arabiax.net::3306"; private static final String USER = "arabiaxn_hiscore"; private static final String PASS = "******"; private static final Properties prop; static { prop = new Properties(); prop.put("user", USER); prop.put("password", PASS); //prop.put("autoReconnect", "true"); //prop.put("maxReconnects", "4"); } public static Connection conn = null; /** * Connects to the database */ public static synchronized void connect() { try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:mysql://" + URL + "/" + DB, prop); System.out.println("Hiscores Handler: Success"); } catch (Exception e) { System.out.println("Hiscores Handler Error: "+ e); System.out.println("Setting hiscores to false to help not cause anymore errors."); HiScores = false; } } public static synchronized Connection getConnection() { try { if (conn == null || conn.isClosed()) { conn = DriverManager.getConnection("jdbc:mysql://" + URL + "/" + DB, prop); } } catch (SQLException e) { System.out.println(e); e.printStackTrace(); } return conn; } /** * The main method that is called upon logout */ public static void hiscoresHandler(Client c) { if (HiScores == true) { deleteHiscores(c); saveHiscores(c); } } /** * Part of the main method to save the hiscores */ private static synchronized void saveHiscores(Client c) { try { int overallLVL = 0; double overallXP = 0; for (int i = 0; i < 21; i++) { overallLVL += c.getLevelForXP(c.playerXP[i]); overallXP += c.playerXP[i]; } getConnection().createStatement().execute( "INSERT INTO `hiscores` VALUES ('" + c.playerName + "', '" + c.playerRights + "', '" + c.isDonator + "', '" + overallLVL + "', '" + overallXP + "', '" + c.playerXP[0] + "', '" + c.playerXP[1] + "', '" + c.playerXP[2] + "', '" + c.playerXP[3] + "', '" + c.playerXP[4] + "', '" + c.playerXP[5] + "', '" + c.playerXP[6] + "', '" + c.playerXP[7] + "', '" + c.playerXP[8] + "', '" + c.playerXP[9] + "', '" + c.playerXP[10] + "', '" + c.playerXP[11] + "', '" + c.playerXP[12] + "', '" + c.playerXP[13] + "', '" + c.playerXP[14] + "', '" + c.playerXP[15] + "', '" + c.playerXP[16] + "', '" + c.playerXP[17] + "', '" + c.playerXP[18] + "', '" + c.playerXP[19] + "', '" + c.playerXP[20] + "')"); } catch (Exception e) { e.printStackTrace(); } } /** * Part of the main method to save the hiscores */ private static synchronized void deleteHiscores(Client c) { try { getConnection().createStatement().execute( "DELETE FROM `hiscores` WHERE `playerName` = '" + c.playerName + "'"); } catch (Exception e) { e.printStackTrace(); } } /** * Will wipe out the hiscores table, therefor cleaning them */ public static synchronized void clearHiscores() { try { getConnection().createStatement().execute( "TRUNCATE TABLE `hiscores`"); } catch (Exception e) { e.printStackTrace(); } } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |