Current location: Hot Scripts Forums » Programming Languages » PHP » *Simple* PHP errors, foreach() and access denied.


*Simple* PHP errors, foreach() and access denied.

Reply
  #1 (permalink)  
Old 11-01-08, 01:54 PM
wasjosh wasjosh is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
*Simple* PHP errors, foreach() and access denied.

Hey guys hope someone can maybe point me in the right direction.

I've installed a PHP based game on my new GoDaddy hosting account, with no clear cut instructions on installation, and being 2 steps below a n00b to php coding, I've ran into a couple problems.

Anyways here we go:

On the top of every page I get this:

actionscript Code:
  1. Warning: Invalid argument supplied for foreach() in /home/content/h/o/l/holylandadmin/html/vsys.php on line 7
  2.  
  3. Warning: Invalid argument supplied for foreach() in /home/content/h/o/l/holylandadmin/html/vsys.php on line 10

Here's vsys.php:

actionscript Code:
  1. <?php
  2. session_start();
  3. $this_country=0;
  4.  
  5. include "lib.php";
  6.  
  7. foreach($HTTP_POST_VARS as $key => $value ){
  8.     $cgi&#91;$key]=$value;
  9. }
  10. foreach($HTTP_GET_VARS as $key => $value ){
  11.     $cgi&#91;$key]=$value;
  12. }
  13.  
  14. $db = @mysql_connect('host', $conf&#91;"holywarsadmin"], $conf["password"]);
  15. if (!$db) {
  16.     alert (mysql_error());
  17. }
  18. if (!@mysql_select_db($conf&#91;"holywarsadmin"], $db)) {
  19.     $str=mysql_error();
  20.     if ($str)   alert ($str);
  21. } 
  22.  
  23. if ($cgi&#91;"uname"]){
  24.     //echo $cgi["uname"].$cgi["uemail"].$cgi["psword"];
  25.     $isLogined1=isLogined($cgi&#91;"uname"],$cgi["uemail"],$cgi["psword"]);
  26.     if ($isLogined1){
  27.         $usT=getUserDetails($isLogined1," active ");
  28.         logIP($isLogined1);
  29.         if ($usT->active==1){
  30.             $_SESSION&#91;"isLogined"]=$isLogined1;
  31.             $sN=$HTTP_SERVER_VARS&#91;'SCRIPT_NAME'];
  32.             //echo "==".$sN."==";
  33.            
  34.             if (($sN==$conf&#91;"path"].'/index.php')||($sN==$conf["path"].'/battlefield.php')||($sN==$conf["path"].'/help.php')||($sN==$conf["path"].'/aboutus.php')||($sN==$conf["path"].'/register.php')||($sN==$conf["path"].'/forgotpass.php')||($sN==$conf["path"].'/spam.php')||($sN==$conf["path"].'/privacy.php')||($sN==$conf["path"].'/advertising.php')||($sN==$conf["path"].'/tos.php')||($sN==$conf["path"].'/activate.php')||($sN==$conf["path"].'/forgotpass.php')){
  35.                 header("Location: base.php");
  36.                 exit;
  37.             }
  38.         }elseif($usT->active==2){
  39.             $MessageStr="You are banned.<br> Try to contact admins of the site to get to know why this have taken place.";
  40.             include "message.php";
  41.             exit;
  42.         }elseif($usT->active==3){
  43.             $MessageStr="You are supporter.<br> Right now this status is not supported. <br> Try to contact admins of the site to get to know why this have taken place.";
  44.             include "message.php";
  45.             exit;
  46.         }elseif($usT->active==4){
  47.             setcookie ("isLogin", "1",time()+3600);
  48.             header("Location: admin/index.php");
  49.             exit;
  50.         }else{
  51.             $_SESSION&#91;"activationID"]=$isLogined1;
  52.             header("Location: activate.php");
  53.         }
  54.        
  55.     }else {
  56.         $MessageStr="The login and password you have entered do not match.<br> Try to retype them again.";
  57.         include "message.php";
  58.         exit;
  59.     }
  60.    
  61. }
  62. if ($_SESSION&#91;'isLogined']){
  63.     setLastSeen($_SESSION&#91;'isLogined'],time());
  64.     $sN=$HTTP_SERVER_VARS&#91;'SCRIPT_NAME'];
  65.     if (($sN==$conf&#91;"path"].'/index.php')
  66.             ||($sN==$conf&#91;"path"].'/register.php')
  67.             ||($sN==$conf&#91;"path"].'/activate.php')
  68.             ||($sN==$conf&#91;"path"].'/recruit.php')
  69.             ||($sN==$conf&#91;"path"].'/forgotpass.php')){
  70.                 header("Location: base.php");
  71.                 exit;
  72.     }
  73. }
  74. //-------------------------------------------- FUNCTIONS --------------------------------------------------------
  75.  
  76. function alert($msg){
  77.     echo "<script>alert(\"{$msg}\")</script>";
  78. }
  79. function isAdminLogined($uname,$psword){
  80.     global $conf;
  81.     if (($conf&#91;'admin_password']==$psword)&&($conf['admin_login']=$uname))return 1;
  82.     else return 0;
  83. }
  84. function isLogined($uname,$uemail,$psword){
  85.     $str="select * from `UserDetails` where  userName='$uname' and e_mail='$uemail' and password='$psword'";
  86.     //echo $str;
  87.     $q = @mysql_query($str);
  88.     if (!$q) {
  89.         print ('Query failed: '.mysql_error());
  90.         return;
  91.     }
  92.     if (!@mysql_num_rows($q)) {
  93.         return 0;
  94.     }
  95.     else{
  96.         $st="";
  97.         $st = mysql_fetch_object($q);
  98.         return $st->ID;
  99.     }   
  100. }
  101.  
  102. function getUserByUniqId($uniqueLink ,$fields=" ID "){
  103.     $str="select $fields from `UserDetails` where  uniqueLink ='$uniqueLink' ";
  104.     //echo $str;
  105.     $q = @mysql_query($str);
  106.     if (!$q) {
  107.         print ('Query failed: '.mysql_error());
  108.         return;
  109.     }
  110.     if (!@mysql_num_rows($q)) {
  111.         return 0;
  112.     }
  113.     else{
  114.         $st="";
  115.         $st = mysql_fetch_object($q);
  116.         $st->untrainedSold=floor($st->untrainedSold);
  117.         return $st;
  118.     }   
  119. }
  120. function getUserDetailsByName($name,$fields=" ID "){
  121.     $str="select $fields from `UserDetails` where  userName='$name' ";
  122.     //echo $str;
  123.     $q = @mysql_query($str);
  124.     if (!$q) {
  125.         print ('Query failed: '.mysql_error());
  126.         return;
  127.     }
  128.     if (!@mysql_num_rows($q)) {
  129.         return 0;
  130.     }
  131.     else{
  132.         $st="";
  133.         $st = mysql_fetch_object($q);
  134.         $st->untrainedSold=floor($st->untrainedSold);
  135.         return $st;
  136.     }   
  137. }
  138. function getUserDetailsByEmail($email,$fields=" ID "){
  139.     $str="select $fields from `UserDetails` where  e_mail='$email' ";
  140.     //echo $str;
  141.     $q = @mysql_query($str);
  142.     if (!$q) {
  143.         print ('Query failed: '.mysql_error());
  144.         return;
  145.     }
  146.     if (!@mysql_num_rows($q)) {
  147.         return 0;
  148.     }
  149.     else{
  150.         $st="";
  151.         $st = mysql_fetch_object($q);
  152.         $st->untrainedSold=floor($st->untrainedSold);
  153.         return $st;
  154.     }   
  155. }
  156. function getUserDetails($id,$fields="*"){
  157.     $str="select $fields from `UserDetails` where  ID='$id' ";
  158.     //echo $str;
  159.     $q = @mysql_query($str);
  160.     if (!$q) {
  161.         print ('Query failed: '.mysql_error());
  162.         return;
  163.     }
  164.     if (!@mysql_num_rows($q)) {
  165.         return 0;
  166.     }
  167.     else{
  168.         $st="";
  169.         $st = mysql_fetch_object($q);
  170.         $st->untrainedSold=floor($st->untrainedSold);
  171.         return $st;
  172.     }   
  173. }
  174.  
  175. function getUserIncome($user){
  176.         global $conf;
  177.         $income=0;
  178.         $income+=$user->trainedAttackSold;
  179.         $income+=$user->trainedDefSold;
  180.         $income+=$user->untrainedSold;
  181.         $income*=$conf&#91;"gold_from_soldier"];
  182.         if ($conf&#91;"race"][$user->race]["income"]){
  183.             $income+=round(($income*$conf&#91;"race"][$user->race]["income"])/100);
  184.         }
  185.         return $income;
  186. }
  187. function getWeaponAllocation($user,$weaponA,$trainedCount,$untrainedCount){
  188.    
  189.     if (count($weaponA)>$trainedCount){
  190.             $trainedW=$trainedCount;
  191.             $untrainedUnW=$untrainedCount-count($weaponA)+$trainedW;
  192.             if ($untrainedUnW<0)$untrainedUnW=0;
  193.             $untrainedW=$untrainedCount-$untrainedUnW;
  194.             $trainedUnW=0;
  195.         }else{
  196.             $trainedW=count($weaponA);
  197.             $untrainedW=0;
  198.             $trainedUnW=$trainedCount-$trainedW;
  199.             $untrainedUnW=$untrainedCount;
  200.         }
  201.         if ($untrainedW<0)$untrainedW=0;
  202.        
  203.         $wepAlloc&#91;"trainedW"]=$trainedW;
  204.         $wepAlloc&#91;"untrainedUnW"]=$untrainedUnW;
  205.         $wepAlloc&#91;"untrainedW"]=$untrainedW;
  206.         $wepAlloc&#91;"trainedUnW"]=$trainedUnW;
  207.         return $wepAlloc;
  208. }
  209. function getWeaponArray($weaponA1){
  210.     $k=0;
  211.     for ($i=0;$i<count($weaponA1);$i++){
  212.         for ($j=0; $j<$weaponA1&#91;$i]->weaponCount ;$j++){
  213.             $weaponA&#91;$k]=$weaponA1[$i];
  214.             $k++;
  215.         }
  216.     }
  217.     return $weaponA;
  218. }
  219. function getStrikeAction($user){
  220.     global $conf;
  221.     $num=0;
  222.     $trainedCount=$user->trainedAttackSold+$user->trainedAttackMerc;
  223.     $untrainedCount=$user->untrainedMerc+$user->untrainedSold;
  224.     $weaponA1=getUserWeapon($user);
  225.     if (!count($weaponA1)&&!$trainedCount) return 0;
  226.     /*$k=0;
  227.     for ($i=0;$i<count($weaponA1);$i++){
  228.         for ($j=0; $j<$weaponA1[$i]->weaponCount ;$j++){
  229.             $weaponA[$k]=$weaponA1[$i];
  230.             $k++;
  231.         }
  232.     }*/
  233.     $weaponA=getWeaponArray($weaponA1);
  234.     if ($weaponA){
  235.         $wepAlloc=getWeaponAllocation($user,$weaponA,$trainedCount,$untrainedCount);
  236.         $wI=0;
  237.         for ($i=0; $i<$wepAlloc&#91;"trainedW"];$i++,$wI++){
  238.             $num+=$weaponA&#91;$wI]->weaponStrength*5;
  239.         }
  240.         for ($i=0; $i<$wepAlloc&#91;"untrainedW"];$i++,$wI++){
  241.             $num+=$weaponA&#91;$wI]->weaponStrength*4;
  242.         }
  243.     }else{
  244.         $wepAlloc&#91;"trainedUnW"]=$trainedCount;
  245.         $wepAlloc&#91;"untrainedUnW"]=$untrainedCount;
  246.     }
  247.     $num+=$wepAlloc&#91;"trainedUnW"]*5;
  248.     $num+=$wepAlloc&#91;"untrainedUnW"]*4;
  249.     for ($i=0; $i<=$user->siegeLevel;$i++){
  250.         if ($conf&#91;"race"][$user->race]["siege"][$i]["attack"]){
  251.             $num+=round(($num*$conf&#91;"race"][$user->race]["siege"][$i]["attack"])/100);
  252.         }
  253.     }
  254.    
  255.     if ($conf&#91;"race"][$user->race]["attack"]){
  256.         $num+=round(($num*$conf&#91;"race"][$user->race]["attack"])/100);
  257.     }
  258.     return $num;
  259. }
  260. function getDefenseAction($user){
  261.     global $conf;
  262.     $num=0;
  263.     $trainedCount=$user->trainedDefSold+$user->trainedDefMerc;
  264.     $untrainedCount=$user->untrainedMerc+$user->untrainedSold;
  265.     $weaponA1=getDefUserWeapon($user);
  266.     if (!count($weaponA1)&&!$trainedCount) return 0;
  267.     $k=0;
  268.     for ($i=0;$i<count($weaponA1);$i++){
  269.         for ($j=0; $j<$weaponA1&#91;$i]->weaponCount ;$j++){
  270.             $weaponA&#91;$k]=$weaponA1[$i];
  271.             $k++;
  272.         }
  273.     }
  274.     if ($weaponA){
  275.         $wepAlloc=getWeaponAllocation($user,$weaponA,$trainedCount,$untrainedCount);
  276.         $wI=0;
  277.         for ($i=0; $i<$wepAlloc&#91;"trainedW"];$i++,$wI++){
  278.             $num+=$weaponA&#91;$wI]->weaponStrength*5;
  279.         }
  280.         for ($i=0; $i<$wepAlloc&#91;"untrainedW"];$i++,$wI++){
  281.             $num+=$weaponA&#91;$wI]->weaponStrength*4;
  282.         }
  283.     }else{
  284.         $wepAlloc&#91;"trainedUnW"]=$trainedCount;
  285.         $wepAlloc&#91;"untrainedUnW"]=$untrainedCount;
  286.     }
  287.     $num+=$wepAlloc&#91;"trainedUnW"]*5;
  288.     $num+=$wepAlloc&#91;"untrainedUnW"]*4;
  289.     for ($i=0; $i<=$user->fortificationLevel ;$i++){
  290.         if ($conf&#91;"race"][$user->race]["fortification"][$i]["defence"]){
  291.             $num+=round(($num*$conf&#91;"race"][$user->race]["fortification"][$i]["defence"])/100);
  292.         }
  293.     }
  294.    
  295.     if ($conf&#91;"race"][$user->race]["defend"]){
  296.         $num+=round(($num*$conf&#91;"race"][$user->race]["defend"])/100);
  297.     }
  298.     return $num;
  299. }
  300. function getCovertAction($user){
  301.     global $conf;
  302.     $num=0;
  303.     if (!$user->spies){return 0;}
  304.     $num=round($user->spies*pow(2,$user->currentSpySkill));
  305.     if ($conf&#91;"race"][$user->race]["spy"]){
  306.         $num+=round(($num*$conf&#91;"race"][$user->race]["spy"])/100);
  307.     }
  308.     return $num;
  309. }
  310. function setWeapon($id,$fields){
  311.     $str = "update `Weapon` set $fields WHERE ID='$id' ";
  312.     //echo "$str<br>";
  313.     $q = @mysql_query($str);
  314.     if (!$q) {
  315.         print ('Query failed: '.mysql_error());
  316.         return;
  317.     }
  318. }
  319. function delWeapon($id){
  320.     $str = "DELETE FROM  `Weapon` WHERE ID='$id'";
  321.     //echo $str;
  322.     $q = @mysql_query($str);
  323.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  324. }
  325. function getUserAllWeapon($user){
  326.     $str="SELECT * FROM `Weapon` Where  userID='{$user->ID}' ORDER BY `weaponStrength` DESC ";
  327.     //print $str;
  328.     $q = @mysql_query($str);
  329.     if (!$q) {  print ('Query failed: '.mysql_error());   return;    }
  330.     if (!@mysql_num_rows($q)) { return}
  331.     else{
  332.         $st="";
  333.         $i=0;
  334.         while ($row = mysql_fetch_object($q)){
  335.             $st&#91;$i]=$row;
  336.             $i++;
  337.         }
  338.         return $st;
  339.     }   
  340. }
  341. function getUserWeapon($user){
  342.     $str="SELECT * FROM `Weapon` Where isAtack='1' and  userID='{$user->ID}' ORDER BY `weaponStrength` DESC ";
  343.     //print $str;
  344.     $q = @mysql_query($str);
  345.     if (!$q) {  print ('Query failed: '.mysql_error());   return;    }
  346.     if (!@mysql_num_rows($q)) { return}
  347.     else{
  348.         $st="";
  349.         $i=0;
  350.         while ($row = mysql_fetch_object($q)){
  351.             $st&#91;$i]=$row;
  352.             $i++;
  353.         }
  354.         return $st;
  355.     }   
  356. }
  357. function getDefUserWeapon($user){
  358.     $str="SELECT * FROM `Weapon` Where isAtack='0' and  userID='{$user->ID}' ORDER BY `weaponStrength` DESC";
  359.     //print $str;
  360.     $q = @mysql_query($str);
  361.     if (!$q) {  print ('Query failed: '.mysql_error());   return;    }
  362.     if (!@mysql_num_rows($q)) { return}
  363.     else{
  364.         $st="";
  365.         $i=0;
  366.         while ($row = mysql_fetch_object($q)){
  367.             $st&#91;$i]=$row;
  368.             $i++;
  369.         }
  370.         return $st;
  371.     }
  372. }
  373. function getTotalFightingForce($user){
  374.     $count=0;
  375.     $count+=$user->trainedAttackSold;
  376.     $count+=$user->trainedAttackMerc ;
  377.     $count+=$user->trainedDefSold ;
  378.     $count+=$user->trainedDefMerc ;
  379.     $count+=$user->untrainedSold ;
  380.     $count+=$user->untrainedMerc ;
  381.     $count+=$user->spies ;
  382.    
  383.     return $count;
  384. }
  385. function getActiveUsers($fields="*"){
  386.    
  387.     $str="SELECT $fields FROM `UserDetails` WHERE active='1'";
  388.     //print $str;
  389.     $q = @mysql_query($str);
  390.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  391.     if (!@mysql_num_rows($q)) {return;}
  392.     else{
  393.         $st="";
  394.         $i=0;
  395.         while ($row = mysql_fetch_object($q)){
  396.             $row->untrainedSold=floor($row->untrainedSold);
  397.             $st&#91;$i]=$row;
  398.             $i++;
  399.         }
  400.         return $st;
  401.     }   
  402. }
  403. function getRanksList($page){
  404.     global $conf;
  405.     $start=($page-1)*$conf&#91;'users_per_page'];
  406.     $str="SELECT  userID,rank FROM `Ranks` WHERE rank<>0  ORDER BY `rank` ASC LIMIT $start,{$conf['users_per_page']}  ";
  407.     //print $str;
  408.     $q = @mysql_query($str);
  409.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  410.     if (!@mysql_num_rows($q)) {return;}
  411.     else{
  412.         $st="";
  413.         $i=0;
  414.         while ($row = mysql_fetch_object($q)){
  415.             $st&#91;$i]=$row;
  416.             $i++;
  417.         }
  418.         return $st;
  419.     }   
  420. }
  421. function getRanksUsersList($page, $fields=" ID, userName ,trainedAttackSold ,trainedAttackMerc ,trainedDefSold ,trainedDefMerc ,untrainedSold, untrainedMerc, spies, race ,gold "){
  422.     //global $conf;
  423.     $users=getRanksList($page);
  424.     for ($i=0; $i<count($users);$i++){
  425.         $usersA&#91;$i]=getUserDetails($users[$i]->userID,$fields);
  426.         $usersA&#91;$i]->rank=$users[$i]->rank;
  427.     }
  428.     return $usersA;
  429. }
  430. function searchRanksUsersListCount($str){
  431.     $str="SELECT COUNT(*) FROM `UserDetails`,`Ranks` WHERE UserDetails.ID = Ranks.userID AND rank<>0 AND active='1' AND userName LIKE '$str' ";
  432.     //echo $str;
  433.     $q = @mysql_query($str);
  434.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  435.     if ($q){
  436.         $st = mysql_fetch_array($q);
  437.         return $st&#91;0];
  438.     }else{return 0;}
  439. }
  440. function searchRanksUsersList($page,  $str,$fields=" UserDetails.ID, userName ,trainedAttackSold ,trainedAttackMerc ,trainedDefSold ,trainedDefMerc ,untrainedSold, untrainedMerc, spies, race ,gold, rank "){
  441.     global $conf;
  442.     $start=($page-1)*$conf&#91;'users_per_page'];
  443.     $str="SELECT  $fields FROM `UserDetails`,`Ranks` WHERE UserDetails.ID = Ranks.userID AND rank<>0 AND active='1' AND userName LIKE '$str' ORDER BY `rank` ASC LIMIT $start,{$conf['users_per_page']}  ";
  444.     //print $str;
  445.     $q = @mysql_query($str);
  446.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  447.     if (!@mysql_num_rows($q)) {return;}
  448.     else{
  449.         $st="";
  450.         $i=0;
  451.         while ($row = mysql_fetch_object($q)){
  452.             $row->untrainedSold=floor($row->untrainedSold);
  453.             $st&#91;$i]=$row;
  454.             $i++;
  455.         }
  456.         return $st;
  457.     }   
  458. }
  459. function getUserRanks($id){
  460.     $str="select * from `Ranks` where  userID='$id' ";
  461.     //echo $str;
  462.     $q = @mysql_query($str);
  463.     if (!$q) {
  464.         print ('Query failed: '.mysql_error());
  465.         return;
  466.     }
  467.     if (!@mysql_num_rows($q)) {
  468.         $st->rank='unranked';
  469.         $st->strikeActionRank='unranked';
  470.         $st->defenceActionRank ='unranked';
  471.         $st->covertActionRank ='unranked';
  472.         return $st;
  473.     }
  474.     else{
  475.         $st="";
  476.         $st = mysql_fetch_object($q);
  477.         if (!$st->rank){
  478.             $st->rank='unranked';
  479.         }
  480.         if (!$st->strikeActionRank){
  481.             $st->strikeActionRank='unranked';
  482.         }
  483.         if (!$st->defenceActionRank ){
  484.             $st->defenceActionRank ='unranked';
  485.         }
  486.         if (!$st->covertActionRank ){
  487.             $st->covertActionRank ='unranked';
  488.         }
  489.         return $st;
  490.     }   
  491. }
  492.  
  493. function createUser($userName,$race,$e_mail,$password,$commander,$active=0,$uniqueLink="",$fortificationLevel=0,$siegeLevel=0,
  494.     $gold=2800,$lastTurnTime=0,$attackTurns=17,$currentUnitProduction=0,$currentSpySkill=0,
  495.     $trainedAttackSold=0,$trainedAttackMerc=0,$trainedDefSold=0,$trainedDefMerc=0,$untrainedSold=1,$untrainedMerc=0,$spies=0){
  496.     if (!$lastTurnTime){$lastTurnTime=time();}
  497.     $uniqueLink=genUniqueLink();
  498.     $str = "INSERT INTO `UserDetails` (userName,race,e_mail,password,commander,active,uniqueLink,fortificationLevel,siegeLevel,
  499.     gold,lastTurnTime,attackTurns,currentUnitProduction,currentSpySkill,
  500.     trainedAttackSold,trainedAttackMerc,trainedDefSold,trainedDefMerc,untrainedSold,untrainedMerc,spies) VALUES ('$userName','$race','$e_mail','$password','$commander','$active','$uniqueLink','$fortificationLevel','$siegeLevel',
  501.     '$gold','$lastTurnTime','$attackTurns','$currentUnitProduction','$currentSpySkill',
  502.     '$trainedAttackSold','$trainedAttackMerc','$trainedDefSold','$trainedDefMerc','$untrainedSold','$untrainedMerc','$spies')";
  503.     echo "$str<br>";
  504.     $q = @mysql_query($str);
  505.     if (!$q) {
  506.         print ('Query failed: '.mysql_error());
  507.         return;
  508.     }
  509.     $us=getUserDetailsByName($userName);
  510.     $userID=$us->ID;
  511.     $str= "INSERT INTO `Ranks` (userID) VALUES ('$userID') ";
  512.     $q = @mysql_query($str);
  513.     return $q;
  514. }
  515. function getActiveUsersCount(){
  516.     $str="SELECT COUNT(*) FROM `UserDetails` where active='1'";
  517.     //echo $str;
  518.     $q = @mysql_query($str);
  519.     if ($q){
  520.         $st = mysql_fetch_array($q);
  521.         return $st&#91;0];
  522.     }else{return 0;}
  523.     //echo "--{$st[0]}---";
  524. }
  525. function getOnlineUsersCount(){
  526.     global $conf;
  527.     $time=time()-$conf&#91;"minutes_per_turn"]*60;
  528.    
  529.     $str="SELECT COUNT(*) FROM `UserDetails` where lastTurnTime>'$time' and active='1'";
  530.     //echo time()."<br>";
  531.     //echo $str;
  532.     $q = @mysql_query($str);
  533.     if ($q){
  534.         $st = mysql_fetch_array($q);
  535.         return $st&#91;0];
  536.     }else{return 0;}
  537.     //echo "--{$st[0]}---";
  538. }
  539. function getOldUsers(){
  540.     global $conf;
  541.     $time=time()-$conf&#91;"days_of_inactivity_before_delete_this_user"]*24*60*60;
  542.     $str="SELECT ID, active FROM `UserDetails` where lastTurnTime<'$time'";
  543.     //alert($str);
  544.     $q = @mysql_query($str);
  545.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  546.     if (!@mysql_num_rows($q)) {return;}
  547.     else{
  548.         $st="";
  549.         $i=0;
  550.         while ($row = mysql_fetch_object($q)){
  551.             $st&#91;$i]=$row;
  552.             $i++;
  553.         }
  554.         return $st;
  555.     }   
  556. }
  557. function updateUser($id, $str){
  558.    
  559.     $str = "update `UserDetails` set $str WHERE ID='$id' ";
  560.     //echo "$str<br>";
  561.     $q = @mysql_query($str);
  562.     if (!$q) {
  563.         print ('Query failed: '.mysql_error());
  564.         return;
  565.     }
  566.     return $q;
  567. }
  568. function updateMercenary($str){
  569.    
  570.     $str = "update `Mercenaries` set $str  ";
  571.     //echo "$str<br>";
  572.     $q = @mysql_query($str);
  573.     if (!$q) {
  574.         print ('Query failed: '.mysql_error());
  575.         return;
  576.     }
  577. }
  578.  
  579. function setUserRank($id, $rank, $strikeActionRank, $defenceActionRank ,$covertActionRank   ){
  580.    
  581.     $str = "update `Ranks` set rank='$rank' , strikeActionRank='$strikeActionRank', defenceActionRank='$defenceActionRank', covertActionRank='$covertActionRank'  WHERE userID='$id' ";
  582.     //echo "$str<br>";
  583.     //return;
  584.     $q = @mysql_query($str);
  585.     if (!$q) {
  586.         print ('Query failed: '.mysql_error());
  587.         return;
  588.     }
  589. }
  590.  
  591. function setLastSeen($id, $date){
  592.     updateUser($id," lastTurnTime = '$date' ");
  593. }
  594.  
  595. function setLastTurnTime($date){
  596.     updateMercenary(" lastTurnTime = '$date' ");
  597. }
  598. function deleteUserWeapon($id,$weaponID=""){
  599.     if ($weaponID ){$str2=" AND weaponID='$weaponID' ";}
  600.     $str = "DELETE FROM  `Weapon` WHERE userID='$id' $str2";
  601.     //echo $str;
  602.     $q = @mysql_query($str);
  603.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  604. }
  605. function clearRanks($id){
  606.     $str = "update `Ranks` set rank ='0', strikeActionRank  ='0',defenceActionRank   ='0',covertActionRank   ='0' WHERE userID='$id' ";
  607.     //echo $str;
  608.     $q = @mysql_query($str);
  609.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  610. }
  611. function deleteUser($id){
  612.     $str = "DELETE FROM  `UserDetails` WHERE ID='$id'";
  613.     //echo $str;
  614.     $q = @mysql_query($str);
  615.     $str = "DELETE FROM  `Ranks` WHERE userID='$id'";
  616.     $q = @mysql_query($str);
  617.     deleteUserWeapon($id);
  618.     deleteIP($id);
  619.     deleteAtacksOfUser($id);
  620.     deleteSpyLogsOfUser($id);
  621.     deleteMessagesOfUser($id);
  622.     $str = "update `UserDetails` set commander=0 WHERE commander='$id' ";
  623.     $q = @mysql_query($str);
  624.     /*
  625.     if (!$q) {
  626.         print ('Query failed: '.mysql_error());
  627.         return;
  628.     }*/
  629. }
  630. function deleteOldUsers(){
  631.     $users=getOldUsers();
  632.     //echo 1;
  633.     for ($i=0;$i<count($users);$i++){
  634.         if (($users&#91;$i]->active==1)||((!$users[$i]->active)))
  635.             deleteUser($users&#91;$i]->ID);
  636.     }
  637.     //echo 2;
  638. }
  639. function addTurns($id,$addTurns,$lastTurnTime){
  640.     //$str = "INSERT INTO `UserDetails` (attackTurns ,lastTurnTime ) VALUES ('/banners/$bname')";
  641.     $str = "update `UserDetails` set attackTurns='$addTurns', lastTurnTime='$lastTurnTime' where ID='$id'";
  642.     //echo $str;
  643.     mysql_query($str);
  644. }
  645.  
  646.  
  647. function getNextTurn($user){
  648.     global $conf;
  649.     $info=getCommonInfo();
  650.     $lastTurnTime=$info->lastTurnTime;
  651.     $thisTime=time();
  652.     $dif=$thisTime-$lastTurnTime;
  653.     //$nextTurn=$dif;
  654.     $nextTurnMin=$dif/60;
  655.     /*if ($nextTurnMin>$conf["minutes_per_turn"]){
  656.         //echo "--------";
  657.         $addTurnsF=$dif/($conf["minutes_per_turn"]*60);
  658.         $addTurns=floor($addTurnsF);
  659.         //$nextTurn1=($addTurnsF-$addTurns)*$conf["minutes_per_turn"];
  660.         $nextTurn1=$dif-(($conf["minutes_per_turn"]*60)*$addTurns);
  661.         //echo $addTurns."##".$nextTurn1."##".($thisTime-$nextTurn1)."<br>";
  662.         $nextTurn=round($nextTurn1/60);
  663.         $addTurns+=$user->attackTurns;
  664.         addTurns($user->ID,$addTurns,$thisTime-$nextTurn1);
  665.        
  666.     }else*/
  667.     {
  668.         $nextTurn=round($nextTurnMin);
  669.     }
  670.     //echo $dif."<br>";
  671.     $nextTurn=$conf&#91;"minutes_per_turn"]-$nextTurn;
  672.     if ($nextTurn<0)$nextTurn=0;
  673.     return $nextTurn;//($conf["minutes_per_turn"]-$nextTurn);
  674. }
  675.  
  676. function getCommonInfo(){
  677.     $str="select * from `Mercenaries`";
  678.     //echo $str;
  679.     $q = @mysql_query($str);
  680.     if (!$q) {
  681.         print ('Query failed: '.mysql_error());
  682.         return;
  683.     }
  684.     if (!@mysql_num_rows($q)) {
  685.         return 0;
  686.     }
  687.     else{
  688.         $st="";
  689.         $st = mysql_fetch_object($q);
  690.         return $st;
  691.     }   
  692. }
  693.  
  694. //----------------------------Messages-----------------------------------------------
  695. function getMessagesCount($userID){
  696.     $str = "SELECT COUNT(*) FROM `Messages` where userID='$userID' ";
  697.     $q = @mysql_query($str);
  698.     if ($q){
  699.         $st = mysql_fetch_array($q);
  700.         return $st&#91;0];
  701.     }else{return 0;}
  702. }
  703. function getAllMessages($userID ){
  704.     $str="SELECT * FROM `Messages` WHERE userID='$userID'";
  705.     //print $str;
  706.     $q = @mysql_query($str);
  707.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  708.     if (!@mysql_num_rows($q)) {return;}
  709.     else{
  710.         $st="";
  711.         $i=0;
  712.         while ($row = mysql_fetch_object($q)){
  713.             $st&#91;$i]=$row;
  714.             $st&#91;$i]->subject =urldecode ($st[$i]->subject);
  715.             $st&#91;$i]->text =urldecode ($st[$i]->text);
  716.             $i++;
  717.         }
  718.         return $st;
  719.     }   
  720. }
  721. function getMessage($messID){
  722.     $str="select * from `Messages` where  ID='$messID' ";
  723.     //echo $str;
  724.     $q = @mysql_query($str);
  725.     if (!$q) {
  726.         print ('Query failed: '.mysql_error());
  727.         return;
  728.     }
  729.     if (!@mysql_num_rows($q)) {
  730.         return 0;
  731.     }
  732.     else{
  733.         $st="";
  734.         $st = mysql_fetch_object($q);
  735.         $st->subject =urldecode ($st->subject);
  736.         $st->text =urldecode ($st->text);
  737.         return $st;
  738.     }   
  739. }
  740. function sendMessage($id,$toid,$subject,$text){
  741.     $text=urlencode($text);
  742.     $subject=urlencode($subject);
  743.     $date=time();
  744.     $str = "INSERT INTO `Messages` (fromID , userID ,subject ,text,date ) VALUES ('$id','$toid','$subject','$text','$date')";
  745.     $q = @mysql_query($str);
  746.     return $q;
  747. }
  748. function deleteMessage($mesID){
  749.     $str = "DELETE FROM  `Messages` WHERE ID='$mesID'";
  750.     //echo $str;
  751.     $q = @mysql_query($str);
  752. }
  753. function deleteMessagesOfUser($id){
  754.     $str = "DELETE FROM  `Messages` WHERE userID='$id'";
  755.     //echo $str;
  756.     $q = @mysql_query($str);
  757. }
  758. //----------------------------END Messages-----------------------------------------------
  759.  
  760. //----------------------------Officers-----------------------------------------------
  761. function getOfficers($id, $page, $fields="userID,userName, rank, trainedAttackSold ,trainedAttackMerc ,trainedDefSold ,trainedDefMerc ,untrainedSold, untrainedMerc, spies, race"){
  762.     global $conf;
  763.     $start=($page-1)*$conf&#91;'users_per_page'];
  764.     $str="SELECT $fields  FROM `UserDetails`,`Ranks` WHERE Ranks.userID=UserDetails.ID  AND commander='$id' AND active='1' AND rank<>'0' ORDER BY `rank` ASC LIMIT $start,{$conf['users_per_page']}  ";
  765.     //print $str;
  766.     $q = @mysql_query($str);
  767.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  768.     if (!@mysql_num_rows($q)) {return;}
  769.     else{
  770.         $st="";
  771.         $i=0;
  772.         while ($row = mysql_fetch_object($q)){
  773.             $st&#91;$i]=$row;
  774.             $i++;
  775.         }
  776.         return $st;
  777.     }   
  778. }
  779. function getOfficersCount($id){
  780.     $str="SELECT COUNT(*) FROM `UserDetails`,`Ranks` where Ranks.userID=UserDetails.ID AND commander='$id' AND active='1' AND rank<>'0'";
  781.     //echo $str;
  782.     $q = @mysql_query($str);
  783.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  784.     if ($q){
  785.         $st = mysql_fetch_array($q);
  786.         return $st&#91;0];
  787.     }else{return 0;}
  788.     //echo "--{$st[0]}---";
  789. }
  790. //----------------------------END Officers-----------------------------------------------
  791.  
  792. //-----------------------------Convertions--------------------------------------------
  793. function numecho ($str){
  794.     if ($str=="unranked"){echo $str;}
  795.     elseif($str=="None"){echo $str;}
  796.     else{
  797.         //echo $str;
  798.         echo number_format($str);
  799.     }
  800. }
  801. function vDate($time){
  802.     $timenow=time();
  803.     $timenow=date ("M d, Y",$timenow);
  804.     $time1=date ("M d, Y",$time);
  805.     if ($timenow==$time1){
  806.         $time1=date ("H:i",$time);
  807.     }
  808.  
  809.     return $time1;
  810. }
  811. function genRandomPas(){
  812.     $pas=rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9);
  813.     return $pas;
  814. }
  815. function genUniqueLink(){
  816.     $time=time();
  817.     $str=chr( rand(ord('a'),ord('z')) ).chr( rand(ord('a'),ord('z')) ).$time;
  818.     return $str;
  819.     /*
  820.     for ($i=0; $i<strlen($time);$i++){
  821.         //$str.=chr(ord('a'))
  822.     }
  823.     */
  824.    
  825. }
  826. function genUniqueTxt($n){
  827.     for ($i=0;$i<$n;$i++){
  828.         if (rand(0,1)){
  829.             $str.=chr( rand(ord('A'),ord('Z')) );
  830.         }else{
  831.             $str.=chr( rand(ord('0'),ord('9')) );
  832.         }
  833.     }
  834.     return $str;
  835.     /*
  836.     for ($i=0; $i<strlen($time);$i++){
  837.         //$str.=chr(ord('a'))
  838.     }
  839.     */
  840.    
  841. }
  842.  
  843. //-----------------------------End Convertions--------------------------------------------
  844. //------------------------------Security---------------------------------------------
  845. function addIP($ip,$userID){
  846.     $time=time();
  847.     $str= "INSERT INTO `IPs` (ip,userID,time) VALUES ('$ip','$userID','$time') ";
  848.     $q = @mysql_query($str);
  849.     if (!$q) {  print ('Query failed: '.mysql_error());   return; }
  850. }
  851. function isIP($ip){
  852.     return 0;
  853.     $str="SELECT * FROM `IPs` WHERE ip='$ip' ";
  854.     //echo $str;
  855.     $q = @mysql_query($str);
  856.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  857.     if ($q){
  858.         $st = mysql_fetch_array($q);
  859.         return $st&#91;0];
  860.     }else{return 0;}
  861. }
  862. function isIPandUser($ip,$id){
  863.    
  864.     $str="SELECT * FROM `IPs` WHERE ip='$ip' AND userID='$id' ";
  865.     //echo $str;
  866.     $q = @mysql_query($str);
  867.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  868.     if ($q){
  869.         $st = mysql_fetch_array($q);
  870.         return $st&#91;0];
  871.     }else{return 0;}
  872. }
  873. function isIPNewerThen($ip,$time){
  874.     //return 0;
  875.     $time=time()-$time;
  876.     $str="SELECT * FROM `IPs` WHERE ip='$ip' AND time>'$time' ";
  877.     //echo $str;
  878.     $q = @mysql_query($str);
  879.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  880.     if ($q){
  881.         $st = mysql_fetch_object($q);
  882.         return $st;
  883.     }else{return 0;}
  884. }
  885. function getIP($id){
  886.     $str="select * from `IPs` where  userID='$id' ";
  887.     //echo $str;
  888.     $q = @mysql_query($str);
  889.     if (!$q) {
  890.         print ('Query failed: '.mysql_error());
  891.         return;
  892.     }
  893.     if (!@mysql_num_rows($q)) {
  894.         return 0;
  895.     }
  896.     else{
  897.         $st="";
  898.         $st = mysql_fetch_object($q);
  899.         return $st;
  900.     }   
  901. }
  902. function getUserIPs($id){
  903.     $str="SELECT * FROM `IPs` Where  userID='$id' ORDER BY `time` DESC ";
  904.     //print $str;
  905.     $q = @mysql_query($str);
  906.     if (!$q) {  print ('Query failed: '.mysql_error());   return;    }
  907.     if (!@mysql_num_rows($q)) { return}
  908.     else{
  909.         $st="";
  910.         $i=0;
  911.         while ($row = mysql_fetch_object($q)){
  912.             $st&#91;$i]=$row;   $i++;
  913.         }
  914.         return $st;
  915.     }   
  916. }
  917. function deleteIP($id){
  918.     $str = "DELETE FROM  `IPs` WHERE userID='$id'";
  919.     //echo $str;
  920.     $q = @mysql_query($str);
  921.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  922.    
  923. }
  924. function deleteIPByIP($ip){
  925.     $str = "DELETE FROM  `IPs` WHERE ip='$ip'";
  926.     //echo $str;
  927.     $q = @mysql_query($str);
  928.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  929.    
  930. }
  931. function deleteIPByID($id){
  932.     $str = "DELETE FROM  `IPs` WHERE ID='$id'";
  933.     //echo $str;
  934.     $q = @mysql_query($str);
  935.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  936.    
  937. }
  938. function logIP($id){
  939.     global $HTTP_SERVER_VARS,$conf;
  940.     $ip=$HTTP_SERVER_VARS&#91;'REMOTE_ADDR'];
  941.     if (!isIPandUser($ip,$id)){
  942.         $IPs=getUserIPs($id);
  943.         if (count ($IPs)>=$conf&#91;"ips_to_hold_per_user"]){
  944.             //print_r ($IPs);
  945.             //echo $IPs[count($IPs)-1]->ID;
  946.             //echo "##".count($IPs);
  947.             deleteIPByID($IPs&#91;count($IPs)-1]->ID);
  948.         }
  949.         addIP($ip,$id);
  950.     }
  951.    
  952. }
  953. //------------------------------END Security---------------------------------------------
  954.  
  955. //-----------------------------Atack---------------------------------------------------
  956. function getAtackCount($userID){
  957.     $str = "SELECT COUNT(*) FROM `AtackLog` where userID='$userID' ";
  958.     $q = @mysql_query($str);
  959.     if ($q){
  960.         $st = mysql_fetch_array($q);
  961.         return $st&#91;0];
  962.     }else{return 0;}
  963. }
  964. function getDefenceCount($userID){
  965.     $str = "SELECT COUNT(*) FROM `AtackLog` where toUserID='$userID' ";
  966.     $q = @mysql_query($str);
  967.     if ($q){
  968.         $st = mysql_fetch_array($q);
  969.         return $st&#91;0];
  970.     }else{return 0;}
  971. }
  972. function getAllAtacks($userID ){
  973.     $str="SELECT * FROM `AtackLog` WHERE userID='$userID'";
  974.     //print $str;
  975.     $q = @mysql_query($str);
  976.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  977.     if (!@mysql_num_rows($q)) {return;}
  978.     else{
  979.         $st="";
  980.         $i=0;
  981.         while ($row = mysql_fetch_object($q)){
  982.             $st&#91;$i]=$row;
  983.             $i++;
  984.         }
  985.         return $st;
  986.     }   
  987. }
  988. function getAllDefences($userID ){
  989.     $str="SELECT * FROM `AtackLog` WHERE toUserID='$userID'";
  990.     //print $str;
  991.     $q = @mysql_query($str);
  992.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  993.     if (!@mysql_num_rows($q)) {return;}
  994.     else{
  995.         $st="";
  996.         $i=0;
  997.         while ($row = mysql_fetch_object($q)){
  998.             $st&#91;$i]=$row;
  999.             $i++;
  1000.         }
  1001.         return $st;
  1002.     }   
  1003. }
  1004. function getAtack($id){
  1005.     $str="select * from `AtackLog` where  ID='$id' ";
  1006.     //echo $str;
  1007.     $q = @mysql_query($str);
  1008.     if (!$q) {
  1009.         print ('Query failed: '.mysql_error());
  1010.         return;
  1011.     }
  1012.     if (!@mysql_num_rows($q)) {
  1013.         return 0;
  1014.     }
  1015.     else{
  1016.         $st="";
  1017.         $st = mysql_fetch_object($q);
  1018.         return $st;
  1019.     }   
  1020. }
  1021. function getAtackByAtackerCount($id){
  1022.     $str="SELECT COUNT(*) FROM `AtackLog` where  userID='$id'";
  1023.     //echo $str;
  1024.     $q = @mysql_query($str);
  1025.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1026.     if ($q){
  1027.         $st = mysql_fetch_array($q);
  1028.         return $st&#91;0];
  1029.     }else{return 0;}
  1030. }
  1031. function getAtackByAtacker($id,$page){
  1032.     global $conf;
  1033.     $start=($page-1)*$conf&#91;'users_per_page'];
  1034.     //ORDER BY `rank` ASC LIMIT $start,{$conf['users_per_page']}
  1035.     $str="select * from `AtackLog` where  userID='$id' ORDER BY `time` DESC LIMIT $start,{$conf['users_per_page']}";
  1036.     //echo $str;
  1037.     $q = @mysql_query($str);
  1038.     if (!$q) {
  1039.         print ('Query failed: '.mysql_error());
  1040.         return;
  1041.     }
  1042.     if (!@mysql_num_rows($q)) {return;}
  1043.     else{
  1044.         $st="";
  1045.         $i=0;
  1046.         while ($row = mysql_fetch_object($q)){
  1047.             $st&#91;$i]=$row;
  1048.             $st&#91;$i]->subject =urldecode ($st[$i]->subject);
  1049.             $st&#91;$i]->text =urldecode ($st[$i]->text);
  1050.             $i++;
  1051.         }
  1052.         return $st;
  1053.     }   
  1054. }
  1055. function getAtackByDefenderCount($id){
  1056.     $str="SELECT COUNT(*) FROM `AtackLog` where  toUserID='$id'";
  1057.     //echo $str;
  1058.     $q = @mysql_query($str);
  1059.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1060.     if ($q){
  1061.         $st = mysql_fetch_array($q);
  1062.         return $st&#91;0];
  1063.     }else{return 0;}
  1064. }
  1065. function getAtackByDefender($id,$page){
  1066.     global $conf;
  1067.     $start=($page-1)*$conf&#91;'users_per_page'];
  1068.     $str="select * from `AtackLog` where  toUserID ='$id' ORDER BY `time` DESC LIMIT $start,{$conf['users_per_page']}";
  1069.     //echo $str;
  1070.     $q = @mysql_query($str);
  1071.     if (!@mysql_num_rows($q)) {return;}
  1072.     else{
  1073.         $st="";
  1074.         $i=0;
  1075.         while ($row = mysql_fetch_object($q)){
  1076.             $st&#91;$i]=$row;
  1077.             $st&#91;$i]->subject =urldecode ($st[$i]->subject);
  1078.             $st&#91;$i]->text =urldecode ($st[$i]->text);
  1079.             $i++;
  1080.         }
  1081.         return $st;
  1082.     }   
  1083. }
  1084. function getAtackByUser1User2AndTime($User1,$User2,$time, $fields="*"){
  1085.     $str="select $fields from `AtackLog` where  userID='$User1' AND toUserID='$User2' AND time='$time' ";
  1086.     //echo $str;
  1087.     $q = @mysql_query($str);
  1088.     if (!$q) {
  1089.         print ('Query failed: '.mysql_error());
  1090.         return;
  1091.     }
  1092.     if (!@mysql_num_rows($q)) {
  1093.         return 0;
  1094.     }
  1095.     else{
  1096.         $st="";
  1097.         $st = mysql_fetch_object($q);
  1098.         return $st;
  1099.     }   
  1100. }
  1101.  
  1102. function addAtack($id,$toid,$fields,$values){
  1103.     $text=urlencode($text);
  1104.     $subject=urlencode($subject);
  1105.     $date=time();
  1106.     $str = "INSERT INTO `AtackLog` (userID, toUserID, $fields ) VALUES ($id,$toid, $values )";
  1107.     //echo $str;
  1108.     $q = @mysql_query($str);
  1109.     return $q;
  1110. }
  1111. function deleteAtack($id){
  1112.     $str = "DELETE FROM  `AtackLog` WHERE ID='$id'";
  1113.     //echo $str;
  1114.     $q = @mysql_query($str);
  1115. }
  1116. function deleteOldAtacks(){
  1117.     $time=time()-$conf&#91;"days_to_hold_logs"]*24*60*60;
  1118.     $str="DELETE FROM  `AtackLog` where time<'$time'";
  1119. }
  1120. function deleteAtacksOfUser($userID){
  1121.     $str = "DELETE FROM  `AtackLog` WHERE userID='$userID'";
  1122.     //echo $str;
  1123.     $q = @mysql_query($str);
  1124. }
  1125.  
  1126. //-----------------------------End Atack---------------------------------------------------
  1127. //-----------------------------Spy---------------------------------------------------
  1128. function getSpyCount($userID){
  1129.     $str = "SELECT COUNT(*) FROM `SpyLog` where userID='$userID' ";
  1130.     $q = @mysql_query($str);
  1131.     if ($q){
  1132.         $st = mysql_fetch_array($q);
  1133.         return $st&#91;0];
  1134.     }else{return 0;}
  1135. }
  1136. function getSpyDefenceCount($userID){
  1137.     $str = "SELECT COUNT(*) FROM `SpyLog` where toUserID='$userID' ";
  1138.     $q = @mysql_query($str);
  1139.     if ($q){
  1140.         $st = mysql_fetch_array($q);
  1141.         return $st&#91;0];
  1142.     }else{return 0;}
  1143. }
  1144. function getAllSpys($userID ){
  1145.     $str="SELECT * FROM `SpyLog` WHERE userID='$userID'";
  1146.     //print $str;
  1147.     $q = @mysql_query($str);
  1148.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1149.     if (!@mysql_num_rows($q)) {return;}
  1150.     else{
  1151.         $st="";
  1152.         $i=0;
  1153.         while ($row = mysql_fetch_object($q)){
  1154.             $st&#91;$i]=$row;
  1155.             $i++;
  1156.         }
  1157.         return $st;
  1158.     }   
  1159. }
  1160. function getAllSpyDefences($userID ){
  1161.     $str="SELECT * FROM `SpyLog` WHERE toUserID='$userID'";
  1162.     //print $str;
  1163.     $q = @mysql_query($str);
  1164.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1165.     if (!@mysql_num_rows($q)) {return;}
  1166.     else{
  1167.         $st="";
  1168.         $i=0;
  1169.         while ($row = mysql_fetch_object($q)){
  1170.             $st&#91;$i]=$row;
  1171.             $i++;
  1172.         }
  1173.         return $st;
  1174.     }   
  1175. }
  1176. function getSpy($id){
  1177.     $str="select * from `SpyLog` where  ID='$id' ";
  1178.     //echo $str;
  1179.     $q = @mysql_query($str);
  1180.     if (!$q) {
  1181.         print ('Query failed: '.mysql_error());
  1182.         return;
  1183.     }
  1184.     if (!@mysql_num_rows($q)) {
  1185.         return 0;
  1186.     }
  1187.     else{
  1188.         $st="";
  1189.         $st = mysql_fetch_object($q);
  1190.         return $st;
  1191.     }   
  1192. }
  1193. function getSpyBySpyerCount($id){
  1194.     $str="SELECT COUNT(*) FROM `SpyLog` where  userID='$id'";
  1195.     //echo $str;
  1196.     $q = @mysql_query($str);
  1197.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1198.     if ($q){
  1199.         $st = mysql_fetch_array($q);
  1200.         return $st&#91;0];
  1201.     }else{return 0;}
  1202. }
  1203. function getSpyBySpyer($id,$page){
  1204.     global $conf;
  1205.     $start=($page-1)*$conf&#91;'users_per_page'];
  1206.     //ORDER BY `rank` ASC LIMIT $start,{$conf['users_per_page']}
  1207.     $str="select * from `SpyLog` where  userID='$id' ORDER BY `time` DESC LIMIT $start,{$conf['users_per_page']}";
  1208.     //echo $str;
  1209.     $q = @mysql_query($str);
  1210.     if (!$q) {
  1211.         print ('Query failed: '.mysql_error());
  1212.         return;
  1213.     }
  1214.     if (!@mysql_num_rows($q)) {return;}
  1215.     else{
  1216.         $st="";
  1217.         $i=0;
  1218.         while ($row = mysql_fetch_object($q)){
  1219.             $st&#91;$i]=$row;
  1220.             $st&#91;$i]->subject =urldecode ($st[$i]->subject);
  1221.             $st&#91;$i]->text =urldecode ($st[$i]->text);
  1222.             $i++;
  1223.         }
  1224.         return $st;
  1225.     }   
  1226. }
  1227. function getSpyByDefenderCount($id){
  1228.     $str="SELECT COUNT(*) FROM `SpyLog` where  toUserID='$id' AND isSuccess='0'";
  1229.     //echo $str;
  1230.     $q = @mysql_query($str);
  1231.     if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1232.     if ($q){
  1233.         $st = mysql_fetch_array($q);
  1234.         return $st&#91;0];
  1235.     }else{return 0;}
  1236. }
  1237. function getSpyByDefender($id,$page){
  1238.     global $conf;
  1239.     $start=($page-1)*$conf&#91;'users_per_page'];
  1240.     $str="select * from `SpyLog` where  toUserID ='$id' AND isSuccess='0' ORDER BY `time` DESC LIMIT $start,{$conf['users_per_page']}";
  1241.     //echo $str;
  1242.     $q = @mysql_query($str);
  1243.     if (!@mysql_num_rows($q)) {return;}
  1244.     else{
  1245.         $st="";
  1246.         $i=0;
  1247.         while ($row = mysql_fetch_object($q)){
  1248.             $st&#91;$i]=$row;
  1249.             $st&#91;$i]->subject =urldecode ($st[$i]->subject);
  1250.             $st&#91;$i]->text =urldecode ($st[$i]->text);
  1251.             $i++;
  1252.         }
  1253.         return $st;
  1254.     }   
  1255. }
  1256. function getSpyByUser1User2AndTime($User1,$User2,$time, $fields="*"){
  1257.     $str="select $fields from `SpyLog` where  userID='$User1' AND toUserID='$User2' AND time='$time' ";
  1258.     //echo $str;
  1259.     $q = @mysql_query($str);
  1260.     if (!$q) {print ('Query failed: '.mysql_error());return;}
  1261.     if (!@mysql_num_rows($q)) {
  1262.         return 0;
  1263.     }
  1264.     else{
  1265.         $st="";
  1266.         $st = mysql_fetch_object($q);
  1267.         return $st;
  1268.     }   
  1269. }
  1270.  
  1271. function addSpy($id,$toid,$fields,$values){
  1272.     $text=urlencode($text);
  1273.     $subject=urlencode($subject);
  1274.     $date=time();
  1275.     $str = "INSERT INTO `SpyLog` (userID, toUserID, $fields ) VALUES ($id,$toid, $values )";
  1276.     //echo $str;
  1277.     $q = @mysql_query($str);
  1278.     if (!$q) {print ('Query failed: '.mysql_error());return;}
  1279.     return $q;
  1280. }
  1281. function deleteSpy($id){
  1282.     $str = "DELETE FROM  `SpyLog` WHERE ID='$id'";
  1283.     //echo $str;
  1284.     $q = @mysql_query($str);
  1285. }
  1286. function deleteOldSpyLogs(){
  1287.     $time=time()-$conf&#91;"days_to_hold_logs"]*24*60*60;
  1288.     $str="DELETE FROM `SpyLog` where time<'$time'";
  1289. }
  1290. function deleteSpyLogsOfUser($userID){
  1291.     $str = "DELETE FROM  `SpyLog` WHERE userID='$userID'";
  1292.     //echo $str;
  1293.     $q = @mysql_query($str);
  1294. }
  1295. //-----------------------------End Spy---------------------------------------------------
  1296.  
  1297. //------------------------------Mitia-------------------------------------------------
  1298. function RepairWeapon($wepid,$wal,$user,$type)
  1299. {
  1300.     global $conf;
  1301.     if($type)$tp='weapon';
  1302.     else $tp='defenseweapon';
  1303.     $q = @mysql_query("select weaponCount,weaponStrength from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
  1304.     $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1305.     if($conf&#91;"race"][$user->race][$tp][$wepid]["strength"]!=0)
  1306.         $pris=round(700/$conf&#91;"race"][$user->race][$tp][$wepid]["strength"])*$wal*$el["weaponCount"];
  1307.     else return;
  1308.       if($pris <= ($user->gold)){
  1309.        if(($wal+$el&#91;"weaponStrength"]) <= $conf["race"][$user->race][$tp][$wepid]["strength"]){
  1310.             $q = @mysql_query("update `Weapon` set weaponStrength=weaponStrength+'$wal' where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
  1311.             $q = @mysql_query("update `UserDetails` set gold=gold-'$pris' where ID='$user->ID' ");}}
  1312.       else return 'NO GOLD LEFT!!!';
  1313. }
  1314.  
  1315. function ScrapSell($wepid,$wal,$a,$user,$type)
  1316. {
  1317.     global $conf;
  1318.     if($type)$tp='weapon';
  1319.     else $tp='defenseweapon';
  1320.     $q = @mysql_query("select weaponCount,weaponStrength from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
  1321.     $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1322.     if($conf&#91;"race"][$user->race][$tp][$wepid]["strength"]!=0)
  1323.         {$pris=round($conf&#91;"race"][$user->race][$tp][$wepid]["price"]*($el["weaponStrength"]/$conf["race"][$user->race][$tp][$wepid]["strength"]-0.2))*$wal;}
  1324.     else return;
  1325.     if($wal<$el&#91;"weaponCount"]){
  1326.         $q = @mysql_query("update `Weapon` set weaponCount=weaponCount-'$wal' where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
  1327.         if($a!='Scrap'){$q = @mysql_query("update `UserDetails` set gold=gold+'$pris' where ID='$user->ID' ");}}
  1328.     if($wal==$el&#91;"weaponCount"]){
  1329.         $q = @mysql_query("delete from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$type' ");
  1330.         if($a!='Scrap'){$q = @mysql_query("update `UserDetails` set gold=gold+'$pris' where ID='$user->ID' ");}}
  1331. }
  1332.  
  1333. function BuyWeapon($wepid,$wal,$at,$user)
  1334. {
  1335.     global $conf;
  1336.     if($at)$tp='weapon';
  1337.     else $tp='defenseweapon';
  1338.     $pris=$conf&#91;"race"][$user->race][$tp][$wepid]["price"]*$wal;
  1339.     $stren=$conf&#91;"race"][$user->race][$tp][$wepid]["strength"];
  1340. if($pris <= ($user->gold)){
  1341.     $q = @mysql_query("select weaponCount from `Weapon` where weaponID='$wepid' and userID='$user->ID' and isAtack='$at' ");
  1342.     if (@mysql_num_rows($q)){
  1343.         $q = @mysql_query("update `Weapon` set weaponCount=weaponCount+'$wal' where weaponID='$wepid' and userID='$user->ID' and isAtack='$at' ");
  1344.         $q = @mysql_query("update `UserDetails` set gold=gold-'$pris' where ID='$user->ID' ");}
  1345.     else{
  1346.         $q = @mysql_query("insert into `Weapon` (weaponID, weaponStrength, weaponCount, isAtack, userID) values ('$wepid', '$stren', '$wal', '$at', '$user->ID')");
  1347.         $q = @mysql_query("update `UserDetails` set gold=gold-'$pris' where ID='$user->ID' ");}}
  1348. else return 'NO GOLD LEFT!!!';
  1349. }
  1350.  
  1351. function Upgrade($user,$type,$wtd)
  1352. {
  1353.     global $conf;
  1354.     if($wtd=='No more upgrades available') return;
  1355.     else{
  1356.         if($type=='fortification'){
  1357.             $pris=$conf&#91;"race"][$user->race]["fortification"][$user->fortificationLevel+1]["price"];
  1358.             if($pris <= ($user->gold)){
  1359.                 $q = @mysql_query("update `UserDetails` set fortificationLevel=fortificationLevel+'1', gold=gold-'$pris' where ID='$user->ID' ");}
  1360.             else return 'NO GOLD LEFT!!!';}
  1361.         if($type=='siege'){
  1362.             $pris=$conf&#91;"race"][$user->race]["siege"][$user->siegeLevel+1]["price"];
  1363.             if($pris <= ($user->gold)){
  1364.                 $q = @mysql_query("update `UserDetails` set siegeLevel=siegeLevel+'1', gold=gold-'$pris' where ID='$user->ID' ");}
  1365.             else return 'NO GOLD LEFT!!!';}
  1366.         }
  1367. }
  1368.  
  1369. function Train($user,$wal,$type)
  1370. {
  1371.     $nogold="Not enough gold!";
  1372.     $nosold="Not enough untrained soldies!";
  1373.     if($type==0){
  1374.         $pris=2000*$wal;
  1375.         if($pris <= ($user->gold)){
  1376.             $q = @mysql_query("select untrainedSold from `UserDetails` where ID='$user->ID' ");
  1377.             $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1378.             if($el&#91;untrainedSold]>=$wal){
  1379.                 $q = @mysql_query("update `UserDetails` set trainedAttackSold=trainedAttackSold+'$wal', untrainedSold=untrainedSold-'$wal', gold=gold-'$pris' where ID='$user->ID' ");
  1380.                 if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1381.             }else return $nosold;
  1382.         }
  1383.         else return $nogold;
  1384.     }
  1385.     elseif($type==1){
  1386.         $pris=2000*$wal;
  1387.         if($pris <= ($user->gold)){
  1388.             $q = @mysql_query("select untrainedSold from `UserDetails` where ID='$user->ID' ");
  1389.             $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1390.             if($el&#91;untrainedSold]>=$wal){
  1391.                 $q = @mysql_query("update `UserDetails` set trainedDefSold=trainedDefSold+'$wal', untrainedSold=untrainedSold-'$wal', gold=gold-'$pris' where ID='$user->ID' ");
  1392.                 if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1393.             }else return $nosold;
  1394.         }
  1395.         else return $nogold;
  1396.     }
  1397.     elseif($type==2){
  1398.         $pris=3500*$wal;
  1399.         if($pris <= ($user->gold)){
  1400.             $q = @mysql_query("select untrainedSold from `UserDetails` where ID='$user->ID' ");
  1401.             $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1402.             if($el&#91;untrainedSold]>=$wal){
  1403.                 $q = @mysql_query("update `UserDetails` set spies=spies+'$wal', untrainedSold=untrainedSold-'$wal', gold=gold-'$pris' where ID='$user->ID' ");
  1404.                 if (!$q) {print ('Query failed: '.mysql_error());   return;    }
  1405.             }else return $nosold;
  1406.  
  1407.            
  1408.         }
  1409.         else return $nogold;
  1410.     }
  1411.     elseif($type==3){
  1412.         $q = @mysql_query("select trainedAttackSold from `UserDetails` where ID='$user->ID' ");
  1413.         $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1414.         if($el&#91;trainedAttackSold])$q = @mysql_query("update `UserDetails` set trainedAttackSold=trainedAttackSold-'$wal', untrainedSold=untrainedSold+'$wal' where ID='$user->ID' ");
  1415.     }
  1416.     elseif($type==4){
  1417.         $q = @mysql_query("select trainedDefSold from `UserDetails` where ID='$user->ID' ");
  1418.         $el=mysql_fetch_array($q, MYSQL_ASSOC);
  1419.         if($el&#91;trainedDefSold])$q = @mysql_query("update `UserDetails` set trainedDefSold=trainedDefSold-'$wal', untrainedSold=untrainedSold+'$wal' where ID='$user->ID' ");
  1420.     }
  1421. }
  1422.  
  1423. function Trainupgrade($user,$type)
  1424. {
  1425. if($type=='spy'){
  1426.     $pris=pow(2,$user->currentSpySkill)*12000;
  1427.     if($pris <= ($user->gold))
  1428.         $q = @mysql_query("update `UserDetails` set currentSpySkill=currentSpySkill+'1', gold=gold-'$pris' where ID='$user->ID' ");
  1429.     else return 'NO GOLD LEFT!!!';}
  1430. if($type=='unit'){
  1431.     $pris=$user->currentUnitProduction*10000+10000;
  1432.     if($pris <= ($user->gold))
  1433.         $q = @mysql_query("update `UserDetails` set currentUnitProduction=currentUnitProduction+'1', gold=gold-'$pris' where ID='$user->ID' ");
  1434.     else return 'NO GOLD LEFT!!!';}
  1435. }
  1436. ?>

I'm sure the majority of that is irrelevant, but I didn't want to not post something important.

I get this pop up twice when loading any page.

http://img79.imageshack.us/img79/2864/errorgm1.jpg

Well, thanks for looking and I hope it won't be too hard for someone to help me out.

Josh

Edit:

Here's some of my lib.php:
actionscript Code:
  1. <?php
  2. //  ---===:::: Configurable area Start ::::===---
  3.    
  4.      $conf&#91;"mail"]="email";
  5.     
  6.      $conf&#91;"sites_database_name"] = "host";
  7.      $conf&#91;"sites_database_name"] = "holywarsadmin";
  8.      $conf&#91;"sites_database_login"] = "holywarsadmin";
  9.      $conf&#91;"sites_database_login"] = "holywarsadmin";
  10.      $conf&#91;"sites_database_password"] = "pw";
  11.      $conf&#91;"sites_database_password"] = "pw";
  12.      $conf&#91;"path"]='/';
  13.  
  14.     //---------- Admin Panel Options
  15.     $conf&#91;'admin_login']='holylandadmin';
  16.     $conf&#91;'admin_password']='pw';
  17.    
  18.     $conf&#91;"tables_color"] ="black";"#991111";//"#D1D1AF";
  19.     $conf&#91;"tables_font_color"]='white';'black';
  20.     $conf&#91;"tables_border_color"] ='#444444';'#226644';"#999999";
  21.    
  22.     $conf&#91;"form_element_border_color"] ="#999999";
  23.     $conf&#91;"form_element_bgcolor"] ="#EEEEEE";
  24.    
  25.     $conf&#91;"body_bgcolor"]='black';
  26.     $conf&#91;"body_text_color"]='#999999';
  27.    
  28.     $conf&#91;"text_family"]='Tahoma, Arial, Helvetica, sans-serif';
  29.     $conf&#91;"text_size"]='11';
  30.     $conf&#91;"text_style"]='bold';
  31.    
  32.     $conf&#91;"logout_color"] ="#A3437B";
  33.    
  34.     $conf&#91;"head_border"]="#BB0000";
  35.     $conf&#91;"head_bgcolor"]="#440000";
  36.     $conf&#91;"head_text_color"]="white";
  37.     $conf&#91;"head_text_size"]="14";
  38.     $conf&#91;"head_text_style"]="bold";
  39.    
  40.     $conf&#91;"menuhead_border"]="#444444";
  41.     $conf&#91;"menuhead_bgcolor"]="#EEEEEE";
  42.     $conf&#91;"menuhead_text_color"]="black";
  43.    
  44.     $conf&#91;"menuitem_text_color"]="black";
  45.     $conf&#91;"menuitem_hover_bgcolor"]="#EEEEEE";
  46.    
  47.     $conf&#91;"menu_border_color"]="#999999";
  48.     $conf&#91;"menu_bgcolor"]="#D1D1D1";
  49.    
  50.     //$conf["fortification"][0]="Camp";
  51.     //$conf["fortification"][1]="palisade";
  52.     //$conf["fortification"][2]="stronghold";
  53.    
  54.    
  55.     //---------- Game options
  56.     $conf&#91;"gold_from_soldier"]=25;
  57.     $conf&#91;"minutes_per_turn"]=30;
  58.     $conf&#91;"days_of_inactivity_before_delete_this_user"]=15;
  59.     $conf&#91;"users_per_page"]=20;
  60.     $conf&#91;"mercenaries_per_turn"]=5;
  61.     $conf&#91;"days_to_hold_logs"]=5; //For Battle Logs
  62.     $conf&#91;"hours_to_block_same_user_recruiting"]=24;
  63.     $conf&#91;"ips_to_hold_per_user"]=20;
  64.    
  65.     //---------- Statuses
  66.     $conf&#91;"user_status"][0]="unverified";
  67.     $conf&#91;"user_status"][1]="normal";
  68.     $conf&#91;"user_status"][2]="banned";
  69.     $conf&#91;"user_status"][3]="supporter ";
  70.     $conf&#91;"user_status"][4]="admin";
  71.    
  72.     //---------- Phrases
  73.     $conf&#91;"phrase"][0]="massacred";
  74.     $conf&#91;"phrase"][1]="burninated";
  75.     $conf&#91;"phrase"][2]="devastated";
  76.     $conf&#91;"phrase"][3]="mashed";
  77.     $conf&#91;"phrase"][4]="annihilated";
  78.     $conf&#91;"phrase"][5]="slaughtered";
  79.     $conf&#91;"phrase"][6]="massacred";
  80.     $conf&#91;"phrase"][7]="conquered";
  81.     $conf&#91;"phrase"][8]="tore apart ";
  82.     $conf&#91;"phrase"][9]="repelled";
  83.     $conf&#91;"phrase"][10]="subdued";
  84.    
  85.     //----------Mercenaries
  86.     $conf&#91;"mercenaries"]["atack"]["prise"]=4500;
  87.     $conf&#91;"mercenaries"]["defence"]["prise"]=4500;
  88.     $conf&#91;"mercenaries"]["untrained"]["prise"]=3500;
  89.     //---------- Jews
  90.     $conf&#91;"race"][0]["name"]="Jews";
  91.     $conf&#91;"race"][0]["income"]="35";
  92.    
  93.     $conf&#91;"race"][0]["fortification"][0]["name"]="Jew Hole";
  94.     $conf&#91;"race"][0]["fortification"][0]["defence"]="0";
  95.     $conf&#91;"race"][0]["fortification"][1]["name"]="Jew palisade";
  96.     $conf&#91;"race"][0]["fortification"][1]["defence"]="25";
  97.     $conf&#91;"race"][0]["fortification"][1]["price"]="40000";
  98.     $conf&#91;"race"][0]["fortification"][2]["name"]="Jew stronghold";
  99.     $conf&#91;"race"][0]["fortification"][2]["defence"]="50";
  100.     $conf&#91;"race"][0]["fortification"][2]["price"]="80000";
  101.    
  102.     $conf&#91;"race"][0]["siege"][0]["name"]="None";
  103.     $conf&#91;"race"][0]["siege"][0]["attack"]="0";
  104.    
  105.     $conf&#91;"race"][0]["siege"][1]["name"]="Siege";
  106.     $conf&#91;"race"][0]["siege"][1]["attack"]="33.3";
  107.     $conf&#91;"race"][0]["siege"][1]["price"]="40000";
  108.    
  109.     $conf&#91;"race"][0]["siege"][2]["name"]="Super Siege";
  110.     $conf&#91;"race"][0]["siege"][2]["attack"]="66.6";
  111.     $conf&#91;"race"][0]["siege"][2]["price"]="80000";
  112.    
  113.     $conf&#91;"race"][0]["weapon"][0]["name"]="Human Knife";
  114.     $conf&#91;"race"][0]["weapon"][0]["strength"]="5";
  115.     $conf&#91;"race"][0]["weapon"][0]["price"]="1000";
  116.     $conf&#91;"race"][0]["weapon"][1]["name"]="Human Short Bow";
  117.     $conf&#91;"race"][0]["weapon"][1]["strength"]="10";
  118.     $conf&#91;"race"][0]["weapon"][1]["price"]="1800";
  119.     $conf&#91;"race"][0]["weapon"][2]["name"]="Human Crossbow";
  120.     $conf&#91;"race"][0]["weapon"][2]["strength"]="20";
  121.     $conf&#91;"race"][0]["weapon"][2]["price"]="3200";
  122.     $conf&#91;"race"][0]["weapon"][3]["name"]="Human Longbow";
  123.     $conf&#91;"race"][0]["weapon"][3]["strength"]="40";
  124.     $conf&#91;"race"][0]["weapon"][3]["price"]="5100";
  125.     $conf&#91;"race"][0]["weapon"][4]["name"]="Human Steel Bow";
  126.     $conf&#91;"race"][0]["weapon"][4]["strength"]="160";
  127.     $conf&#91;"race"][0]["weapon"][4]["price"]="16400";
  128.     $conf&#91;"race"][0]["weapon"][5]["name"]="Human Steed";
  129.     $conf&#91;"race"][0]["weapon"][5]["strength"]="640";
  130.     $conf&#91;"race"][0]["weapon"][5]["price"]="52400";
  131.     $conf&#91;"race"][0]["weapon"][6]["name"]="Human Flaming Arrow";
  132.     $conf&#91;"race"][0]["weapon"][6]["strength"]="2560";
  133.     $conf&#91;"race"][0]["weapon"][6]["price"]="167800";
  134.    
  135.     $conf&#91;"race"][0]["defenseweapon"][0]["name"]="Human Helmet";
  136.     $conf&#91;"race"][0]["defenseweapon"][0]["strength"]="10";
  137.     $conf&#91;"race"][0]["defenseweapon"][0]["price"]="1800";
  138.     $conf&#91;"race"][0]["defenseweapon"][1]["name"]="Human Shield";
  139.     $conf&#91;"race"][0]["defenseweapon"][1]["strength"]="20";
  140.     $conf&#91;"race"][0]["defenseweapon"][1]["price"]="3200";
  141.     $conf&#91;"race"][0]["defenseweapon"][2]["name"]="Human Chainmail";
  142.     $conf&#91;"race"][0]["defenseweapon"][2]["strength"]="40";
  143.     $conf&#91;"race"][0]["defenseweapon"][2]["price"]="5100";
  144.     $conf&#91;"race"][0]["defenseweapon"][3]["name"]="Human Plate Armor";
  145.     $conf&#91;"race"][0]["defenseweapon"][3]["strength"]="160";
  146.     $conf&#91;"race"][0]["defenseweapon"][3]["price"]="16400";
  147.     $conf&#91;"race"][0]["defenseweapon"][4]["name"]="Human Cloak";
  148.     $conf&#91;"race"][0]["defenseweapon"][4]["strength"]="640";
  149.     $conf&#91;"race"][0]["defenseweapon"][4]["price"]="52400";
  150.     $conf&#91;"race"][0]["defenseweapon"][5]["name"]="Human Dragonskin";
  151.     $conf&#91;"race"][0]["defenseweapon"][5]["strength"]="2560";
  152.     $conf&#91;"race"][0]["defenseweapon"][5]["price"]="167800";
  153.    
  154.     //---------- Dwarves
  155.     $conf&#91;"race"][1]["name"]="Dwarves";
  156.     $conf&#91;"race"][1]["defend"]="25";
  157.    
  158.     $conf&#91;"race"][1]["fortification"][0]["name"]="Dwarves Camp";
  159.     $conf&#91;"race"][1]["fortification"][0]["defence"]="0";
  160.     $conf&#91;"race"][1]["fortification"][1]["name"]="Dwarves palisade";
  161.     $conf&#91;"race"][1]["fortification"][1]["defence"]="25";
  162.     $conf&#91;"race"][1]["fortification"][1]["price"]="40000";
  163.     $conf&#91;"race"][1]["fortification"][2]["name"]="Dwarves stronghold";
  164.     $conf&#91;"race"][1]["fortification"][2]["defence"]="50";
  165.     $conf&#91;"race"][1]["fortification"][2]["price"]="80000";
  166.     $conf&#91;"race"][1]["fortification"][3]["name"]="Dwarws super stronghold";
  167.     $conf&#91;"race"][1]["fortification"][3]["defence"]="100";
  168.     $conf&#91;"race"][1]["fortification"][3]["price"]="160000";
  169.    
  170.     $conf&#91;"race"][1]["siege"][0]["name"]="None";
  171.     $conf&#91;"race"][1]["siege"][0]["attack"]="0";
  172.                   
  173.     $conf&#91;"race"][1]["siege"][1]["name"]="Dwarves Siege";
  174.     $conf&#91;"race"][1]["siege"][1]["attack"]="33.3";
  175.     $conf&#91;"race"][1]["siege"][1]["price"]="40000";
  176.                   
  177.     $conf&#91;"race"][1]["siege"][2]["name"]="Dwarves Super Siege";
  178.     $conf&#91;"race"][1]["siege"][2]["attack"]="66.6";
  179.     $conf&#91;"race"][1]["siege"][2]["price"]="80000";
  180.    
  181.     $conf&#91;"race"][1]["weapon"][0]["name"]="Dwarves Knife";
  182.     $conf&#91;"race"][1]["weapon"][0]["strength"]="5";
  183.     $conf&#91;"race"][1]["weapon"][0]["price"]="1000";
  184.     $conf&#91;"race"][1]["weapon"][1]["name"]="Dwarves Short Bow";
  185.     $conf&#91;"race"][1]["weapon"][1]["strength"]="10";
  186.     $conf&#91;"race"][1]["weapon"][1]["price"]="1800";
  187.     $conf&#91;"race"][1]["weapon"][2]["name"]="Dwarves Crossbow";
  188.     $conf&#91;"race"][1]["weapon"][2]["strength"]="20";
  189.     $conf&#91;"race"][1]["weapon"][2]["price"]="3200";
  190.     $conf&#91;"race"][1]["weapon"][3]["name"]="Dwarves Longbow";
  191.     $conf&#91;"race"][1]["weapon"][3]["strength"]="40";
  192.     $conf&#91;"race"][1]["weapon"][3]["price"]="5100";
  193.     $conf&#91;"race"][1]["weapon"][4]["name"]="Dwarves Steel Bow";
  194.     $conf&#91;"race"][1]["weapon"][4]["strength"]="160";
  195.     $conf&#91;"race"][1]["weapon"][4]["price"]="16400";
  196.     $conf&#91;"race"][1]["weapon"][5]["name"]="Dwarves Steed";
  197.     $conf&#91;"race"][1]["weapon"][5]["strength"]="640";
  198.     $conf&#91;"race"][1]["weapon"][5]["price"]="52400";
  199.     $conf&#91;"race"][1]["weapon"][6]["name"]="Dwarves Flaming Arrow";
  200.     $conf&#91;"race"][1]["weapon"][6]["strength"]="2560";
  201.     $conf&#91;"race"][1]["weapon"][6]["price"]="167800";
  202.    
  203.     $conf&#91;"race"][1]["defenseweapon"][0]["name"]="Dwarves Helmet";
  204.     $conf&#91;"race"][1]["defenseweapon"][0]["strength"]="10";
  205.     $conf&#91;"race"][1]["defenseweapon"][0]["price"]="1800";
  206.     $conf&#91;"race"][1]["defenseweapon"][1]["name"]="Dwarves Shield";
  207.     $conf&#91;"race"][1]["defenseweapon"][1]["strength"]="20";
  208.     $conf&#91;"race"][1]["defenseweapon"][1]["price"]="3200";
  209.     $conf&#91;"race"][1]["defenseweapon"][2]["name"]="Dwarves Chainmail";
  210.     $conf&#91;"race"][1]["defenseweapon"][2]["strength"]="40";
  211.     $conf&#91;"race"][1]["defenseweapon"][2]["price"]="5100";
  212.     $conf&#91;"race"][1]["defenseweapon"][3]["name"]="Dwarves Plate Armor";
  213.     $conf&#91;"race"][1]["defenseweapon"][3]["strength"]="160";
  214.     $conf&#91;"race"][1]["defenseweapon"][3]["price"]="16400";
  215.     $conf&#91;"race"][1]["defenseweapon"][4]["name"]="Dwarves Cloak";
  216.     $conf&#91;"race"][1]["defenseweapon"][4]["strength"]="640";
  217.     $conf&#91;"race"][1]["defenseweapon"][4]["price"]="52400";
  218.     $conf&#91;"race"][1]["defenseweapon"][5]["name"]="Dwarves Dragonskin";
  219.     $conf&#91;"race"][1]["defenseweapon"][5]["strength"]="2560";
  220.     $conf&#91;"race"][1]["defenseweapon"][5]["price"]="167800";
  221.    
  222.     //---------- Elves
  223.     $conf&#91;"race"][2]["name"]="Elves";
  224.     $conf&#91;"race"][2]["spy"]="25";
  225.    
  226.     $conf&#91;"race"][2]["fortification"][0]["name"]="Elves Camp";
  227.     $conf&#91;"race"][2]["fortification"][0]["defence"]="0";
  228.     $conf&#91;"race"][2]["fortification"][1]["name"]="Elves palisade";
  229.     $conf&#91;"race"][2]["fortification"][1]["defence"]="25";
  230.     $conf&#91;"race"][2]["fortification"][1]["price"]="40000";
  231.     $conf&#91;"race"][2]["fortification"][2]["name"]="Elves stronghold";
  232.     $conf&#91;"race"][2]["fortification"][2]["defence"]="50";
  233.     $conf&#91;"race"][2]["fortification"][2]["price"]="80000";
  234.    
  235.     $conf&#91;"race"][2]["siege"][0]["name"]="None";
  236.     $conf&#91;"race"][2]["siege"][0]["attack"]="0";
  237.                   
  238.     $conf&#91;"race"][2]["siege"][1]["name"]="Flaming Arrows";
  239.     $conf&#91;"race"][2]["siege"][1]["attack"]="33.3";
  240.     $conf&#91;"race"][2]["siege"][1]["price"]="40000";
  241.                   
  242.     $conf&#91;"race"][2]["siege"][2]["name"]="Super Flaming Arrows";
  243.     $conf&#91;"race"][2]["siege"][2]["attack"]="66.6";
  244.     $conf&#91;"race"][2]["siege"][2]["price"]="80000";
  245.    
  246.     $conf&#91;"race"][2]["weapon"][0]["name"]="Elves Knife";
  247.     $conf&#91;"race"][2]["weapon"][0]["strength"]="5";
  248.     $conf&#91;"race"][2]["weapon"][0]["price"]="1000";
  249.     $conf&#91;"race"][2]["weapon"][1]["name"]="Elves Short Bow";
  250.     $conf&#91;"race"][2]["weapon"][1]["strength"]="10";
  251.     $conf&#91;"race"][2]["weapon"][1]["price"]="1800";
  252.     $conf&#91;"race"][2]["weapon"][2]["name"]="Elves Crossbow";
  253.     $conf&#91;"race"][2]["weapon"][2]["strength"]="20";
  254.     $conf&#91;"race"][2]["weapon"][2]["price"]="3200";
  255.     $conf&#91;"race"][2]["weapon"][3]["name"]="Elves Longbow";
  256.     $conf&#91;"race"][2]["weapon"][3]["strength"]="40";
  257.     $conf&#91;"race"][2]["weapon"][3]["price"]="5100";
  258.     $conf&#91;"race"][2]["weapon"][4]["name"]="Elves Steel Bow";
  259.     $conf&#91;"race"][2]["weapon"][4]["strength"]="160";
  260.     $conf&#91;"race"][2]["weapon"][4]["price"]="16400";
  261.     $conf&#91;"race"][2]["weapon"][5]["name"]="Elves Steed";
  262.     $conf&#91;"race"][2]["weapon"][5]["strength"]="640";
  263.     $conf&#91;"race"][2]["weapon"][5]["price"]="52400";
  264.     $conf&#91;"race"][2]["weapon"][6]["name"]="Elves Flaming Arrow";
  265.     $conf&#91;"race"][2]["weapon"][6]["strength"]="2560";
  266.     $conf&#91;"race"][2]["weapon"][6]["price"]="167800";
  267.    
  268.     $conf&#91;"race"][2]["defenseweapon"][0]["name"]="Elves Helmet";
  269.     $conf&#91;"race"][2]["defenseweapon"][0]["strength"]="10";
  270.     $conf&#91;"race"][2]["defenseweapon"][0]["price"]="1800";
  271.     $conf&#91;"race"][2]["defenseweapon"][1]["name"]="Elves Shield";
  272.     $conf&#91;"race"][2]["defenseweapon"][1]["strength"]="20";
  273.     $conf&#91;"race"][2]["defenseweapon"][1]["price"]="3200";
  274.     $conf&#91;"race"][2]["defenseweapon"][2]["name"]="Elves Chainmail";
  275.     $conf&#91;"race"][2]["defenseweapon"][2]["strength"]="40";
  276.     $conf&#91;"race"][2]["defenseweapon"][2]["price"]="5100";
  277.     $conf&#91;"race"][2]["defenseweapon"][3]["name"]="Elves Plate Armor";
  278.     $conf&#91;"race"][2]["defenseweapon"][3]["strength"]="160";
  279.     $conf&#91;"race"][2]["defenseweapon"][3]["price"]="16400";
  280.     $conf&#91;"race"][2]["defenseweapon"][4]["name"]="Elves Cloak";
  281.     $conf&#91;"race"][2]["defenseweapon"][4]["strength"]="640";
  282.     $conf&#91;"race"][2]["defenseweapon"][4]["price"]="52400";
  283.     $conf&#91;"race"][2]["defenseweapon"][5]["name"]="Elves Dragonskin";
  284.     $conf&#91;"race"][2]["defenseweapon"][5]["strength"]="2560";
  285.     $conf&#91;"race"][2]["defenseweapon"][5]["price"]="167800";
  286.    
  287.     //---------- Orcs
  288.     $conf&#91;"race"][3]["name"]="Orcs";
  289.     $conf&#91;"race"][3]["attack"]="25";
  290.    
  291.     $conf&#91;"race"][3]["fortification"][0]["name"]="Orcs Camp";
  292.     $conf&#91;"race"][3]["fortification"][0]["defence"]="0";
  293.     $conf&#91;"race"][3]["fortification"][1]["name"]="Orcs palisade";
  294.     $conf&#91;"race"][3]["fortification"][1]["defence"]="0";
  295.     $conf&#91;"race"][3]["fortification"][1]["price"]="40000";
  296.     $conf&#91;"race"][3]["fortification"][2]["name"]="Orcs stronghold";
  297.     $conf&#91;"race"][3]["fortification"][2]["defence"]="0";
  298.     $conf&#91;"race"][3]["fortification"][2]["price"]="40000";
  299.    
  300.     $conf&#91;"race"][3]["siege"][0]["name"]="None";
  301.     $conf&#91;"race"][3]["siege"][0]["attack"]="0";
  302.                   
  303.     $conf&#91;"race"][3]["siege"][1]["name"]="Siege";
  304.     $conf&#91;"race"][3]["siege"][1]["attack"]="33.3";
  305.     $conf&#91;"race"][3]["siege"][1]["price"]="40000";
  306.                   
  307.     $conf&#91;"race"][3]["siege"][2]["name"]="Super Siege";
  308.     $conf&#91;"race"][3]["siege"][2]["attack"]="66.6";
  309.     $conf&#91;"race"][3]["siege"][2]["price"]="80000";
  310.                   
  311.     $conf&#91;"race"][3]["siege"][3]["name"]="Super Mega Siege";
  312.     $conf&#91;"race"][3]["siege"][3]["attack"]="120";
  313.     $conf&#91;"race"][3]["siege"][3]["price"]="160000";
  314.    
  315.     $conf&#91;"race"][3]["weapon"][0]["name"]="Orcs Knife";
  316.     $conf&#91;"race"][3]["weapon"][0]["strength"]="5";
  317.     $conf&#91;"race"][3]["weapon"][0]["price"]="1000";
  318.     $conf&#91;"race"][3]["weapon"][1]["name"]="Orcs Short Bow";
  319.     $conf&#91;"race"][3]["weapon"][1]["strength"]="10";
  320.     $conf&#91;"race"][3]["weapon"][1]["price"]="1800";
  321.     $conf&#91;"race"][3]["weapon"][2]["name"]="Orcs Crossbow";
  322.     $conf&#91;"race"][3]["weapon"][2]["strength"]="20";
  323.     $conf&#91;"race"][3]["weapon"][2]["price"]="3200";
  324.     $conf&#91;"race"][3]["weapon"][3]["name"]="Orcs Longbow";
  325.     $conf&#91;"race"][3]["weapon"][3]["strength"]="40";
  326.     $conf&#91;"race"][3]["weapon"][3]["price"]="5100";
  327.     $conf&#91;"race"][3]["weapon"][4]["name"]="Orcs Steel Bow";
  328.     $conf&#91;"race"][3]["weapon"][4]["strength"]="160";
  329.     $conf&#91;"race"][3]["weapon"][4]["price"]="16400";
  330.     $conf&#91;"race"][3]["weapon"][5]["name"]="Orcs Steed";
  331.     $conf&#91;"race"][3]["weapon"][5]["strength"]="640";
  332.     $conf&#91;"race"][3]["weapon"][5]["price"]="52400";
  333.     $conf&#91;"race"][3]["weapon"][6]["name"]="Orcs Flaming Arrow";
  334.     $conf&#91;"race"][3]["weapon"][6]["strength"]="2560";
  335.     $conf&#91;"race"][3]["weapon"][6]["price"]="167800";
  336.    
  337.     $conf&#91;"race"][3]["defenseweapon"][0]["name"]="Orcs Helmet";
  338.     $conf&#91;"race"][3]["defenseweapon"][0]["strength"]="10";
  339.     $conf&#91;"race"][3]["defenseweapon"][0]["price"]="1800";
  340.     $conf&#91;"race"][3]["defenseweapon"][1]["name"]="Orcs Shield";
  341.     $conf&#91;"race"][3]["defenseweapon"][1]["strength"]="20";
  342.     $conf&#91;"race"][3]["defenseweapon"][1]["price"]="3200";
  343.     $conf&#91;"race"][3]["defenseweapon"][2]["name"]="Orcs Chainmail";
  344.     $conf&#91;"race"][3]["defenseweapon"][2]["strength"]="40";
  345.     $conf&#91;"race"][3]["defenseweapon"][2]["price"]="5100";
  346.     $conf&#91;"race"][3]["defenseweapon"][3]["name"]="Orcs Plate Armor";
  347.     $conf&#91;"race"][3]["defenseweapon"][3]["strength"]="160";
  348.     $conf&#91;"race"][3]["defenseweapon"][3]["price"]="16400";
  349.     $conf&#91;"race"][3]["defenseweapon"][4]["name"]="Orcs Cloak";
  350.     $conf&#91;"race"][3]["defenseweapon"][4]["strength"]="640";
  351.     $conf&#91;"race"][3]["defenseweapon"][4]["price"]="52400";
  352.     $conf&#91;"race"][3]["defenseweapon"][5]["name"]="Orcs Dragonskin";
  353.     $conf&#91;"race"][3]["defenseweapon"][5]["strength"]="2560";
  354.     $conf&#91;"race"][3]["defenseweapon"][5]["price"]="167800";
  355. //  ---===:::: Configurable area  End     ::::===---
  356.  ?>

Last edited by wasjosh; 11-01-08 at 02:00 PM.
Reply With Quote
  #2 (permalink)  
Old 11-01-08, 02:41 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Replace $HTTP_POST_VARS with $_POST, and $HTTP_GET_VARS with $_GET.
Reply With Quote
  #3 (permalink)  
Old 11-01-08, 04:31 PM
wasjosh wasjosh is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Argh, very nice sir, that has fixed the error I was getting.

This site has always been great to me helping out.

Now I'd like to get the pop up fixed, along with the

actionscript Code:
  1. Query failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

There's obivously something wrong with either my settings or the database it's self. I've edited multiple files and am 90% sure I've got all the correct information where it needs to be.
However I do not have a /var/lib/mysql/mysql.sock on my server, I'm guessing this is part of the database itself?

Any tips on where I should look would be greatly appreciated, also if you think it'll take some hardcore digging and that I should post in the jobs section that'd be much appreciated as well.

Thanks,
Josh
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterating Associative arrays with foreach divya PHP 13 11-21-07 01:12 PM
formmail problem gscraper Perl 12 08-27-04 03:06 AM


All times are GMT -5. The time now is 08:21 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.