PDA

View Full Version : Check this please



hellrazor
26-01-10, 11:44 AM
hey i am using mangos web encaned svn

and when i downloaded rev and put it on wamp/www and starts it i get error root acces denied using password YES line 71 and another System line 201 index.php

i open index.php i change the info there and it dosnt work what i do wrong here is the index.php


<?php
/************************************************** **************************/
/* < MangosWeb is a Web-Fonted for Mangos (mangosproject.org) > */
/* Copyright (C) <2007> <Sasha,TGM,Peec,Nafe> */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* $Rev$ */
/************************************************** **************************/
// Set error reporting to only a few things.
error_reporting(E_ERROR | E_PARSE | E_WARNING);
ini_set('display_errors', '0');
// Define INCLUDED so that we can check other pages if they are included by this file
define('INCLUDED', true);

// Start a variable that shows how fast page loaded.
$time_start = microtime(1);
$_SERVER['REQUEST_TIME'] = time();

// Initialize config's.
include('core/class.mangosweb.php');
$MW = new mangosweb; // Super global.

// Site functions & classes ...
include('core/common.php');
include('core/mangos.class.php');
include('core/class.auth.php');
require_once('core/dbsimple/Generic.php');
require('core/class.captcha.php');
include('core/cache_class/safeIO.php');
include('core/cache_class/gCache.php');


//Site notice cookie
if(file_exists("ToS.html") && !isset($_COOKIE['agreement_accepted'])) {
include('notice.php');
exit();
}



// Inizialize difrent variables.
global $MW, $mangos;
// Super-Global variables.
$GLOBALS['users_online']=array();
$GLOBALS['guests_online']=0;
$GLOBALS['messages'] = '';
$GLOBALS['redirect'] = '';
$GLOBALS['sidebarmessages'] = '';
$GLOBALS['context_menu'] = array();
$GLOBALS['user_cur_lang'] = (string)$MW->getConfig->generic->default_lang;

// Inzizalize Cache class
$cache = new gCache;
$cache->folder = './core/cache/sites';
$cache->timeout = $MW->getConfig->generic->cache_expiretime;

// Assign a connect variable to class call.
// DB layer documentation at http://en.dklab.ru/lib/DbSimple/
$DB = dbsimple_Generic::connect("".$MW->getDbInfo['db_type']."://".$MW->getDbInfo['db_username'].":".$MW->getDbInfo['db_password']."root".$MW->getDbInfo['db_host']."127.0.0.1".$MW->getDbInfo['db_port']."3306".$MW->getDbInfo['db_name']."realmd");
// Set error handler for $DB.
$DB->setErrorHandler('databaseErrorHandler');
// Also set to default encoding for $DB
$DB->query("SET NAMES ".$MW->getDbInfo['db_encoding']);

// Play arround for IIS lake on $_SERVER['REQUEST_URI']
if ($_SERVER['REQUEST_URI'] == "") {
if ($_SERVER['QUERY_STRING'] != "") {
$__SERVER['REQUEST_URI'] = $_SERVER["SCRIPT_NAME"] ."?". $_SERVER['QUERY_STRING'];
} else {
$__SERVER['REQUEST_URI'] = $_SERVER["SCRIPT_NAME"];
}
} else {
$__SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'];
}


// Build path vars //
$MW->add_temp_confs(array(
'site_href' => str_replace('//','/',str_replace('\\','/',dirname($_SERVER['SCRIPT_NAME']).'/'))
));
$MW->add_temp_confs(array(
'site_domain' => $_SERVER['HTTP_HOST'],
'email_href' => $_SERVER['HTTP_HOST']
));
$MW->add_temp_confs(array(
'base_href' => 'http://'.$MW->getConfig->temp->email_href.''.$MW->getConfig->temp->site_href,
));


// Check lang ======================================
if(isset($_COOKIE['Language'])) $GLOBALS['user_cur_lang'] = $_COOKIE['Language'];
loadLanguages();
// ================================================

// Load auth system //
$auth = new AUTH($DB,$MW->getConfig);
$user = $auth->user;
// ================== //

//Determine Current Template
if ($user['id'] == -1)
{ $currtmp = "templates/offlike"; }
else {
$currtmp = $DB->selectCell("SELECT theme FROM `account_extend` WHERE account_id=?d", $user['id']);
foreach ($MW->getConfig->templates->template as $template) { $currtmp2[] = $template; }
$currtmp = "templates/" . $currtmp2[$currtmp];
}

// Load Permissions and aviable sites.
include('core/default_components.php');

// Start of context menu. ( Only make an array for later output )
$GLOBALS['context_menu'][] = array('title'=>$lang['mainpage'],'link'=>'index.php');

if($user['id']<=0){
$GLOBALS['context_menu'][] = array('title'=>$lang['register'],'link'=>mw_url('account', 'register'));
}
$GLOBALS['context_menu'][] = array('title'=>'Forum','link'=>'index.php?n=forum');
$GLOBALS['context_menu'][] = array('title'=>$lang['players_online'],'link'=>mw_url('server', 'playersonline'));
if((isset($user['g_is_admin']) || isset($user['g_is_supadmin'])) && ($user['g_is_admin']==1 || $user['g_is_supadmin']==1)){
$allowed_ext[] = 'admin';
$GLOBALS['context_menu'][] = array('title'=>'------------------','link'=>'#');
$GLOBALS['context_menu'][] = array('title'=>$lang['admin_panel'],'link'=>'index.php?n=admin');
}

// for mod_rewrite query_string fix //
global $_GETVARS;

$req_vars = parse_url($__SERVER['REQUEST_URI']);
if(isset($req_vars['query'])){
parse_str($req_vars['query'], $req_arr);
$_GETVARS = $req_arr;
}
unset($req_arr, $req_vars);
// ================================================== ===== //

// Finds out what realm we are viewing.
if ((int)$MW->getConfig->generic_values->realm_info->multirealm && isset($_REQUEST['changerealm_to'])){
setcookie("cur_selected_realmd", intval($_REQUEST['changerealm_to']), time()+(3600*24)); // expire in 24 hour
$user['cur_selected_realmd'] = intval($_REQUEST['changerealm_to']);
}elseif ((int)$MW->getConfig->generic_values->realm_info->multirealm && isset($_COOKIE['cur_selected_realmd'])){
$user['cur_selected_realmd'] = intval($_COOKIE['cur_selected_realmd']);
}else{
$user['cur_selected_realmd'] = $MW->getConfig->generic_values->realm_info->default_realm_id;
}

// Make an array from `dbinfo` column for the selected realm..
$mangos_info = $DB->selectCell("SELECT dbinfo FROM `realmlist` WHERE id=?d",$user['cur_selected_realmd']);
$dbinfo_mangos = explode(';', $mangos_info);
if((int)$MW->getConfig->generic->use_archaeic_dbinfo_format) {
//alternate config - for users upgrading from Modded MaNGOS Web
//DBinfo column: host;port;username;password;WorldDBname;CharDBname
$mangos = array(
'db_type' => 'mysql',
'213.112.180.150' => $dbinfo_mangos['0'], //ip of db world
'3306' => $dbinfo_mangos['1'], //port
'root' => $dbinfo_mangos['2'], //world user
'root' => $dbinfo_mangos['3'], //world password
'realmd' => $dbinfo_mangos['4'], //world db name
'db_char' => $dbinfo_mangos['5'], //character db name
'db_encoding' => 'utf8', // don't change
);
}
else {
//normal config, as outlined in how-to
//DBinfo column: username;password;port;host;WorldDBname;CharDBname
$mangos = array(
'db_type' => 'mysql',
'213.112.180.150' => $dbinfo_mangos['3'], //ip of db world
'3306' => $dbinfo_mangos['2'], //port
'root' => $dbinfo_mangos['0'], //world user
'root' => $dbinfo_mangos['1'], //world password
'realmd' => $dbinfo_mangos['4'], //world db name
'db_char' => $dbinfo_mangos['5'], //character db name
'db_encoding' => 'utf8', // don't change
);
}
unset($dbinfo_mangos, $mangos_info); // Free up memory.

if((int)$MW->getConfig->generic->use_alternate_mangosdb_port) {
$mangos['db_port'] = (int)$MW->getConfig->generic->use_alternate_mangosdb_port;
}

// Output error message and die if user has not changed info in realmd.realmlist.`dbinfo` .
if($mangos['db_host'] == '127.0.0.1' && $mangos['db_port'] == '3306' && $mangos['db_username'] == 'username' && $mangos['db_password'] == 'password' && $mangos['db_name'] == 'DBName'){
echo "Please read README_HOWTO.txt, This is a error message btw. You must remember to setup the WORLD database information in the realm.realmlist database! :)<br />Edit the `dbinfo` to: World database info: root;root;3306;127.0.0.1;realmd";
die;
}

//Connects to WORLD DB
$WSDB = DbSimple_Generic::connect("".$mangos['db_type']."://".$mangos['db_username'].":".$mangos['db_password']."root".$mangos['db_host'].":".$mangos['db_port']."/".$mangos['db_name']."");
if($WSDB)$WSDB->setErrorHandler('databaseErrorHandler');
if($WSDB)$WSDB->query("SET NAMES ".$mangos['db_encoding']);

$CHDB = DbSimple_Generic::connect("".$mangos['db_type']."://".$mangos['db_username'].":".$mangos['db_password']."@".$mangos['db_host'].":".$mangos['db_port']."/".$mangos['db_char']."");
if($CHDB)$CHDB->setErrorHandler('databaseErrorHandler');
if($CHDB)$CHDB->query("SET NAMES ".$mangos['db_encoding']);

//Load characters list
if (isset($user['id']) && $user['id']>0) {
$characters = $CHDB->select('SELECT guid,name FROM `characters` WHERE account=?d', $user['id']);
if (isset($_REQUEST['cur_selected_character'])) {
foreach($characters as $character) {
if ($character['guid']==$_REQUEST['cur_selected_character']) {
$DB->query('UPDATE account_extend SET character_id=?d,character_name=? WHERE account_id=?d', $character['guid'], $character['name'], $user['id']);
}
}
}
}else{
$characters = array();
}

if(empty($_GET['p']) OR $_GET['p'] < 1)$p = 1;else $p = $_GET['p'];
$ext = (isset($_REQUEST['n'])?$_REQUEST['n']:(string)$MW->getConfig->generic->default_component);
if (strpos($ext, '/')!==false)
list($ext, $sub) = explode('/', $ext);
else
$sub = (isset($_REQUEST['sub'])?$_REQUEST['sub']:'index');
$req_tpl = false;

//initialize modules
//if installing a new module, please delete the cache file
include('components/modules/initialize.php');



if(in_array($ext,$allowed_ext)){

// load component

//set defaults here to be loaded -- these can be changed via the main.php or whatnot
//this is used especially in the case of the module system
$script_file = 'components/'.$ext.'/'.$ext.'.'.$sub.'.php';
$template_file = 'templates/'.(string)$MW->getConfig->generic->template.'/'.$ext.'/'.$ext.'.'.$sub.'.php';

require('components/'.$ext.'/'.'main.php');
$group_privilege = $com_content[$ext][$sub][0];
$expectation = (substr($group_privilege,0,1)=='!') ? 0 : 1;
if ($expectation==0) $group_privilege = substr($group_privilege,1);
if($group_privilege && $user[$group_privilege] != $expectation)
exit('<h2>Forbidden</h2><meta http-equiv=refresh content="3;url=\'./\'">');
// ==================== //
if(isset($_REQUEST['n']) && isset($lang[$com_content[$ext]['index'][1]]))$pathway_info[] = array('title'=>$lang[$com_content[$ext]['index'][1]],'link'=>$com_content[$ext]['index'][2]);
// ==================== //
foreach ($com_content[(string)$ext] as $sub_name => $sub_conf){
if($sub_conf[4]==1){
if($sub_conf[0]){
if($user[$sub_conf[0]]==1){
$GLOBALS['context_menu'][] = array('title'=>(isset($lang[$sub_conf[1]]) ? $lang[$sub_conf[1]] : '??title??'),'link'=>(isset($sub_conf[2]) ? $sub_conf[2] : '?link?'));
}
}
else{
if(isset($lang[$sub_conf[1]]))$GLOBALS['context_menu'][] = array('title'=>$lang[$sub_conf[1]],'link'=>$sub_conf[2]);
}
}
}
if($sub){
if($com_content[$ext][$sub]){
if($com_content[$ext][$sub][0]){
if($user[$com_content[$ext][$sub][0]]==1){
$req_tpl = TRUE;
@include($script_file);
}
}
else{
$req_tpl = TRUE;
@include($script_file);

}
}
}
if(empty($_GET['nobody'])){
// DEBUG //
if((int)$MW->getConfig->generic->debuginfo){
output_message('debug','DEBUG://'.$DB->_statistics['count']);
output_message('debug','<pre>'.print_r($_SERVER,true).'</pre>');
}
// =======//

include('templates/'.(string)$MW->getConfig->generic->template.'/body_functions.php');
ob_start();
include('templates/'.(string)$MW->getConfig->generic->template.'/body_header.php');
ob_end_flush();

if($req_tpl){
if(file_exists($template_file)){
// Only cache if user is not logged in.
if ($user['id'] < 0 && (int)$MW->getConfig->generic->cache_expiretime != 0){

// Start caching process But we want to exclude some cases.
if (
isset($_REQUEST['n']) && $_REQUEST['n'] != 'account'
){
$cache->contentId = md5('CONTENT'.$_SERVER['REQUEST_URI']);
if ($cache->Valid()) {
echo $cache->content;
}else{
$cache->capture();
include($template_file);
$cache->endcapture();
}
}else{
include($template_file);
}

}else{
// Create output buffer
ob_start();
include($template_file);
ob_end_flush();
}
}
}
$time_end = microtime(1);
$exec_time = $time_end - $time_start;
include('templates/'.(string)$MW->getConfig->generic->template.'/body_footer.php');
}
else{
if(file_exists($template_file)){

include($template_file);

}
}
}
else{
echo'<h2>Forbidden</h2><meta http-equiv=refresh content="3;url=\'./\'">';
}


?>

CthulhuFtagn
26-01-10, 12:13 PM
Don't edit the index.php file at all. After you've installed the sql/ful_install.sql file to your realmd database make sure to edit your config/config-protected.php file

<?php
$realmd = array(
'db_type' => 'mysql',
'db_host' => '127.0.0.1', //ip of db realm
'db_port' => '3306', //port
'db_username' => 'root', //realm user
'db_password' => 'mangos', //realm password
'db_name' => 'realmd', //realm db name
'db_encoding' => 'utf8', // don't change
);
?>

Install the file sql/extra_install/account_pass.sql

Select the account_extend table and look-up your account in the "account_id" column.

Your account ID is cross-referenced from the corresponding account table. Looking for it in the account table first may be easier since you can see the user names associated with the account ID.

Locate the g_id column for your account_id in the account_extend table. Modify this to a 3 or a 4 to give yourself admin(3) or root admin(4) access.

Go into your realmlist table and locate the dbinfo column. Modify it to your information:

root;mangos;3306;127.0.0.1;mangos;characters

That should fix your problems.

hellrazor
26-01-10, 01:04 PM
what i do with the fullinstall.sql i click it it opens as notepad oh i open navicat and execute it to my DB? realmd

and when i open my mysql.exe on stealthgaming repack one i get SQL Error: mysqlnd cannot connect to MySQL 4.1+ using old authentication at C:\wamp\www\index.php line 71
Array this error :S is there an way i can take my other mysql and replace it with stealthgaming repacks one? or update the mysql for stealthgaming somehow

CthulhuFtagn
26-01-10, 01:29 PM
I've never used StealthGaming, sorry my friend. What you can do is backup the database(s) and then drop the current ones then use the backups from SG.

hellrazor
27-01-10, 10:12 AM
Getting this error now i changed mysql to newer version

SQL Error: at C:\wamp\www\index.php line 203
Array
(
[code] => 0
[message] =>
[query] => mysql_connect()
[context] => C:\wamp\www\index.php line 203
)

SQL Error: at C:\wamp\www\index.php line 207
Array
(
[code] => 0
[message] =>
[query] => mysql_connect()
[context] => C:\wamp\www\index.php line 207

btw i changed mysql as i said how can i make realm.exe and mangos.exe work with the new mysql ( the new mysql got all databases that i had on the old )
)

CthulhuFtagn
27-01-10, 10:38 AM
When you installed the new mysql did you use a different password?

hellrazor
27-01-10, 10:48 AM
I have set same pass on then new one still same error and cant open realm.exe and mangos.exe and same username and it got all databases :S

CthulhuFtagn
27-01-10, 10:58 AM
Make sure that inside the realmd database under the realmlist table that you've changed the ip address from 127.0.0.1 to your dns.


REPLACE INTO `realmlist` (`id`, `name`, `address`, `port`, `icon`, `color`, `timezone`, `allowedSecurityLevel`, `population`, `realmbuilds`) values('1','ForsakenWoW','forsakenwow.servegame.or g','8085','1','0','2','0','0','11159 ');