473,672 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help:-Undefined variable

6 New Member
hey guys just wondering if you can help with this error ive started receiving(im not brilliant at coding so it probs something obvious)

Notice: Undefined variable: lang in C:\xampp\htdocs \armory\source\ charlist.php on line 24

20<ul class="heading" >
21<img class="ieimg" src="images/pixel.gif"><li class="hleft"></li>
22<li class="hcont">
23<div class="generic-title">
24<h1><?php echo $lang['search_for_pro files'] ?>:</h1>
25</div>

thanks for reading
stef
Nov 15 '09 #1
8 5882
Markus
6,050 Recognized Expert Expert
The variable $lang does not exist in the current scope. Where do you define $lang?
Nov 15 '09 #2
stefman123
6 New Member
i dont 100% understand the code im afraid im not brilliant with php i wrote a basic script sent it to a freand and he sent it back with some nice new features that mostly work its just this one is throwing up that error

sorry im no more use but im fairly new to coding
Nov 15 '09 #3
stefman123
6 New Member
Expand|Select|Wrap|Line Numbers
  1. 17<h3><?php echo $lang['char_search'] ?></h3>
  2. 18</b>
  3. 19</blockquote>
  4. 20<ul class="heading">
  5. 21<img class="ieimg" src="images/pixel.gif"><li class="hleft"></li>
  6. 22<li class="hcont">
  7. 23<div class="generic-title">
  8. 24<h1><?php echo $lang['search_for_profiles'] ?>:</h1>
  9. 25</div>
line 17 hasent thrown in an error and its using the same code thats why i dont understand whats happning

this is the hole script if it will help

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(!defined('Armory'))
  3. {
  4.     header('Location: ../index.php?searchType=characters');
  5.     exit();
  6. }
  7. if(!isset($_GET["searchQuery"]))
  8. {
  9.     startcontenttable();
  10. ?>
  11. <div class="profile-wrapper">
  12. <blockquote>
  13. <b class="icharacters">
  14. <h4>
  15. <a href="index.php?searchType=characters"><?php echo $lang['char_profiles'] ?></a>
  16. </h4>
  17. <h3><?php echo $lang['char_search'] ?></h3>
  18. </b>
  19. </blockquote>
  20. <ul class="heading">
  21. <img class="ieimg" src="images/pixel.gif"><li class="hleft"></li>
  22. <li class="hcont">
  23. <div class="generic-title">
  24. <h1><?php echo $lang['search_for_profiles'] ?>:</h1>
  25. </div>
  26. </li>
  27. <li class="hright"></li>
  28. </ul>
  29. <form action="index.php" method="get" name="formSearchCharacter" onsubmit="javascript: return menuCheckLength(document.formSearchCharacter);">
  30. <div id="formSearchCharacter_errorSearchLength" style="position: relative; left: 150px; top: 150px; white-space: nowrap;"></div>
  31. <input name="searchType" type="hidden" value="characters">
  32. <input name="realm" type="hidden" value= "<?php echo DefaultRealmName ?>">
  33. <p class="scroll-padding"></p>
  34. <div class="scroll">
  35. <div class="scroll-bot">
  36. <div class="scroll-top">
  37. <div class="scroll-right">
  38. <div class="scroll-left">
  39. <div class="scroll-bot-right">
  40. <div class="scroll-bot-left">
  41. <div class="scroll-top-right">
  42. <div class="scroll-top-left">
  43. <div class="header-cp">
  44. <span><?php echo $lang['char_profiles'] ?></span>
  45. </div>
  46. <table class="scroll-content">
  47. <tr>
  48. <td><a class="title-cn"><span>Character Name</span></a></td><td><input maxlength="72" name="searchQuery" onblur="if (this.value=='') this.value=textEnterCharacterName" onfocus="this.value=''" size="16" type="text" value=""></td><td class="srch"><a class="scroll-search" onClick="javascript: return menuCheckLength(document.formSearchCharacter);"><span>Search</span></a></td>
  49. </tr>
  50. </table>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </form>
  61. <script type="text/javascript">
  62. document.forms['formSearchCharacter'].searchQuery.value = textEnterCharacterName;
  63. </script>
  64. </div>
  65. <?php
  66.     endcontenttable();
  67. }
  68. else
  69. {
  70. ?>
  71. <script type="text/javascript">
  72.     rightSideImage = "character";
  73.     changeRightSideImage(rightSideImage);
  74.  
  75.     setcookie("cookieMenuText", "<?php echo $lang['characters'] ?>");
  76.     document.getElementById('replaceSearchOption').innerHTML = "<?php echo $lang['characters'] ?>";
  77. </script>
  78. <?php
  79.     startcontenttable();
  80. ?>
  81. <div class="profile-wrapper">
  82. <blockquote>
  83. <b class="icharacters">
  84. <h4>
  85. <a href="index.php"><?php echo $lang['armory_search'] ?></a>
  86. </h4>
  87. <h3><?php echo $lang['char_profiles'] ?></h3>
  88. </b>
  89. </blockquote>
  90. <?php
  91.     // urlencode for IE Cyrillic compatibility
  92. ?>
  93. <body onLoad="showResult('?searchQuery=<?php echo urlencode($_GET["searchQuery"]) ?>&realm=<?php echo urlencode(REALM_NAME) ?>','source/ajax/ajax-search-getresults.php')">
  94. <div id="ajaxResult">
  95. <span class="csearch-results-info"><?php echo $lang['search_result'] ?></span>
  96. </div>
  97. <?php
  98.     endcontenttable();
  99. }
  100. ?>
Nov 15 '09 #4
Markus
6,050 Recognized Expert Expert
Can you post the whole file, please. Also, omit the line numbers.

Thanks,
Mark.
Nov 15 '09 #5
stefman123
6 New Member
just done it in an edit whiles you were typing sorry
Nov 15 '09 #6
Markus
6,050 Recognized Expert Expert
Okay.

Nowhere in that file do you create the $lang variable. Is the file you just showed included from another file from include(), require() or a function like that? If so, please post that file also.
Nov 15 '09 #7
stefman123
6 New Member
it all links from this main index page
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. define('Armory', 1);
  3. require "configuration/settings.inc.php";
  4. require "configuration/functions.php";
  5. require "configuration/mysql.php";
  6. require "configuration/output.inc.php";
  7. require "configuration/infoarray.php";
  8. require "configuration/resources.inc.php";
  9. require "configuration/defines.php";
  10. $o = new Output;
  11. $o->init();
  12. // Security Check //
  13. $PagesArray = array( 
  14. 'idx' => 'main.php',
  15. 'profile' => 'character-sheet.php',
  16. 'characters' => 'charlist.php',
  17. 'guilds' => 'guildlist.php',
  18. 'guildinfo' => 'guild-info.php',
  19. 'honor' => 'honorranking.php',
  20. 'Items' => 'itemlist.php',
  21. 'items' => 'itemlist.php',
  22. 'iteminfo' => 'item-info.php',
  23. 'arena' => 'arenaranking.php',
  24. 'arenateams' => 'arenalist.php',
  25. 'teaminfo' => 'team-info.php',
  26. 'registration' => 'registration.php',
  27. 'login' => 'login.php'
  28. );
  29. if(isset($_GET["searchType"]))
  30. {
  31.     if (array_key_exists($_GET["searchType"], $PagesArray))
  32.         define("REQUESTED_ACTION", $_GET["searchType"]);
  33.     else
  34.         define("REQUESTED_ACTION", 'idx');
  35. }
  36. else
  37.     define("REQUESTED_ACTION", 'idx');
  38. error_reporting(E_ALL);
  39. session_start();
  40. function session_security($fingerprint = 'fingerprint001')
  41. {
  42.     if(isset($_SESSION["HTTP_USER_AGENT"]))
  43.     {
  44.         if($_SESSION["HTTP_USER_AGENT"] != md5($_SERVER["HTTP_USER_AGENT"].$fingerprint))
  45.         {
  46.             print "Session Terminated. This has been recorded as a possible session hijack attempt and the session has been terminated for security reasons. If this is an inconvenience, please contact the administrator.<br><b>What this means:</b> You have been logged out.";
  47.             session_destroy();
  48.         }
  49.     }
  50.     else
  51.         $_SESSION["HTTP_USER_AGENT"] = md5($_SERVER["HTTP_USER_AGENT"].$fingerprint);
  52. }
  53. $o->string("<head>");
  54. $o->string("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/armory-css.css\">");
  55. // Tooltips stylesheet(s)//
  56. $o->string("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/armory-tooltips.css\">");
  57. // Ajax //
  58. $o->string("<script src=\"source/ajax/coreajax.js\" type=\"text/javascript\">  </script>");
  59. $o->string("</head>");
  60. $o->string("<body OB_AFTER_BODYTAG>");
  61. $o->setobvar("AFTER_BODYTAG", "");
  62. // Javascript Tooltips //
  63. // aah //
  64. $o->string("<script type=\"text/javascript\" src=\"source/ajax/tooltipajax.js\"></script>");
  65.  
  66. include "head.php";
  67.  
  68. // Make sure the session is secure... //
  69. session_security();
  70. require_once $o->sourcefolder."/".$PagesArray[REQUESTED_ACTION];
  71. $o->string("<div id=\"loading-box\">LOADING</div>");
  72.  
  73. // The final output call. Any $o-> calls after this will be ignored //
  74. $o->outputPage();
  75.  
  76. include "foot.php";
  77. ?>
which requiers
settings.inc
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // for all options bellow: 1 - enable, 0 - disable
  3. $config = array(
  4. // MBA title
  5. "Title" => "The World of Warcraft Armory",
  6. // Client compatible with the server, 0 - 2.4.3, 1 - 3.0.3
  7. "Client" => 0,
  8. // Use registration page
  9. "Registration" => 0,
  10. // Use login page
  11. "Login" => 0,
  12. // Number of account registrations per IP, 0 - no limits
  13. "LockReg" => 0,
  14. // Lock accout to IP after registration
  15. "LockAcc" => 0,
  16. // The gmlevel which new accounts have
  17. "GmLevel" => 0,
  18. // The expansion which new accounts are using, 0 - Original, 1 - TBC, 2 - WotLK
  19. "AccExpansion" => 0,
  20. // Show source information for items
  21. "ShowSource" => 1,
  22. // Show Random Enchantments for items
  23. "ShowRandomEnch" => 1,
  24. // Show Disenchant information for items
  25. "ShowDisenchant" => 1,
  26. // Show error messages for items
  27. "ShowError" => 0,
  28. // Results number for Honor Ranking page
  29. "PvPTop" => 50,
  30. // Results number for Arena Ranking page
  31. "ArenaTop" => 50,
  32. );
functions
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. function GetCharacterPortrait($CharacterLevel, $CharacterGender, $CharacterRace, $CharacterClass)
  3. {
  4.     if($CharacterLevel <= 59)
  5.         return "wow-default/".$CharacterGender."-".$CharacterRace."-".$CharacterClass.".gif";
  6.     else if($CharacterLevel >= 60 && $CharacterLevel <= 69)
  7.         return "wow/".$CharacterGender."-".$CharacterRace."-".$CharacterClass.".gif";
  8.     else if($CharacterLevel >= 70 && $CharacterLevel <= 79)
  9.         return "wow-70/".$CharacterGender."-".$CharacterRace."-".$CharacterClass.".gif";
  10.     else if($CharacterLevel >= 80)
  11.         return "wow-80/".$CharacterGender."-".$CharacterRace."-".$CharacterClass.".gif";
  12. }
  13. function GetFaction($CharacterRace)
  14. {
  15.     if($CharacterRace == 1 || $CharacterRace == 3 || $CharacterRace == 4 || $CharacterRace == 7 || $CharacterRace == 11)
  16.         return "alliance";
  17.     else
  18.         return "horde";
  19. }
  20. function GetIcon($Type, $DisplayIconId)
  21. {
  22.     if($Type == "item")
  23.     {
  24.         $Table = "itemdisplayinfo";
  25.         $Field = "icon";
  26.     }
  27.     else //$Type == "spell"
  28.     {
  29.         $Table = "spellicon";
  30.         $Field = "name";
  31.     }
  32.     switchConnection("armory", REALM_NAME);
  33.     $DisplayIconQuery = execute_query("SELECT `".$Field."` FROM `".$Table."` WHERE `id` = ".$DisplayIconId." LIMIT 1");
  34.     if($row = mysql_fetch_assoc($DisplayIconQuery))
  35.         return "images/icons/64x64/".$row[$Field].".png";
  36.     else
  37.         return "images/icons/64x64/404.png";
  38. }
  39. function GetItemSource($item_id, $pvpreward = 0)
  40. {
  41.     global $lang;
  42.     switchConnection("mangos", REALM_NAME);
  43.     if(mysql_num_rows(execute_query("SELECT `entry` FROM `quest_template` WHERE `SrcItemId` = ".$item_id." LIMIT 1")))
  44.         return $lang['quest_item'];
  45.     else if(mysql_num_rows(execute_query("SELECT `entry` FROM `npc_vendor` WHERE `item` = ".$item_id." LIMIT 1")))
  46.         return $pvpreward ? $lang['pvp_reward'] : $lang['vendor'];
  47.     else if(mysql_num_rows(execute_query("SELECT `entry` FROM `gameobject_loot_template` WHERE `item` = ".$item_id." LIMIT 1")))
  48.         return $lang['chest_drop'];
  49.     else if(mysql_num_rows(execute_query("SELECT `entry` FROM `creature_loot_template` WHERE `item` = ".$item_id." LIMIT 1")))
  50.         return $lang['drop'];
  51.     else if(mysql_num_rows(execute_query("SELECT `entry` FROM `quest_template` WHERE `RewChoiceItemId1` = ".$item_id." OR `RewChoiceItemId2` = ".$item_id."
  52.     OR `RewChoiceItemId3` = ".$item_id." OR `RewChoiceItemId4` = ".$item_id." OR `RewChoiceItemId5` = ".$item_id." OR `RewChoiceItemId6` = ".$item_id."
  53.     OR `RewItemId1` = ".$item_id." OR `RewItemId2` = ".$item_id." OR `RewItemId3` = ".$item_id." OR `RewItemId4` = ".$item_id." LIMIT 1")))
  54.         return $lang['quest_reward'];
  55.     else
  56.         return $lang['created'];
  57. }
  58. function spell_bonuses($spell_id, $RandomSuffixValue = 0)
  59. {
  60.     switchConnection("armory", REALM_NAME);
  61.     $itemStat = array();
  62.     for($ii = 1; $ii <= 3; $ii ++)
  63.     {
  64.         if($sData = mysql_fetch_assoc(execute_query("SELECT `id`,`effect_basepoints_".$ii."`,`effect_aura_".$ii."`,`effect_misc_1` FROM `spell` WHERE `id` = ".$spell_id." LIMIT 1")))
  65.         {
  66.             if($sData["effect_aura_".$ii] == 13)
  67.             {
  68.                 switch($sData["effect_misc_1"])
  69.                 {
  70.                     case 2: $magicSchool = "holydmg"; break;
  71.                     case 4: $magicSchool = "firedmg"; break;
  72.                     case 8: $magicSchool = "naturedmg"; break;
  73.                     case 16: $magicSchool = "frostdmg"; break;
  74.                     case 32: $magicSchool = "shadowdmg"; break;
  75.                     case 64: $magicSchool = "arcanedmg"; break;
  76.                     case 126: $magicSchool = "spelldmg"; break;
  77.                     default: $magicSchool = "";
  78.                 }
  79.                 if($magicSchool)
  80.                 {
  81.                     if($RandomSuffixValue)
  82.                         $itemStat[$magicSchool] = $RandomSuffixValue;
  83.                     else
  84.                         $itemStat[$magicSchool] = $sData["effect_basepoints_".$ii] + 1;
  85.                 }
  86.             }
  87.             else if($sData["effect_aura_".$ii] == 135)
  88.             {
  89.                 if($RandomSuffixValue)
  90.                     $itemStat["healing"] = $RandomSuffixValue;
  91.                 else
  92.                     $itemStat["healing"] = $sData["effect_basepoints_".$ii] + 1;
  93.             }
  94.         }
  95.     }
  96.     return $itemStat;
  97. }
  98. function cache_item($itemid)
  99. {
  100.     global $config, $realms;
  101.     //Get item data
  102.     switchConnection("mangos", REALM_NAME);
  103.     if($config['locales'])
  104.     {
  105.         $nameloc = "name_loc".$config['locales'];
  106.         $itemData = mysql_fetch_assoc(execute_query("SELECT `name`, `".$nameloc."`, `Quality`, `displayid` FROM `item_template` LEFT JOIN `locales_item` ON `item_template`.`entry` = `locales_item`.`entry` WHERE `item_template`.`entry` = ".$itemid." LIMIT 1", "Error in item cache process for item ".$itemid));
  107.         if($itemData[$nameloc])
  108.             $itemData["name"] = $itemData[$nameloc];
  109.     }
  110.     else
  111.         $itemData = mysql_fetch_assoc(execute_query("SELECT `name`, `Quality`, `displayid` FROM `item_template` WHERE `entry` = ".$itemid." LIMIT 1", "Error in item cache process for item ".$itemid));
  112.     $db_fields = array(
  113.     "item_id" => $itemid,
  114.     "mangosdbkey" => $realms[REALM_NAME][2],
  115.     "item_name" => $itemData["name"],
  116.     "item_quality" => $itemData["Quality"],
  117.     "item_icon" => GetIcon("item",$itemData["displayid"]),
  118.     );
  119.     return InsertCache($db_fields , 'cache_item');
  120. }
  121. function cache_item_spellstats($itemid)
  122. {
  123.     global $realms, $CharItemStats, $stattype;
  124.     $itemStat = array();
  125.     foreach($CharItemStats as $key)
  126.         $itemStat[$key] = 0;
  127.     //Get item data
  128.     switchConnection("mangos", REALM_NAME);
  129.     $itemData = mysql_fetch_assoc(execute_query("SELECT * FROM `item_template` WHERE `entry` = ".$itemid." LIMIT 1", "Error in item cache process for item ".$itemid));
  130.     for($i = 1; $i <= 10; $i ++)
  131.     {
  132.         if($itemData["stat_type".$i])
  133.         {
  134.             $statId = $itemData["stat_type".$i];
  135.             if(array_key_exists($statId, $stattype))
  136.                 if(array_key_exists($stattype[$statId], $CharItemStats))
  137.                     $itemStat[$stattype[$statId]] += $itemData["stat_value".$i];
  138.         }
  139.         else
  140.             break;
  141.     }
  142.     for($i = 1; $i <= 5; $i ++)
  143.     {
  144.         // only when effect is triggered "on equip"
  145.         if($itemData["spellid_".$i] && $itemData["spelltrigger_".$i] == 1)
  146.         {
  147.             $spell_bonuses = spell_bonuses($itemData["spellid_".$i]);
  148.             foreach($spell_bonuses as $key => $value)
  149.                 $itemStat[$key] += $value;
  150.         }
  151.     }
  152.     $db_fields = array(
  153.     "item_id" => $itemid,
  154.     "mangosdbkey" => $realms[REALM_NAME][2],
  155.     "item_frostdmg" => $itemStat["frostdmg"],
  156.     "item_firedmg" => $itemStat["firedmg"],
  157.     "item_naturedmg" => $itemStat["naturedmg"],
  158.     "item_shadowdmg" => $itemStat["shadowdmg"],
  159.     "item_arcanedmg" => $itemStat["arcanedmg"],
  160.     "item_holydmg" => $itemStat["holydmg"],
  161.     "item_healing" => $itemStat["healing"],
  162.     "item_spelldmg" => $itemStat["spelldmg"],
  163.     "item_spellpower" => $itemStat["spellpower"],
  164.     );
  165.     return InsertCache($db_fields , 'cache_item_spellstats');
  166. }
  167. function cache_item_tooltip($itemid)
  168. {
  169.     global $realms;
  170.     require_once "tooltipmgr.php";
  171.     $item_tooltip = outputTooltip($itemid);
  172.     $db_fields = array(
  173.     "item_id" => $itemid,
  174.     "mangosdbkey" => $realms[REALM_NAME][2],
  175.     "item_html" => $item_tooltip[0],
  176.     "item_info_html" => $item_tooltip[1],
  177.     );
  178.     return InsertCache($db_fields , 'cache_item_tooltip');
  179. }
  180. function cache_item_char($itemid, $owner, $slot, $itemguid, $itemlist)
  181. {
  182.     global $realms, $defines, $CharItemStats;
  183.     require_once "tooltipmgr.php";
  184.     $itemStat = array();
  185.     foreach($CharItemStats as $key)
  186.         $itemStat[$key] = 0;
  187.     $enchant_array = array(
  188.     $defines["PERMANENT"][CLIENT],
  189.     $defines["SOCKET_1"][CLIENT],
  190.     $defines["SOCKET_1"][CLIENT] + 3,
  191.     $defines["SOCKET_1"][CLIENT] + 6,
  192.     $defines["SOCKET_BONUS"][CLIENT],
  193.     );
  194.     switchConnection("characters", REALM_NAME);
  195.     $enchantmentsData = explode(' ', mysql_result(execute_query("SELECT `data` FROM `item_instance` WHERE `guid` = ".$itemguid." LIMIT 1"), 0));
  196.     // Random Enchantments
  197.     switchConnection("mangos", REALM_NAME);
  198.     $itemData = mysql_fetch_assoc(execute_query("SELECT `RandomProperty`, `RandomSuffix`, `ItemLevel`, `InventoryType`, `Quality` FROM `item_template` WHERE `entry` = ".$itemid." LIMIT 1", "Error in item cache process for item ".$itemid));
  199.     $FirstEnchant = $defines["RANDOM_1"][CLIENT];
  200.     if($itemData["RandomProperty"] || $itemData["RandomSuffix"])
  201.     {
  202.         if($itemData["RandomProperty"])
  203.             $FirstEnchant += 6;
  204.         else //if($itemData["RandomSuffix"])
  205.         {
  206.             switchConnection("armory", REALM_NAME);
  207.             $ItemRandomData = mysql_fetch_assoc(execute_query("SELECT `enchvalue_1`, `enchvalue_2`, `enchvalue_3` FROM `itemrandomsuffix`
  208.                 WHERE `spellitemench_1` = ".$enchantmentsData[$FirstEnchant]." AND `spellitemench_2` = ".$enchantmentsData[$FirstEnchant+3]." AND `spellitemench_3` = ".$enchantmentsData[$FirstEnchant+6]." LIMIT 1"));
  209.         }
  210.         $enchant_array[] = $FirstEnchant;
  211.         $enchant_array[] = $FirstEnchant + 3;
  212.         $enchant_array[] = $FirstEnchant + 6;
  213.     }
  214.     switchConnection("armory", REALM_NAME);
  215.     foreach($enchant_array as $key)
  216.     {
  217.         if($enchantmentsData[$key])
  218.         {
  219.             $enchantment = mysql_fetch_assoc(execute_query("SELECT `statorspell1`, `statorspell2`, `statorspell3`, `type1`, `type2`, `type3` FROM  `spellitemenchantment` WHERE `id` = ".$enchantmentsData[$key]." LIMIT 1"));
  220.             for($i = 1; $i <= 3; $i ++)
  221.             {
  222.                 if($enchantment["type".$i] == 3)
  223.                 {
  224.                     if($itemData["RandomSuffix"] && $key >= $FirstEnchant)
  225.                     {
  226.                         $suffixFactor = GenerateEnchSuffixFactor($itemData["ItemLevel"], $itemData["InventoryType"], $itemData["Quality"]);
  227.                         $enchantvalue = round($suffixFactor*($ItemRandomData["enchvalue_".$i]/10000));
  228.                         $spell_bonuses = spell_bonuses($enchantment["statorspell".$i], $enchantvalue);
  229.                     }
  230.                     else
  231.                         $spell_bonuses = spell_bonuses($enchantment["statorspell".$i]);
  232.                     foreach($spell_bonuses as $key => $value)
  233.                         $itemStat[$key] += $value;
  234.                 }
  235.             }
  236.         }
  237.     }
  238.     $db_fields = array(
  239.     "item_guid" => $itemguid,
  240.     "chardbkey" => $realms[REALM_NAME][1],
  241.     "item_owner" => $owner,
  242.     "item_slot" => $slot,
  243.     "item_html" => outputTooltip($itemid, $itemguid, $itemlist),
  244.     "item_frostdmg" => $itemStat["frostdmg"],
  245.     "item_firedmg" => $itemStat["firedmg"],
  246.     "item_naturedmg" => $itemStat["naturedmg"],
  247.     "item_shadowdmg" => $itemStat["shadowdmg"],
  248.     "item_arcanedmg" => $itemStat["arcanedmg"],
  249.     "item_holydmg" => $itemStat["holydmg"],
  250.     "item_healing" => $itemStat["healing"],
  251.     "item_spelldmg" => $itemStat["spelldmg"],
  252.     "item_spellpower" => $itemStat["spellpower"],
  253.     );
  254.     return InsertCache($db_fields , 'cache_item_char');
  255. }
  256. function cache_item_search($itemid)
  257. {
  258.     global $config, $realms;
  259.     switchConnection("mangos", REALM_NAME);
  260.     if($config['locales'])
  261.     {
  262.         $nameloc="name_loc".$config['locales'];
  263.         $itemData = mysql_fetch_assoc(execute_query("SELECT `name`, `".$nameloc."`, `ItemLevel`, `Quality`, `ItemLevel`, `Flags` FROM `item_template` LEFT JOIN `locales_item` ON `item_template`.`entry` = `locales_item`.`entry` WHERE `item_template`.`entry` = ".$itemid." LIMIT 1", "Error in item cache process for item ".$itemid));
  264.         if($itemData[$nameloc])
  265.             $itemData["name"] = $itemData[$nameloc];
  266.     }
  267.     else
  268.         $itemData = mysql_fetch_assoc(execute_query("SELECT `name`, `ItemLevel`, `Quality`, `ItemLevel`, `Flags` FROM `item_template` WHERE `entry` = ".$itemid." LIMIT 1", "Error in item cache process for item ".$itemid));
  269.     if(($itemData["Flags"] & 32768) == 32768)
  270.         $pvpreward = 1;
  271.     else
  272.         $pvpreward = 0;
  273.     $db_fields = array(
  274.     "item_id" => $itemid,
  275.     "mangosdbkey" => $realms[REALM_NAME][2],
  276.     "item_name" => $itemData["name"],
  277.     "item_level" => $itemData["ItemLevel"],
  278.     "item_source" => GetItemSource($itemid,$pvpreward),
  279.     "item_relevance" => $itemData["Quality"]*25+$itemData["ItemLevel"],
  280.     );
  281.     return InsertCache($db_fields, 'cache_item_search');
  282. }
  283. function InsertCache($db_fields, $db)
  284. {
  285.     // Insert
  286.     switchConnection("armory", REALM_NAME);
  287.     $querystring = "INSERT INTO `".$db."` (";
  288.     foreach($db_fields as $field => $value)
  289.         $querystring .= "`".$field."`,";
  290.     // Chop the end of $querystring off
  291.     $querystring = substr($querystring, 0, -1);
  292.     $querystring .= ") VALUES (";
  293.     foreach($db_fields as $field => $value)
  294.         $querystring .= "'".str_replace("'", "\'", $value)."',";
  295.     // Chop the end off again
  296.     $querystring = substr($querystring, 0, -1);
  297.     $querystring .= ")";
  298.     execute_query($querystring, "Could not cache: ");
  299.     return $db_fields; //return an associative array
  300. }
  301. function GetNameFromDB($Id, $table)
  302. {
  303.     switchConnection("armory", REALM_NAME);
  304.     $Query = execute_query("SELECT `name` FROM `".$table."` WHERE `id`=".$Id." LIMIT 1");
  305.     if($row = mysql_fetch_assoc($Query))
  306.         return $row["name"];
  307.     else
  308.         return "";
  309. }
  310. // validate input - preventing SQL injection
  311. function validate_string($string)
  312. {
  313.     $string = trim($string);
  314.     // strips excess whitespace
  315.     $string = preg_replace('/\s\s+/', ' ', $string);
  316.     if(preg_match('/[^[:alnum:]\sА-ПР-Яа-пр-я]/', $string))
  317.         $string = "";
  318.     return $string;
  319. }
  320. function exclude_GMs()
  321. {
  322.     global $config;
  323.     $excludeGMs = "";
  324.     if($config['ExcludeGMs'])
  325.         $excludeGMs = " AND (`extra_flags` & 1) = 0";
  326.     if(isset($_SESSION['GM']))
  327.         $excludeGMs = "";
  328.     return $excludeGMs;
  329. }
  330. function microtime_float()
  331. {
  332.     list($utime, $time) = explode(" ", microtime());
  333.     return ((float)$utime + (float)$time);
  334. }
  335. function ordinal_suffix($number)
  336. {
  337.     global $lang;
  338.     if(!$number)
  339.         return $lang["none"];
  340.     switch($number % 10)
  341.     {
  342.         case 1: return $number.$lang['st'];
  343.         case 2: return $number.$lang['nd'];
  344.         case 3: return $number.$lang['rd'];
  345.         default: return $number.$lang['th'];
  346.     }
  347. }
  348. function startcontenttable($class="full-list")
  349. {
  350.     echo "<div class=\"list\">
  351.     <div class=\"",$class,"\">
  352.     <div class=\"tip\" style=\"clear: left;\">
  353.     <table width=\"100\">
  354.     <tr>
  355.     <td class=\"tip-top-left\"></td><td class=\"tip-top\"></td><td class=\"tip-top-right\"></td>
  356.     </tr>
  357.     <tr>
  358.     <td class=\"tip-left\"></td><td class=\"tip-bg\">";
  359. }
  360. function endcontenttable()
  361. {
  362.     echo "</td>
  363.     <td class=\"tip-right\"></td>
  364.     </tr>
  365.     <tr>
  366.     <td class=\"tip-bot-left\"></td><td class=\"tip-bot\"></td><td class=\"tip-bot-right\"></td>
  367.     </tr>
  368.     </table>
  369.     </div>
  370.     </div>
  371.     </div>";
  372. }
  373. function showerror($errTitle, $errMessage)
  374. {
  375.     startcontenttable("team-side");
  376.     echo "Error - ",$errTitle,"<br>",$errMessage;
  377.     endcontenttable();
  378. }
  379. function guild_arenateam_tooltip_frame($type, $id, $name, $leader_name, $num_members)
  380. {
  381.     global $lang;
  382.     if($type == "guild")
  383.     {
  384.         $type_name = $lang["guild"];
  385.         $id_field = "guildid";
  386.         $leader = $lang["leader"];
  387.     }
  388.     else//if($type == "team")
  389.     {
  390.         $type_name = $lang["arena_team"];
  391.         $id_field = "arenateamid";
  392.         $leader = $lang["captain"];
  393.     }
  394.     $guild_arenateam_tooltip = "<a href=\"index.php?searchType=".$type."info&".$id_field."=".$id."&realm=".REALM_NAME."\" onmouseover=\"showTip('";
  395.     $guild_arenateam_tooltip .= "<span class=\'profile-tooltip-header\'>".$type_name." - ".$name."</span><br>";
  396.     $guild_arenateam_tooltip .= "<span class=\'profile-tooltip-description\'>".$leader.": ".$leader_name."<br>".$lang["members"].": ".$num_members."</span>";
  397.     $guild_arenateam_tooltip .= "')\" onmouseout=\"hideTip()\">".$name."</a>";
  398.     return $guild_arenateam_tooltip;
  399. }
  400. function guild_tooltip($guildid)
  401. {
  402.     global $lang, $guildInfoTooltip;
  403.     if(!$guildid)
  404.         return $lang["none"];
  405.     if(!isset($guildInfoTooltip[$guildid]))
  406.     {
  407.         switchConnection("characters", REALM_NAME);
  408.         $glinkresults = mysql_fetch_assoc(execute_query("SELECT `name`, `leaderguid` FROM `guild` WHERE `guildid` = ".$guildid." LIMIT 1"));
  409.         if($guildLeader = mysql_fetch_assoc(execute_query("SELECT `name` FROM `characters` WHERE `guid` = ".$glinkresults["leaderguid"]." LIMIT 1")))
  410.             $guildLeaderName = $guildLeader["name"];
  411.         else
  412.             $guildLeaderName = $lang["unknown"];
  413.         $guildMembers = mysql_result(execute_query("SELECT COUNT(*) FROM `guild_member` WHERE `guildid` = ".$guildid), 0);
  414.         $guildInfoTooltip[$guildid] = guild_arenateam_tooltip_frame("guild", $guildid, $glinkresults["name"], $guildLeaderName, $guildMembers);
  415.     }
  416.     return $guildInfoTooltip[$guildid];
  417. }
  418. function initialize_realm()
  419. {
  420.     global $realms;
  421.     if(isset($_GET["realm"]) && array_key_exists($realm_name = stripslashes($_GET["realm"]), $realms))
  422.         define("REALM_NAME", $realm_name);
  423.     else
  424.         define("REALM_NAME", DefaultRealmName);
  425.     switchConnection("armory", REALM_NAME);
  426.     define("CLIENT", mysql_result(execute_query("SELECT `value` FROM `conf_client` LIMIT 1"), 0));
  427.     define("LANGUAGE", mysql_result(execute_query("SELECT `value` FROM `conf_lang` LIMIT 1"), 0));
  428. }
  429. ?>
ill post the rest up in a moment if this is what you meant but as you can see this isnt the code of a new programmer he took it and went mad i think i sent it to him and a week later i got it back with some fixes and around 20 new files there is some define functions at the bottom are those what im looking for?
Nov 15 '09 #8
stefman123
6 New Member
i got it fixed thanks for the help u nuged me in the right direction
Nov 15 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4400
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with the microsoft HTML workshop utility, lets call it c:\path\help.chm. My question is how do you launch it from the GUI? What logic do I put behind the "help" button, in other words. I thought it would be os.spawnv(os.P_DETACH,...
4
3346
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to cmd.Cmd but I would also like to get the man-page-like help for classes and functions. Does anyone know how to do that? Thanks. Sarir
2
6470
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
3
3354
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With numarray, help gives unhelpful responses:
7
5371
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
5
3263
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time using "F1" help within the VB IDE. Is this expectation achievable In trying to test my help file in the IDE, I have a solution with 2 projects: the DLL and a tester. VB does not look for my help file; instead, it looks for path to my source code...
8
3222
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both including search the internet for help, but the help is worthless. Any ideas?
10
3355
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably the worst I ever seen. I almost cannot find anything I need, including things I
1
6125
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve default property of object Label. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' Label = New Object(){Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10, Box11,...
0
2880
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application calls MS Excel, so the scenario is that I am supposed to see the Excel Menu bar, FILE EDIT VIEW INSERT ... HELP. I am able to see the menu bar, but in case of Help, I see the Help of Excel and help of my application, both as a submenu of help. ...
0
8504
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8419
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8945
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8847
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8697
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6255
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2094
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1839
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.