yi12345 / TravianZ

travian t3.6 project (based on travianx v6.0.0)
183 stars 190 forks source link

Admin panel/multihunter #475

Open woutaful opened 9 years ago

woutaful commented 9 years ago

First of all respect for your server man ! It works nice till so far. But i got a problem, if i login with multihunter i get some warnings about:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 854

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 707

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/wouterst/public_html/GameEngine/Database/db_MYSQL.php on line 2605

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 2581

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/wouterst/public_html/GameEngine/Database/db_MYSQL.php on line 3227

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 854

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 854

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 707

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 2605

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 2581

Warning: Invalid argument supplied for foreach() in /home/***/public_html/GameEngine/Building.php on line 32

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 854

Warning: Invalid argument supplied for foreach() in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 3454

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/***/public_html/GameEngine/Database/db_MYSQL.php on line 777

So how can i fix these problems? And this is not everything, because if i go to admin panel, i can't even login? If i try to login for admin i get this: Fatal error: Call to a member function CheckLogin() on a non-object in /home/***/public_html/Admin/admin.php on line 152

Goten87 commented 9 years ago

Multi Hunter is not a account u need to login to its i think only to make THE land and bases around your world

woutaful commented 9 years ago

Noman, if you login with multihunter you can create natars etc. and with the multihunter account you can go to the admin panel, and with the admin panel you can do a lot more options.

I do the admin panel stuf now with my database but that is not very handy. Here you can see the admin panel (with a previous other script) https://lh6.googleusercontent.com/SXmNsN_LM8NwiplTvqW2IAr4RlCtPTBJ6dfI8YaJkOh8ll3esb8Rdec4Nj5eSjiP4M6AxQ=w1656-h805

woutaful commented 9 years ago

Maybe i'm going to try to copy the admin panel script from another travian script and see if that works?

iopietro commented 9 years ago

You login into multihunter panel or in multihunter's normal account?

woutaful commented 9 years ago

multihunter's normal account, i can't login trough the admin panel.

woutaful commented 9 years ago

Multihunter account because i can't go to the multihunter panel.

Because the multihunter panel doesn't work. I don't know how to fix.

Wouter.

Van: pietrothebest Verzonden: ‎vrijdag‎ ‎5‎ ‎september‎ ‎2014 ‎17‎:‎10 Aan: yi12345/TravianZ CC: wouter w

You login into multihunter panel or in multihunter's normal account?

— Reply to this email directly or view it on GitHub.

iopietro commented 9 years ago

Can you write here function.php and admin.php? (in public_html/Admin folder)

woutaful commented 9 years ago

Yes, here is function.php

<?php #################################################################################

-= YOU MUST NOT REMOVE OR CHANGE THIS NOTICE =-

---------------------------------------------------------------------------

Project: TravianZ

Version: 05.03.2014

Filename: Admin/function.php

Developed by: Dzoki

Edited by: Shadow and ronix

License: Creative Commons BY-NC-SA 3.0

Copyright: TravianZ (c) 2014 - All rights reserved

URLs: http://travian.shadowss/ro

Source code: https://github.com/Shadowss/TravianZ

#################################################################################

class funct {

function CheckLogin(){ if($_SESSION['access'] >= MULTIHUNTER and $_SESSION['id']){ return true; }else{ return false; } }

function Act($get){ global $admin,$database;

switch($get['action']){
  case "recountPop":
    $admin->recountPop($get['did']);
    $admin->recountCP($get['did']);
  break;
  case "recountPopUsr":
    $admin->recountPopUser($get['uid']);
  break;
  case "StopDel":
    //stop deleting
  break;
  case "delVil":
    if($get['mode'] != 1){
    $admin->DelVillage($get['did']);
    }else{
    $admin->DelVillage($get['did'], 1);
    }
  break;
  case "delBan":
    $admin->DelBan($get['uid'],$get['id']);
    //remove ban
  break;
  case "addBan":
    if($get['time']){$end = time()+$get['time']; }else{$end = '';}

      if(is_numeric($get['uid'])){
      $get['uid'] = $get['uid'];
      }else{
      $get['uid'] = $database->getUserField(addslashes($get['uid']),'id',1);
      }

    $admin->AddBan($get['uid'],$end,$get['reason']);
    //add ban
  break;
  case "delOas":
    //oaza
  break;
  case "logout":
    $this->LogOut();
  break;
  case "killHero":
    $varray = $database->getProfileVillages($get['uid']);
    $killhero=false;
    $error="";
    for ($i = 0; $i <= count($varray)-1; $i++) {
        $killhero=$database->FindHeroInVil($varray[$i]['wref']);
        if ($killhero) break;
        $killhero=$database->FindHeroInDef($varray[$i]['wref']);
        if ($killhero) break;
        $killhero=$database->FindHeroInMovement($varray[$i]['wref']);
        if ($killhero) break;
    }
    if (!$killhero){
        $killhero=$database->FindHeroInOasis($get['uid']);
    }    
    if ($killhero) {
        $database->KillMyHero($get['uid']);
        $error="&kc=1";
    }else $error="&e=1";    
    header("Location: admin.php?p=player&uid=".$get['uid'].$error);
    exit;
  case "reviveHero":
    $result=$database->query("SELECT * FROM ".TB_PREFIX."hero WHERE uid='".$get['uid']."'");
    $hdata=mysql_fetch_array($result);
    $database->query("UPDATE ".TB_PREFIX."units SET hero = 1 WHERE vref = ".$hdata['wref']);
    $database->query("UPDATE ".TB_PREFIX."hero SET `dead` = '0', `inrevive` = '0', `health` = '100', `lastupdate` = ".time()." WHERE `uid` = '".$get['uid']."'");
    header("Location: admin.php?p=player&uid=".$get['uid']."&rc=1");
    exit;
  case "addHero":
    $user = $database->getUserArray($get['uid'],1);
    $vilarray=$database->getVrefCapital($get['uid']);

    $database->query("INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`,
    `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`,
    `intraining`) VALUES ('".$get['uid']."', '" . $vilarray['wref'] . "', '0', '".$get['u']."', '".addslashes($user['username'])."',
    '0', '5', '0', '0', '100', '0', '0', '0', '0', '".time()."', '50', '0')");

    $database->query("UPDATE ".TB_PREFIX."units SET hero = 1 WHERE vref = ".$vilarray['wref']);

    header("Location: admin.php?p=player&uid=".$get['uid']."&ac=1");
    exit;
    }
if($get['action'] == 'logout'){
  header("Location: admin.php");
}else{
  header("Location: ".$_SERVER['HTTP_REFERER']);
}

}

function Act2($post){ global $admin,$database; switch($post['action']){ case "DelPlayer": $admin->DelPlayer($post['uid'],$post['pass']); header("Location: ?p=search&msg=ursdel"); break; case "punish": $admin->Punish($post); header("Location: ".$_SERVER['HTTP_REFERER']); break; case "addVillage": $admin->AddVillage($post); header("Location: ".$_SERVER['HTTP_REFERER']); break; } }

function LogIN($username,$password){ global $admin,$database; if($admin->Login($username,$password)){ //$_SESSION['username'] = $username; $_SESSION['access'] = $database->getUserField($username,'access',1); $_SESSION['id'] = $database->getUserField($username,'id',1); header("Location: ".$_SERVER['HTTP_REFERER']); //header("Location: admin.php"); }else{ echo "Error"; } }

function LogOut(){ $_SESSION['access'] = ''; $_SESSION['id'] = ''; }

public function procResType($ref) {
    global $session;
    switch($ref) {
        case 1: $build = "Woodcutter"; break;
        case 2: $build = "Clay Pit"; break;
        case 3: $build = "Iron Mine"; break;
        case 4: $build = "Cropland"; break;
        case 5: $build = "Sawmill"; break;
        case 6: $build = "Brickyard"; break;
        case 7: $build = "Iron Foundry"; break;
        case 8: $build = "Grain Mill"; break;
        case 9: $build = "Bakery"; break;
        case 10: $build = "Warehouse"; break;
        case 11: $build = "Granary"; break;
        case 12: $build = "Blacksmith"; break;
        case 13: $build = "Armoury"; break;
        case 14: $build = "Tournament Square"; break;
        case 15: $build = "Main Building"; break;
        case 16: $build = "Rally Point"; break;
        case 17: $build = "Marketplace"; break;
        case 18: $build = "Embassy"; break;
        case 19: $build = "Barracks"; break;
        case 20: $build = "Stable"; break;
        case 21: $build = "Workshop"; break;
        case 22: $build = "Academy"; break;
        case 23: $build = "Cranny"; break;
        case 24: $build = "Town Hall"; break;
        case 25: $build = "Residence"; break;
        case 26: $build = "Palace"; break;
        case 27: $build = "Treasury"; break;
        case 28: $build = "Trade Office"; break;
        case 29: $build = "Great Barracks"; break;
        case 30: $build = "Great Stable"; break;
        case 31: $build = "City Wall"; break;
        case 32: $build = "Earth Wall"; break;
        case 33: $build = "Palisade"; break;
        case 34: $build = "Stonemason's Lodge"; break;
        case 35: $build = "Brewery"; break;
        case 36: $build = "Trapper"; break;
        case 37: $build = "Hero's Mansion"; break;
        case 38: $build = "Great Warehouse"; break;
        case 39: $build = "Great Granary"; break;
        case 40: $build = "Wonder of the World"; break;
        case 41: $build = "Horse Drinking Trough"; break;
        default: $build = "Error"; break;
    }
    return $build;
}

};

$funct = new funct; if($funct->CheckLogin()){ if($_GET['action']){ $funct->Act($_GET); } if($_POST['action']){ $funct->Act2($_POST); } } if($_POST['action']=='login'){ $funct->LogIN($_POST['name'],$_POST['pw']); } ?>

woutaful commented 9 years ago

I can't post the admin.php file, it won't show up completely in here.

Shadowss commented 9 years ago

Send me an email at : cata7007@gmail.com and explain me what is modifoed or what bug you fix with both files

woutaful commented 9 years ago

You received my previous mail?

Wouter.

Van: Shadow Verzonden: ‎maandag‎ ‎22‎ ‎september‎ ‎2014 ‎20‎:‎09 Aan: yi12345/TravianZ CC: wouter w

Send me an email at : cata7007@gmail.com and explain me what is modifoed or what bug you fix with both files

— Reply to this email directly or view it on GitHub.