• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[XML WEBSITE] Highscores problem..

xxuxulol

Banned User
Joined
Jul 21, 2010
Messages
87
Reaction score
1
Hey guys, i opened a new 7.6 ot, and configured a website and so.. anything works fine except Highscores..., When i go to highscores, it says me "Connection to server failed, Please check server_ip settings. Please help :x :rolleyes:
 
Sure i can.

PHP:
Highscores : <?php
/*Rank displaying by rizz and wrzasq*/
include 'config.php';
include 'functions.php';
$ptitle="Highscores - $cfg[server_name]";
include 'header.php';
	// runs the script in background
  // we cannt run it directly as it takes lots of time to execute it
	// by wrzasq 
	if( (!file_exists('statistics.php') or (time()-filemtime('statistics.php')) > $cfg['rank_refresh'])	){ 
	$socket = fsockopen($cfg['server_ip'], $_SERVER['SERVER_PORT'], $errorCode, $errorString, 1);
	if ($socket === false){
		$error = 'Connection to server failed. Please check server_ip setting.';
		include('footer.php');
		die();
	}
	$url = 'GET '.str_replace(' ','%20',dirname(htmlspecialchars($_SERVER['PHP_SELF'])).'/update.php').' '.$_SERVER['SERVER_PROTOCOL']."\r\n";
    fwrite($socket, $url);
    fwrite($socket, 'Host: '.$_SERVER['HTTP_HOST']."\r\n");
    fwrite($socket, 'User-Agent: Highscores Cron Runtime by Wrzasq'."\r\n");
    fwrite($socket, 'Content-Length: 0'."\r\n");
    fwrite($socket, "\r\n");
	fclose($socket);
	}
include 'statistics.php';
$total = $statistics['census']['male'] + $statistics['census']['female'];
if ($total == 0 || empty($total)){
	@include 'statistics.bak';
	$total = $statistics['census']['male'] + $statistics['census']['female'];
}
if ($total == 0 || empty($total)){
	$error = 'No players found. Highscores are being updated.';
	include('footer.php');
	die();
}
if(isset($_GET['lvl'])){$set='level';$sets = 'lvl';$census = false;}
elseif(isset($_GET['maglvl'])){$set='magic';$sets = 'maglvl';$census = false;}
elseif(isset($_GET['fist'])){$set='fist';$sets = $set;$census = false;}
elseif(isset($_GET['club'])){$set='club';$sets = $set;$census = false;}
elseif(isset($_GET['sword'])){$set='sword';$sets = $set;$census = false;}
elseif(isset($_GET['axe'])){$set='axe';$sets = $set;$census = false;}
elseif(isset($_GET['distance'])){$set='distance';$sets = $set;$census = false;}
elseif(isset($_GET['shielding'])){$set='shield';$sets = 'shielding';$census = false;}
elseif(isset($_GET['fish'])){$set='fishing';$sets = 'fish';$census = false;}
else{$census = true;$set = 'Census';}?>
<div id="content">
<div class="top">.:Highscores:.</div>
<div class="mid">
<table id="choose-skill">
	<tr class='p0'> 
		<td> 
			Choose skill
		</td> 
	</tr>
	<tr class='p1'> 
		<td>
			<ul>
				<li> <a href='?lvl'>Level </a> </li>
				<li> <a href='?maglvl'>Magic level </a> </li>
				<li> <a href='?fist'>Fist fighting </a> </li>
				<li> <a href='?club'>Club fighting </a> </li>
				<li> <a href='?sword'>Sword fighting </a> </li>
				<li> <a href='?axe'>Axe fighting </a> </li>
				<li> <a href='?distance'>Distance fighting </a> </li>
				<li> <a href='?shielding'>Shielding </a> </li>
				<li> <a href='?fish'>Fishing </a> </li>
			</ul>
		</td>
	</tr>
</table>
<?if(!$census){
/* page system*/
$page_config = $cfg['number_per_page'];
$pages = intval(( count($statistics[$set]) - 1) / $page_config);
$site = $_GET['site'] < 0 ? 0 : ($_GET['site'] > $pages ? $pages : $_GET['site']);
for($i = $site * $page_config; $i < ($site + 1) * $page_config; $i++)
{
  if( !empty($statistics[$set][$i]) )
  {$scores[$i + 1] = $statistics[$set][$i];}
}
/* end page system*/
$it = $_GET['site'];
?>
<div id="statictics"><h1>Statistics: <?=$set; ?></h1>
<?
if($it >= 1){
$prev = $it - 1;
$next = $it+1;
echo '<a href="?'.$sets.'&amp;site='.$prev.'">&lt;</a>&nbsp;';
for ($i = 0; $i <= $pages; $i++){
	echo '<a href="?'.$sets.'&amp;site='.$i.'">'.$i.'</a>&nbsp;';
}
	  if($it != $pages){
	  echo '<a href="?'.$sets.'&amp;site='.$next.'">&gt;</a>';
}
}
if(!$it){
for ($i = 0; $i <= $pages; $i++){
	echo '<a href="?'.$sets.'&amp;site='.$i.'">'.$i.'</a>&nbsp;';
}
$next = 1;
echo '<a href="?'.$sets.'&amp;site='.$next.'">&gt;</a>';
}
?>
<table>
<?
echo '<tr class="p0"><td class="p0"><b>Rank</b></td><td class="p0"><b>Name</b></td><td class="p0"><b>Level</b></td></tr>'; }

if(isset($_GET[$sets])):
foreach($scores as $position => $score):
?>
    <tr class="<?= $score['class']; ?>">
	<td><?= $position; ?></td>
    <td><a href="characters.php?char=<?= $score['name']; ?>"><?= $score['name']; ?></a></td>
    <td><?= $score['skill']; ?></td>
	</tr>
<?php endforeach; ?><?php endif; ?>
	<? if (!$census){echo "</table></div>";} ?>
	<? if($census): ?>
	<div  id="census">
	<table>
	<tr><td><b><u><i> Gender </i></u></b></td><td> </td><td> </td></tr>
	<tr>
	<td>Male: </td><td><?= percent($statistics['census']['male'], $total); ?>% </td>
	<td>(<?= $statistics['census']['male']; ?>)
	</td>
	</tr>
	<tr>
	<td>Female: </td><td><?= percent($statistics['census']['female'], $total); ?>% </td>
	<td>(<?= $statistics['census']['female']; ?>)
	</td>
	</tr>
	</table>
	
    <table>
	<tr><td><b><u><i> Vocations </i></u></b></td><td> </td><td> </td></tr>
<?
//edit by nicaw, can handle many vocations now
//damn, this whole script sucks
foreach(array_keys($cfg['voc_normal']) as $id){?>
	<tr>
	<td><?=$cfg['voc_normal'][$id]?> </td><td><?= percent($statistics['census'][$id], $total); ?>% </td>
	<td>(<?= $statistics['census'][$id]; ?>)
	</td>
	</tr>
<?}?>
</table>
</div>
	<? endif; ?>
	<?php

function percent($first, $second)
{
 $it = $first/$second*100;
 
 return round( $it, 2 );
}

?>
</div>
<div class="bot"></div>
</div>
<?include ("footer.php");?>




And here is config.php V




PHP:
Copyright (C) 2006  Nicaw

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.

[url=http://www.gnu.org/copyleft/gpl.html]The GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)[/url]
*/
error_reporting(E_ALL ^ E_NOTICE);
//---------------------------- Data Dir ----------------------------------------

/*Set location of data directory
IMPORTANT! Use / to separate folders, put / in the end     */
$cfg['dirdata'] = 'C:\Users\Andriy\Desktop\ExtremeOT\data/';

//----------------------------- Website Configuration --------------------------

//look in skins folder to see available skins
$cfg['skin'] = 'conquest';

//name displayed in window title
$cfg['server_name'] = 'Extremalia';

/*Encrypt passwords. (true / false)
Works together with md5passwords = "yes" in server config.lua
Strongly recomended, but off by default. After changing this, existing accounts will become inaccessible!*/
$cfg['md5passwords'] = False;

/*(true / false)
Using captcha will prevent automated sripts from flooding server with accounts.
Note that GD library must be enabled in php.ini for this to work.
extension_loaded('gd') means "auto"*/
$cfg['use_captha'] = False;

/*(advanced users only) Asks user's email when registering and attempts to send greeting.
SMTP can be configured function mailex() in functions.php.
Email content can be found in new.php. You must have DNS MX record if sending from local SMTP.
Correct reverse DNS is also recomended.*/
$cfg['ask_email'] = false;

/* Session security. Set medium if you get kicked out after loging in account.
0 - low		(no fancy stuff)
1 - medium	(users are loged out after being idle for specified time interval)
2 - high	(IPs are checked to prevent session hijacking)*/
$cfg['session_security'] = 2;

//seconds in which user is loged out. default is 10 minutes: 10*60
$cfg['session_timeout'] = 10*60;

//allowed characters per account
$cfg['maxchars'] = 5;

/* enable unban feature. some servers ban permanetly for pking. if this enabled players will be unbaned when generating highscores (true / false)*/
$cfg['unban_allow'] = false;

/* time in seconds after which player can be unbaned
  (2 days)     d*hh*mm*ss;  kapish? */
$cfg['unban_after'] = 2*24*60*60;

//Delete old characters?
$cfg['delete_allow'] = true;

//delete players older than (seconds)
$cfg['delete_player'] = 2*30*24*60*60; //(2 months)

//only delete players with level lower than
$cfg['delete_level'] = 20;

/* Predefined account number.
0 - none (leave blank field),
1 - offer (put account number, but user can change it),
2 - force (dont allow user to select his own account number)*/
$cfg['account_number'] = 0;

//Vocation names
$cfg['voc_normal'] = array('Sorcerer','Druid','Paladin','Knight');

//Promoted names
$cfg['voc_promoted'] = array('Master Sorcerer','Elder Druid','Royal Paladin','Elite Knight');

//Access level names
$cfg['positions'] = array("Player", "Tutor", "Counselor", "Gamemaster", "God");

//Access level to use admin panel
$cfg['admin_access'] = 6;

//Admin Panel - attributes to load from player file (root tag only)
$cfg['admin_attrs'] = array('name', 'account', 'sex', 'exp', 'voc', 'level', 'access', 'cap', 'maglevel', 'lastlogin', 'premticks', 'promoted', 'banned');

//generate CVS players.xml file (true/false) This is mostly needed for 7.7 servers.
$cfg['CVSplayers'] = False;

//For online status. Do not change, unless you running on diferent port.
$cfg['server_ip'] = "85.242.204.132";
$cfg['server_port'] = "7171";

//----------------------------- Highscore Configuration ------------------------

 //seconds in which highscores will be reloaded. default is 3 hours: 3*60*60
$cfg['rank_refresh'] = 1*60;

// this access level and above not included in ranks
$cfg['gm_access'] = 2;

//number of ranks to cache
$cfg['highscoreshow'] = 200;

//how many displayer per page
$cfg['number_per_page'] = 30;

//----------------------------- All vocations ----------------------------------
$cfg['lvl'] = 8; 	// initial level (can be float like: 8.3 or 14.7)

//whether to allow users to choose vocations. Set to false if you have Rook system
$cfg['vocation_choose'] = True;

//Players Temple(s)

$cfg['temple']['Arkania']['x'] = 160;
$cfg['temple']['Arkania']['y'] = 54;
$cfg['temple']['Arkania']['z'] = 7;




// you might want to add GM chars here
$cfg['vip_file'] = '<?xml version="1.0"?>
<vips><vip id="1" name="GOD Mystic"/></vips>';

//Depending on server, you might need to change depot configuration
$cfg['depots'] = '
<depots>
<depot depotid="1"><item id="2590"><inside><item id="2594"/></inside></item></depot>
<depot depotid="2"><item id="2590"><inside><item id="2594"/></inside></item></depot>
<depot depotid="3"><item id="2590"><inside><item id="2594"/></inside></item></depot>
<depot depotid="4"><item id="2590"><inside><item id="2594"/></inside></item></depot>
<depot depotid="5"><item id="2590"><inside><item id="2594"/></inside></item></depot>
<depot depotid="6"><item id="2590"><inside><item id="2594"/></inside></item></depot>
<depot depotid="7"><item id="2590"><inside><item id="2594"/></inside></item></depot>
</depots>
';

// Leave this stuff as it is :P
if (!defined('MALE')) define('MALE', 1);
if (!defined('FEMALE')) define('FEMALE', 0);
if (!defined('NOVOC')) define('NOVOC', 0);
if (!defined('SORCERER')) define('SORCERER', 1);
if (!defined('DRUID')) define('DRUID', 2);
if (!defined('PALADIN')) define('PALADIN', 3);
if (!defined('KNIGHT')) define('KNIGHT', 4);

//-------------------------------- Sorcerer ------------------------------------
// Looks
$cfg['look'][SORCERER][MALE] = '130';
$cfg['look'][SORCERER][FEMALE] = '138';

// HP, mana, magic level
$cfg['health'][SORCERER] = '185';
$cfg['mana'][SORCERER] = '40';
$cfg['mlvl'][SORCERER] = '0';
$cfg['cap'][SORCERER] = '470';

// Skills:               fist,	club,	sword,	axe,	dist,	shld,	fish
$cfg['skill'][SORCERER] = array(10,	15,		15,		15,		15,		15,		15);

// Eq:               helm, amul, bp,  armor, rght, left, legs, boot, ring, ammo
$cfg['equip'][SORCERER] = array(2480, 2172, 2000, 2464, 0, 2530, 2468, 2643, 0, 0);

// Backpack:
$cfg['bp'][SORCERER] = '<item id="2554"/><item id="2120"/><item id="2398"/><item id="2412"/><item id="2388"/><item id="2190"/>';

//--------------------------------- Druid --------------------------------------
// Looks
$cfg['look'][DRUID][MALE] = '130';
$cfg['look'][DRUID][FEMALE] = '138';

// HP, mana, magic level
$cfg['health'][DRUID] = '185';
$cfg['mana'][DRUID] = '40';
$cfg['mlvl'][DRUID] = '0';
$cfg['cap'][DRUID] = '470';

// Skills:               fist,	club,	sword,	axe,	dist,	shld,	fish
$cfg['skill'][DRUID] = array(10,	15,		15,		15,		15,		15,		15);

// Eq:               helm, amul, bp,  armor, rght, left, legs, boot, ring, ammo
$cfg['equip'][DRUID] = array(2480, 2172, 2000, 2464, 0, 2530, 2468, 2643, 0, 0);

// Backpack:
$cfg['bp'][DRUID] = '<item id="2554"/><item id="2120"/><item id="2398"/><item id="2412"/><item id="2388"/><item id="2182"/>';

//-------------------------------- Paladin -------------------------------------
// Looks
$cfg['look'][PALADIN][MALE] = '129';
$cfg['look'][PALADIN][FEMALE] = '137';

// HP, mana, magic level
$cfg['health'][PALADIN] = '185';
$cfg['mana'][PALADIN] = '40';
$cfg['mlvl'][PALADIN] = '0';
$cfg['cap'][PALADIN] = '470';

// Skills:               fist,	club,	sword,	axe,	dist,	shld,	fish
$cfg['skill'][PALADIN] = array(10,	15,		15,		15,		15,		15,		15);

// Eq:               helm, amul, bp,  armor, rght, left, legs, boot, ring, ammo
$cfg['equip'][PALADIN] = array(2480, 2172, 2000, 2464, 0, 2530, 2468, 2643, 0, 0);

// Backpack:
$cfg['bp'][PALADIN] = '<item id="2554"/><item id="2120"/><item id="2398"/><item id="2412"/><item id="2388"/><item id="2389" count="3"/>';

//--------------------------------- Knight -------------------------------------
// Looks
$cfg['look'][KNIGHT][MALE] = '131';
$cfg['look'][KNIGHT][FEMALE] = '139';

// HP, mana, magic level
$cfg['health'][KNIGHT] = '185';
$cfg['mana'][KNIGHT] = '40';
$cfg['mlvl'][KNIGHT] = '0';
$cfg['cap'][KNIGHT] = '470';

// Skills:               fist,	club,	sword,	axe,	dist,	shld,	fish
$cfg['skill'][KNIGHT] = array(10,	20,		20,		20,		15,		20,		15);

// Eq:               helm, amul, bp,  armor, rght, left, legs, boot, ring, ammo
$cfg['equip'][KNIGHT] = array(2480, 2172, 2000, 2464, 0, 2530, 2468, 2643, 0, 0);

// Backpack:
$cfg['bp'][KNIGHT] = '<item id="2554"/><item id="2120"/><item id="2398"/><item id="2412"/><item id="2388"/>';

//-------------------------------- No Vocation ---------------------------------
// Looks
$cfg['look'][NOVOC][MALE] = '130';
$cfg['look'][NOVOC][FEMALE] = '138';

// HP, mana, magic level
$cfg['health'][NOVOC] = '150';
$cfg['mana'][NOVOC] = '0';
$cfg['mlvl'][NOVOC] = '0';
$cfg['cap'][NOVOC] = '400';

// Skills:               fist,	club,	sword,	axe,	dist,	shld,	fish
$cfg['skill'][NOVOC] = array(1,	1,		1,		1,		1,		1,		1);

// Eq:               helm, amul, bp,  armor, rght, left, legs, boot, ring, ammo
$cfg['equip'][NOVOC] = array(0, 0, 3939, 2650, 2382, 0, 0, 0, 0, 2050);

// Backpack:
$cfg['bp'][NOVOC] = '<item id="2674"/>';

//-------------------------- NOOB SENSATIVE -----------------------------------

//relative paths hidden here from newbs. If you are one: DO NOT EDIT
$cfg['diraccount'] = $cfg['dirdata'].'accounts/';
$cfg['dirplayer'] = $cfg['dirdata'].'players/';
$cfg['dirmonster'] = $cfg['dirdata'].'monster/';
$cfg['dirvip'] = $cfg['dirdata'].'vip/';
$cfg['dirhouse'] = $cfg['dirdata'].'houses/';
$cfg['dirdeleted'] = $cfg['dirdata'].'deleted/';

//-------------------------- END OF CONFIGURATION -----------------------------

//checking if directories defined previously really exist
if (!(is_dir($cfg['dirplayer']) && is_dir($cfg['diraccount']))){
	$error = "Warning!<br/>\n Please set correct data directory in config.php";

}

//checking if IP not banned
if (file_exists('banned.txt')){
$banned_ips = file ('banned.txt');
foreach ($banned_ips as $ip){
	if ($ip == $_SERVER['REMOTE_ADDR']){
		die("Sorry, your IP is banned from the website.");
		//ha ha ha. die die die. I love this function :D you're dead bye :P
	}
}
}

//Calculating correct exp for level
$cfg['exp'] = round(50*($cfg['lvl']-1)*($cfg['lvl']*$cfg['lvl']-5*$cfg['lvl']+12)/3);
$cfg['lvl'] = floor($cfg['lvl']);

//disable magic_quotes_gpc. ty wrzasq
{
  $_POST = array_map('stripslashes', $_POST);
  $_GET = array_map('stripslashes', $_GET);
  $_COOKIE = array_map('stripslashes', $_COOKIE);
  $_REQUEST = array_map('stripslashes', $_REQUEST);
}

//Check for correct PHP version
if (!version_compare(phpversion(), "5.1.4", ">=") )
	$error = "You need PHP 5.1.4 or later to run this AAC. Try the latest XAMPP.";

//Check if extensions loaded
if (!extension_loaded('simplexml'))
	$error = "SimpleXML is not enabled in php.ini";
?>
 
Last edited:
Please put them inside php tags rather than making them bold.
PHP:
text[./php] (remote the dot before /php])
 
In the first file, try changing
PHP:
$socket = fsockopen($cfg['server_ip'], $_SERVER['SERVER_PORT'], $errorCode, $errorString, 1);
to
PHP:
$socket = fsockopen($cfg['server_ip'], $_SERVER['server_port'], $errorCode, $errorString, 1);

If that does not work, is your port 7171 open?
 
Didnt work ;/, Yes my port 7171 in open, just like my ot, u can check, extremalia.no-ip.info , « its website & Ip.
I got no idea why its like dis ;x

I had another good website, but it had a problem if u make 1 character, than relog or die, and if u make another character in the same acc, the whole acc gets bugged, its like account/password is not correct, so i had to change, now i got this problem :x

By the way, when i've put server_port, Highscores we're redirected to myip:0, and when SERVER_PORT to myip:8090 ;x any idea?
 
Sorry for the delayed response. I was putting together my new chair.

Hm, that is weird indeed. Seeing as the lowercase version is the one that exists in your config file, not the uppercase one.

Could you try putting error_reporting( E_ALL ); at the very top of your script, just below the <?php tag.
 
Problem solved. The server_port was not returning the proper port.

(And excuse my lack of reading in my previous post, it was clearly a server variable, not the config variable that I first thought)
 
Chris, another thing, I got a forum, and in website there is "forum" option, how do i do, so it will be redirected to my forum, when i press there? :p :$
 
Problem solved. The server_port was not returning the proper port.

(And excuse my lack of reading in my previous post, it was clearly a server variable, not the config variable that I first thought)


i got the same problem, could you plase explain how you fixed it?
 
Back
Top