• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction (6.1) Cyber's REPSystem w/Opinion Points for 0.4 && mAAC

Is this the best reputation system?

  • Yes.

    Votes: 131 66.2%
  • No.

    Votes: 30 15.2%
  • It's good but can be improved.

    Votes: 37 18.7%

  • Total voters
    198
  • Poll closed .
Status
Not open for further replies.
Help me pls! I have debug when im "Legendary Hero" and i wanna to say !rep ;/ what is going on? ;/
 
same happened to me, i think those looktypes are only working for 0.3.5.. i changed it to yalaharian one xD
 
Help me pls! I have debug when im "Legendary Hero" and i wanna to say !rep ;/ what is going on? ;/

my buddy, I'm sure you are not installing the system well. If you won't use the MOD but the luas, then copy them well, this system does not have failures there, I have done many tests to all scripts

by the way, Legendary Hero is CM outfit

Added to my Server, it's so NICE
where's my rep :D
 
well cyber i had the same problem with king/queen looktype.. i was getting debug so i had to change it. it was the only one that gave me that error.. everything else worked perfect
BTW: impatiently waiting for updates :D
 
i dont know if that will work but thats is just a idea

on data\creaturescripts\scripts

Advance.lua

Code:
--Script made by Pitufo/Haifurer, edited by figaro!
local config = {
    [0] = { "Fist skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [1] = { "Club skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [2] = { "Sword skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [3] = { "Axe skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [4] = { "Distance skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [5] = { "Shield skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [6] = { "Fishing skill UP", 30}, -- 30 = variable[2]  -- Animation effect
    [7] = { "Magic level UP", 30}, -- 30 = variable[2]  -- Animation effect
    [8] = { "Level UP", 30} -- 30 = variable[2]  -- Animation effect
}


function onAdvance(cid, skill, oldlevel, newlevel)

local pos = getPlayerPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 3, z = pos.z},
{x = pos.x, y = pos.y + 3, z = pos.z},
{x = pos.x - 3, y = pos.y, z = pos.z},
{x = pos.x + 3, y = pos.y, z = pos.z},
{x = pos.x - 2, y = pos.y - 2, z = pos.z},
{x = pos.x + 2, y = pos.y - 2, z = pos.z},
{x = pos.x + 2, y = pos.y + 2, z = pos.z},
{x = pos.x - 2, y = pos.y + 2, z = pos.z}
}

        
    for type, variable in pairs(config) do
        if skill == type then
            doCreatureSay(cid, ""..variable[1].." ["..newlevel.."]", TALKTYPE_ORANGE_1)
	for _, ePos in ipairs(effectPositions) do
		doSendDistanceShoot(pos, ePos, CONST_ANI_SMALLHOLY)
		doSendMagicEffect(ePos, CONST_ME_HOLYAREA)
                addPlayerRep(cid, 3, TEXTCOLOR_BLUE)
            end

            
        end
    end    
return TRUE
end

creaturescripts.xml

Code:
<event type="advance" name="advance" event="script" value="advance.lua"/>

login.lua

Code:
registerCreatureEvent(cid, "advance")

Im put effect and give rep when player got any skill ...


Script made by
Pitufo
Haifurer, edited by figaro

I just use that for mine idea but dont work what i need did to madethat work ? ... :D
 
Last edited:
but you added the function, so it must be working(addPlayerRep)

but I don't recommend you to use it that way since players may overrep each time they get killed just when they leveled up, then to get repped again, it just needs a storage check as a fix that I might script later. thnx for it anyway
 
but you added the function, so it must be working(addPlayerRep)

but I don't recommend you to use it that way since players may overrep each time they get killed just when they leveled up, then to get repped again, it just needs a storage check as a fix that I might script later. thnx for it anyway

Yeah but when they be killed they lose 5 rep points i just wanna give 1 maybe 2 points if research lvl os skills ....
 
well I don't suggest you to do it based on skills otherwise players will get rich of rep
Yeah but when they be killed they lose 5 rep points i just wanna give 1 maybe 2 points if research lvl os skills ....
you mean this?
Lua:
addPlayerRep(cid, 1, TEXTCOLOR_BLUE)
or
Lua:
addPlayerRep(cid, 2, TEXTCOLOR_BLUE)
 
Cibermaster!! release!! hahaha.. truely i ve been refreshing the web every 10 min since monday haha... ^^ until then.. do you think this script should work?.


PHP:
-- >>> Scripted IN and ONLY for TFS 0.3<<< --

function onKill(cid, target, lastHit)
        if(isPlayer(target) ~= true) then
        return true
    end

        if (isPlayer(cid) == true) and (isPlayer(target) == true) then
	 points1 = getRepPoints(cid)
	 points2 = getRepPoints(target)
	 formula1 = -- working on it
	 formula2 = -- working on it
	 formula3 = -- working on it
                if getPlayerSkullType(target) == SKULL_WHITE or getPlayerSkullType(target) == SKULL_RED then
	                if getRepPoints(cid) >= 0 and getRepPoints(target) >= 0 then
			  	addPlayerRep(cid, formula1, TEXTCOLOR_LIGHTBLUE)
              	  elseif getRepPoints(cid) >= 0 and getRepPoints(target) <= -1 then
		  		addPlayerRep(cid, formula1, TEXTCOLOR_LIGHTBLUE)
                	  elseif getRepPoints(cid) <= -1 and getRepPoints(target) >= 0 then
		  		addPlayerRep(cid, formula2, TEXTCOLOR_RED)
                	  elseif getRepPoints(cid) <= -1 and getRepPoints(target) <= 0 then
		  		addPlayerRep(cid, formula2, TEXTCOLOR_RED)
               	  end
                elseif getPlayerSkullType(target) == SKULL_NONE then
	                if getRepPoints(cid) >= 0 and getRepPoints(cid) <= 300 and getRepPoints(target) >= 0 then		
		  		removePlayerRep(cid, 50, TEXTCOLOR_RED)
	                elseif getRepPoints(cid) >= 301 and getRepPoints(cid) <= 500 and getRepPoints(target) >= 0 then
		  		removePlayerRep(cid, 100, TEXTCOLOR_RED)
	                elseif getRepPoints(cid) >= 501 and getRepPoints(cid) <= 1000 and getRepPoints(target) >= 0 then
		  		removePlayerRep(cid, 200, TEXTCOLOR_RED)
	                elseif getRepPoints(cid) >= 1001 and getRepPoints(cid) <= 3000 and getRepPoints(target) >= 0 then
		  		removePlayerRep(cid, 300, TEXTCOLOR_RED)
	                elseif getRepPoints(cid) >= 3001 and getRepPoints(cid) <= 5000 and getRepPoints(target) >= 0 then
		  		removePlayerRep(cid, 500, TEXTCOLOR_RED)
	                elseif getRepPoints(cid) >= 5001 and getRepPoints(target) >= 0 then
		  		removePlayerRep(cid, 1000, TEXTCOLOR_RED)
              	  elseif getRepPoints(cid) >= 0 and getRepPoints(target) <= -1 then
			  	addPlayerRep(cid, formula1, TEXTCOLOR_LIGHTBLUE)
                	  elseif getRepPoints(cid) <= -1 and getRepPoints(target) >= 0 then
		  		addPlayerRep(cid, formula2, TEXTCOLOR_RED)
                	  elseif getRepPoints(cid) <= -1 and getRepPoints(target) <= 0 then
		  		addPlayerRep(cid, formula2, TEXTCOLOR_RED)
			  end
		  end
        return TRUE
        end
end
 
it's somewhat like that, but it can be reduced using tables, ofc you don't have to do that
btw I won't update the sys for some days, I've been busy lately
 
Okey dude ;).. just pushing you up ;D.. in a good way i mean hehe..
thanks for the system btw
 
heya everyone, perfect php just uploaded
update your aac scripts if you're using my sys
added a very good rep highscore page, thanks to makromango
 
Last edited:
Fatal error: Call to a member function query() on a non-object in /var/www/rep.php on line 6

:S

Do i have to restart mysql service?

for some reason Reputation Highscores isnt even shown in my index.php
what could it be?
 
Last edited:
Fatal error: Call to a member function query() on a non-object in /var/www/rep.php on line 6

:S

Do i have to restart mysql service?

for some reason Reputation Highscores isnt even show in my index.php
what could it be?
wait... must be something that I missed^_^

edit: maybe it's your gesior or something you missed, I have checked mine and I know I posted all necessary functions to make it work
post me ur gesior and the link
I won't be able to reply you until tomorrow so c'ya
 
Last edited:
characters.php

PHP:
<?PHP
$name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
if(empty($name)) {
	$main_content .= 'Here you can get detailed information about a certain player on '.$config['server']['serverName'].'.<BR>  <FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
}
else
{
	if(check_name($name)) {
		$player = $ots->createObject('Player');
		$player->find($name);
		if($player->isLoaded()) {
			$account = $player->getAccount();
			$main_content .= '<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Character Information</B></TD></TR>';
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=20%>Name:</TD><TD><font color="';
			$main_content .= ($player->isOnline()) ? 'green' : 'red';
			$main_content .= '"><b>'.$player->getName().'</b></font>';
			if($player->isDeleted())
				$main_content .= '<font color="red"> [DELETED]</font>';
			if($player->isNameLocked())
				$main_content .= '<font color="red"> [NAMELOCK]</font>';
			$main_content .= '</TD></TR>';
			if($player->getOldName())
			{
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				if($player->isNameLocked())
					$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Proposition:</TD><TD>'.$player->getOldName().'</TD></TR>';
				else
					$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Old name:</TD><TD>'.$player->getOldName().'</TD></TR>';
			}
			/*
			$group = $player->getGroup();
			if($group->getId() != 1)
			{
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Position:</TD><TD>'.$group->getName().'</TD></TR>';
			}
			*/
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Sex:</TD><TD>';
			$main_content .= ($player->getSex() == 0) ? 'female' : 'male';
			$main_content .= '</TD></TR>';
			if($config['site']['show_marriage_info'])
			{
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Marital status:</TD><TD>';
				$marriage = new OTS_Player();
				$marriage->load($player->getMarriage());
				if($marriage->isLoaded())
					$main_content .= 'married to <a href="?subtopic=characters&name='.urlencode($marriage->getName()).'"><b>'.$marriage->getName().'</b></a></TD></TR>';
				else
					$main_content .= 'single</TD></TR>';
			}
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Profession:</TD><TD>'.$vocation_name[$player->getWorld()][$player->getPromotion()][$player->getVocation()].'</TD></TR>';
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Level:</TD><TD>'.$player->getLevel().'</TD></TR>';
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>World:</TD><TD>'.$config['site']['worlds'][$player->getWorld()].'</TD></TR>';
			if(!empty($towns_list[$player->getWorld()][$player->getTownId()]))
			{
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Residence:</TD><TD>'.$towns_list[$player->getWorld()][$player->getTownId()].'</TD></TR>';
			}
			$rank_of_player = $player->getRank();
			if(!empty($rank_of_player))
			{
			{
			$guild_id = $rank_of_player->getGuild()->getId();
			$guild_name = $rank_of_player->getGuild()->getName();
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Guild Membership:</TD><TD>'.$rank_of_player->getName().' of the <a href="?subtopic=guilds&action=show&guild='.$guild_id.'">'.$guild_name.'</a></TD></TR>';
			} 
			}
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$lastlogin = $player->getLastLogin();
			if(empty($lastlogin))
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Last login:</TD><TD>Never logged in.</TD></TR>';
			else
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Last login:</TD><TD>'.date("j F Y, g:i a", $lastlogin).'</TD></TR>';
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			if($config['site']['show_creationdate'] && $player->getCreated())
			{
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Created:</TD><TD>'.date("j F Y, g:i a", $player->getCreated()).'</TD></TR>';
			}
			{
			//THE Players'REP++ System by Cybermaster
			//Function by MakroMango
			$ranx = reputation($player->getCustomField("rep"));
			if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD><B>Reputation:</B></TD><TD>'.$ranx[1].' '.$ranx[0].'</TD></TR>';    
			}

			if($config['site']['show_vip_status'])
			{
           		 $id = $player->getCustomField("id");
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
         		   $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Vip Status:</TD>';
                         $vip = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$config['site']['show_vip_storage'].';')->fetch();
         		   if($vip == false) {
        		    $main_content .= '<TD><span class="red"><B>NOT VIP</B></TD></TR>';
        		    }
        		    else
       			     {
       		          $main_content .= '<TD><span class="green"><B>VIP</B></TD></TR>';
          		  }
			$comment = $player->getComment();
			$newlines   = array("\r\n", "\n", "\r");
			$comment_with_lines = str_replace($newlines, '<br />', $comment, $count);
			if($count < 50)
				$comment = $comment_with_lines;
			if(!empty($comment))
			{
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD VALIGN=top>Comment:</TD><TD>'.$comment.'</TD></TR>';
			}
			}
			$main_content .= '</TABLE>';
			if($config['site']['show_skills_info'])
			{
				$main_content .= '<br><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=160><TR><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=160><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Skills</B></TD></TR>';
				$main_content .= '<tr bgcolor="'.$config['site']['darkborder'].'"><td width="120">Magic level</td><td align="right">'.$player->getMagLevel().'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td width="120">Fist Fighting</td><td align="right">'.$player->getSkill(0).'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['darkborder'].'"><td width="120">Club Fighting</td><td align="right">'.$player->getSkill(1).'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td width="120">Sword Fighting</td><td align="right">'.$player->getSkill(2).'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['darkborder'].'"><td width="120">Axe Fighting</td><td align="right">'.$player->getSkill(3).'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td width="120">Distance Fighting</td><td align="right">'.$player->getSkill(4).'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['darkborder'].'"><td width="120">Shielding</td><td align="right">'.$player->getSkill(5).'</td></tr>';
				$main_content .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td width="120">Fishing</td><td align="right">'.$player->getSkill(6).'</td></tr>';
				$main_content .= '</TABLE></TABLE>';
			}

			//modified status scripts by ballack13
			$main_content .= '<table width=100%><tr>';
                        //equipment shower by ballack13
			$id = $player->getCustomField("id");
			$number_of_items = 1;
			$main_content .= '<td align=center><table with=100% style="border: solid 1px #888888;" CELLSPACING="1"><TR>';		
                        $list = array('2','1','3','6','4','5','9','7','10','8'); 
                        foreach ($list as $pid => $name) {
                        $top = $SQL->query('SELECT * FROM player_items WHERE player_id = '.$id.' AND pid = '.$list[$pid].';')->fetch();
                           if($top[itemtype] == false) {
                           if($list[$pid] == '8') {
			$main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$player->getSoul().'</td>';
			}
				if(is_int($number_of_items / 3)){
			$main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD></tr><tr>';
				} else {
			$main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$list[$pid].'.gif"/></TD>';
			}
				$number_of_items++;
			}
			else
			{
                           if($list[$pid] == '8') {
			$main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Soul:<br/>'.$player->getSoul().'</td>';
			}
				if(is_int($number_of_items / 3))
			$main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="45"/></TD></tr><tr>';
				else
			$main_content .= '<TD style="background-color: '.$config['site']['darkborder'].'; text-align: center;"><img src="images/items/'.$top[itemtype].'.gif" width="45"/></TD>';
				$number_of_items++;
			}
                           if($list[$pid] == '8') {
			$main_content .= '<td style="background-color: '.$config['site']['darkborder'].'; text-align: center;">Cap:<br/>'.$player->getCap().'</td>';
			}
			}
			$main_content .= '</tr></TABLE></td>';

                        //Hp/Mana/Exp Status by ballack13
                        $hp = ($player->getHealth() / $player->getHealthMax() * 100);
                        $mana = ($player->getMana() / $player->getManaMax() * 100);
          		$main_content .= '<td align=center ><table width=100%><tr><td align=center><table CELLSPACING="1" CELLPADDING="4"><tr><td BGCOLOR="#D4C0A1" align="left" width="20%"><b>Player Health:</b></td>
                  		          <td BGCOLOR="#D4C0A1" align="left">'.$player->getHealth().'/'.$player->getHealthMax().'<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.$hp.'%; height: 3px;"></td></tr>
                  		          <tr><td BGCOLOR="#F1E0C6" align="left"><b>Player Mana:</b></td><td BGCOLOR="#F1E0C6" align="left">'.$player->getMana().'/'.$player->getManaMax().'<div style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: blue; width: '.$mana.'%; height: 3px;"></td></tr></table><tr>';

                        $next = ($player->getLevel() + 1);
                        $exp = ((50 / 3) * ($player->getLevel() * $player->getLevel() * $player->getLevel()) - (100 * ($player->getLevel() * $player->getLevel())) + ((850/3) * $player->getLevel()) - 200);
                        $expnext = ((50 / 3) * ($next * $next * $next) - (100 * ($next * $next)) + ((850/3) * $next) - 200 - $player->getExperience());
                        $expresult = ($expnext / (($expnext  + $player->getExperience()) - $exp) * 100);
           	        $main_content .= '<tr><table CELLSPACING="1" CELLPADDING="4"><tr><td BGCOLOR="#D4C0A1" align="left" width="20%"><b>Player Level:</b></td><td BGCOLOR="#D4C0A1" align="left">'.$player->getLevel().'</td></tr>
                        		  <tr><td BGCOLOR="#F1E0C6" align="left"><b>Player Experience:</b></td><td BGCOLOR="#F1E0C6" align="left">'.$player->getExperience().' EXP.</td></tr>
                		          <tr><td BGCOLOR="#D4C0A1" align="left"><b>To Next Level:</b></td><td BGCOLOR="#D4C0A1" align="left">You need <b>'.$exp.' EXP</b> to Level <b>'.$next.'</b>.<div title="99.320604545 %" style="width: 100%; height: 3px; border: 1px solid #000;"><div style="background: red; width: '.$expresult.'%; height: 3px;"></td></tr></table></td></tr></table></tr></TABLE></td>';

			//Player Skills
			$main_content .= '<TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=4 CLASS=white><B>Character Skills</B></TD></TR>';
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=45%>Magic Level:</TD><TD WIDTH=5% ALIGN="center">'.$player->getMagLevel().'</TD><TD WIDTH=45%>Fist Fighting:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(0).'</a></TD></TR>';
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=45%>Club Fighting:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(1).'</a></TD><TD WIDTH=45%>Sword Fighting:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(2).'</a></TD></TR>';
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=45%>Axe Fighting:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(3).'</a></TD><TD WIDTH=45%>Distance Fighting:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(4).'</a></TD></TR>';
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=45%>Shielding:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(5).'</a></TD><TD WIDTH=45%>Fishing:</TD><TD WIDTH=5% ALIGN="center">'.$player->getSkill(6).'</a></TD></TR>';
			$main_content .= '</TD></TR></TABLE><BR>';


			//quest status by ballack13
			$id = $player->getCustomField("id");
			$number_of_quests = 0;
			$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD align="left" COLSPAN=2 CLASS=white><B>Quests</B></TD></TD align="right"></TD></TR>';		
                        $quests = array('Bright Sword Quest' => 3029,'Ancient Tombs Quest' => 33423,'Annihilator' => 100,'Demon Helmet' => 5909,'Pits of Inferno' => 8742,'Inquisition' => 5619,'Demon Oak' => 50090,'Koshei the Deathless Quest' => 7518,'Banshee Quest' => 2134,'Desert Quest' => 9993,'Naginata Quest' => 33461,'Mad Mage Quest' => 7539,'Black Knight Quest' => 2510,'Necromancer Quest' => 2411,'Warlock Quest' => 5011,'Arena Greenshore'=> 42361,'Arena Scrapper'=> 42371,'Arena Warlord'=> 42381); 
                        foreach ($quests as $storage => $name) {
				if(is_int($number_of_quests / 2))
					$bgcolor = $config['site']['darkborder'];
				else
					$bgcolor = $config['site']['lightborder'];
				$number_of_quests++;
			$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=95%>'.$storage.'</TD>';
                        $quest = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$quests[$storage].';')->fetch();
                           if($quest == false) {
			$main_content .= '<TD><img src="images/false.png"/></TD></TR>';
                        }
			else
			{
			$main_content .= '<TD><img src="images/true.png"/></TD></TR>';
			}
			}
			$main_content .= '</TABLE></td></tr></table>';
			//deaths list
			$player_deaths = $SQL->query('SELECT * FROM player_deaths WHERE '.$player->getId().' = player_id ORDER BY time DESC');
			$dead_add_content .= '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Deaths</B></TD></TR>';
			if(!empty($player_deaths))
			{
				$vowels = array("e", "y", "u", "i", "o", "a");
				foreach($player_deaths as $dead)
				{
					if(is_int($number_of_player_deaths / 2))
						$bgcolor = $config['site']['darkborder'];
					else
						$bgcolor = $config['site']['lightborder'];
					$number_of_player_deaths++;
					$dead_add_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=20%>'.date("j M Y, H:i", $dead['time']).'</TD><TD>Killed at Level '.$dead['level'].' by ';
					if(is_numeric($dead['killed_by']))
					{
						$player_char = new OTS_Player();
						$player_char->load($dead['killed_by']);
						if($player_char->isLoaded())
							$dead_add_content .= '<a href="?subtopic=characters&name='.urlencode($player_char->getName()).'"><b>'.$player_char->getName().'</b></a>';
						else
							$dead_add_content .= '<b>DELETED PLAYER</b>';
					}
					else
						if($dead['killed_by'] == "-1")
							$dead_add_content .= "item or field";
						else
						{
							if(in_array(substr(strtolower($dead['killed_by']), 0, 1), $vowels))
								$dead_add_content .= "an ";
							else
								$dead_add_content .= "a ";
							$dead_add_content .= $dead['killed_by'];
						}
					if(!empty($dead['altkilled_by']) && $dead['killed_by'] != $dead['altkilled_by'])
						if(is_numeric($dead['altkilled_by']))
						{
							$player_char = new OTS_Player();
							$player_char->load($dead['altkilled_by']);
							if($player_char->isLoaded())
								$dead_add_content .= ' and <a href="?subtopic=characters&name='.urlencode($player_char->getName()).'"><b>'.$player_char->getName().'</b></a>';
							else
								$dead_add_content .= '<b>DELETED PLAYER</b>';
						}
						else
							if($dead['altkilled_by'] == "-1")
								$dead_add_content .= "item or field";
							else
							{
								if(in_array(substr(strtolower($dead['altkilled_by']), 0, 1), $vowels))
									$dead_add_content .= " and an ";
								else
									$dead_add_content .= " and a ";
								$dead_add_content .= $dead['altkilled_by'];
							}					
					$dead_add_content .= '.</TD></TR>';
				}
			}
			$dead_add_content .= '</TABLE>';
			if($number_of_player_deaths > 0)
				$main_content .= $dead_add_content;
			if(!$player->getHideChar()) {
				$main_content .= '<br><TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Account Information</B></TD></TR>';
				if($account->getRLName())
				{
					if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
					$main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Real name:</TD><TD>'.$account->getRLName().'</TD></TR>';
				}
				if($account->getLocation())
				{
					if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
					$main_content .= '<TR BGCOLOR='.$config['site']['darkborder'].'><TD WIDTH=20%>Location:</TD><TD>'.$account->getLocation().'</TD></TR>';
				}
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				if($account->getLastLogin())
					$main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Last login:</TD><TD>'.date("j F Y, g:i a", $account->getLastLogin()).'</TD></TR>';
				else
					$main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Last login:</TD><TD>Never logged in.</TD></TR>';
				if($account->getCreated())
				{
					if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
					$main_content .= '<TR BGCOLOR='.$config['site']['lightborder'].'><TD WIDTH=20%>Created:</TD><TD>'.date("j F Y, g:i a", $account->getCreated()).'</TD></TR>';
				}
				if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
				$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>Account*Status:</TD><TD>';
				$main_content .= ($account->isPremium()) ? '<b><font color="green">Premium Account</font></b>' : '<b><font color="red">Free Account</font></b>';
				if($account->isBanned())
					if($account->getBanTime() > 0)
						$main_content .= '<font color="red"> [Banished until '.date("j F Y, G:i", $account->getBanTime()).']</font>';
					else
						$main_content .= '<font color="red"> [Banished FOREVER]</font>';
				$main_content .= '</TD></TR></TABLE>';
				$main_content .= '<br><TABLE BORDER=0><TR><TD></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD COLSPAN=5 CLASS=white><B>Characters</B></TD></TR>
				<TR BGCOLOR='.$config['site']['darkborder'].'><TD><B>Name</B></TD><TD><B>World</B></TD><TD><B>Level</B></TD><TD><b>Status</b></TD><TD><B>*</B></TD></TR>';
				$account_players = $account->getPlayersList();
				$account_players->orderBy('name');
				$player_number = 0;
				foreach($account_players as $player_list)
				{
					if(!$player_list->getHideChar())
					{
						$player_number++;
						if(is_int($player_number / 2))
							$bgcolor = $config['site']['darkborder'];
						else
							$bgcolor = $config['site']['lightborder'];
						if(!$player_list->isOnline())
							$player_list_status = '<font color="red">Offline</font>';
						else
							$player_list_status = '<font color="green">Online</font>';
						$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=52%><NOBR>'.$player_number.'.*'.$player_list->getName();
						$main_content .= ($player_list->isDeleted()) ? '<font color="red"> [DELETED]</font>' : '';
						$main_content .= '</NOBR></TD><TD WIDTH=15%>'.$config['site']['worlds'][$player_list->getWorld()].'</TD><TD WIDTH=25%>'.$player_list->getLevel().' '.$vocation_name[$player_list->getWorld()][$player_list->getPromotion()][$player_list->getVocation()].'</TD><TD WIDTH="8%"><b>'.$player_list_status.'</b></TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="?subtopic=characters" METHOD=post><TR><TD><INPUT TYPE=hidden NAME=name VALUE="'.$player_list->getName().'"><INPUT TYPE=image NAME="View '.$player_list->getName().'" ALT="View '.$player_list->getName().'" SRC="'.$layout_name.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></TD></TR>';
					}
				}
				$main_content .= '</TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';
			}
			$main_content .= '<BR><BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
			$main_content .= '</TABLE>';
		}
		else
			$search_errors[] = 'Character <b>'.$name.'</b> does not exist.';
	}
	else
		$search_errors[] = 'This name contains invalid letters. Please use only A-Z, a-z and space.';
	if(!empty($search_errors))
	{
		$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
		foreach($search_errors as $search_error)
			$main_content .= '<li>'.$search_error;
		$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
		$main_content .= '<BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
	}
}
config-and-functions.php

PHP:
<?PHP
// ###################### CONFIG ########################
//load page config file
$config['site'] = parse_ini_file('config/config.ini');
include('config/config.php');
//check install
if($config['site']['install'] != "no")
{
	header("Location: install.php");
	exit;
}
//load server config
$config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
if(isset($config['server']['mysqlHost']))
{
	//new (0.2.6+) ots config.lua file
	$mysqlhost = $config['server']['mysqlHost'];
	$mysqluser = $config['server']['mysqlUser'];
	$mysqlpass = $config['server']['mysqlPass'];
	$mysqldatabase = $config['server']['mysqlDatabase'];
}
elseif(isset($config['server']['sqlHost']))
{
	//old (0.2.4) ots config.lua file
	$mysqlhost = $config['server']['sqlHost'];
	$mysqluser = $config['server']['sqlUser'];
	$mysqlpass = $config['server']['sqlPass'];
	$mysqldatabase = $config['server']['sqlDatabase'];
}
$sqlitefile = $config['server']['sqliteDatabase'];
$passwordency = '';
if(strtolower($config['server']['useMD5Passwords']) == 'yes' || strtolower($config['server']['passwordType']) == 'md5')
	$passwordency = 'md5';
if(strtolower($config['server']['passwordType']) == 'sha1')
	$passwordency = 'sha1';
// loads #####POT mainfile#####
include('pot/OTS.php');
// PDO and POT connects to database
$ots = POT::getInstance();
if(strtolower($config['server']['sqlType']) == "mysql")
{
	//connect to MySQL database
	try
	{
		$ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
	}
	catch(PDOException $error)
	{
	    echo 'Database error - can\'t connect to MySQL database. Possible reasons:<br>1. MySQL server is not running on host.<br>2. MySQL user, password, database or host isn\'t configured in: <b>'.$config['site']['server_path'].'config.lua</b> .<br>3. MySQL user, password, database or host is wrong.';
		exit;
	}
}
elseif(strtolower($config['server']['sqlType']) == "sqlite")
{
	//connect to SQLite database
	$link_to_sqlitedatabase = $config['site']['server_path'].$sqlitefile;
	try
	{
		$ots->connect(POT::DB_SQLITE, array('database' => $link_to_sqlitedatabase));
	}
	catch(PDOException $error)
	{
	    echo 'Database error - can\'t open SQLite database. Possible reasons:<br><b>'.$link_to_sqlitedatabase.'</b> - file isn\'t valid SQLite database.<br><b>'.$link_to_sqlitedatabase.'</b> - doesn\'t exist.<br><font color="red">Wrong PHP configuration. Default PHP does not work with SQLite databases!</font>';
		exit;
	}
}
else
{
	echo 'Database error. Unknown database type in <b>'.$config['site']['server_path'].'config.lua</b> . Must be equal to: "<b>mysql</b>" or "<b>sqlite</b>". Now is: "<b>'.strtolower($config['server']['sqlType']).'"</b>';
	exit;
}

$SQL = POT::getInstance()->getDBHandle();
$layout_name = "layouts/".$layout_name = $config['site']['layout'];;
$layout_ini = parse_ini_file($layout_name.'/layout_config.ini');
foreach($layout_ini as $key => $value)
	$config['site'][$key] = $value;
//###################### FUNCTIONS ######################
function isPremium($premdays, $lastday)
{
	return ($premdays - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $lastday))) - date("z", $lastday)) > 0);
}
//save config in ini file
function saveconfig_ini($config)
{
	$file = fopen("config/config.ini", "w");
	foreach($config as $param => $data)
	{
$file_data .= $param.' = "'.str_replace('"', '', $data).'"
';
	}
	rewind($file);
	fwrite($file, $file_data);
	fclose($file);
}
//return password to db
function password_ency($password)
{
	$ency = $GLOBALS['passwordency'];
	if($ency == 'sha1')
		return sha1($password);
	elseif($ency == 'md5')
		return md5($password);
	elseif($ency == '')
		return $password;
}
//delete player with name
function delete_player($name) {
	$SQL = $GLOBALS['SQL'];
	$player = new OTS_Player();
	$player->find($name);
	if($player->isLoaded()) {
		try { $SQL->query("DELETE FROM player_skills WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM guild_invites WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_items WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_depotitems WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_spells WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_storage WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_viplist WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_deaths WHERE player_id = '".$player->getId()."';"); } catch(PDOException $error) {}
		try { $SQL->query("DELETE FROM player_deaths WHERE killed_by = '".$player->getId()."';"); } catch(PDOException $error) {}
		$rank = $player->getRank();
		if(!empty($rank)) {
			$guild = $rank->getGuild();
			if($guild->getOwner()->getId() == $player->getId()) {
				$rank_list = $guild->getGuildRanksList();
				if(count($rank_list) > 0) {
					$rank_list->orderBy('level');
					foreach($rank_list as $rank_in_guild) {
						$players_with_rank = $rank_in_guild->getPlayersList();
						$players_with_rank->orderBy('name');
						$players_with_rank_number = count($players_with_rank);
						if($players_with_rank_number > 0) {
							foreach($players_with_rank as $player_in_guild) {
								$player_in_guild->setRank();
								$player_in_guild->save();
							}
						}
						$rank_in_guild->delete();
					}
					$guild->delete();
				}
			}
		}
		$player->delete();
		return TRUE;
	}
}

//delete guild with id
function delete_guild($id) {
	$guild = new OTS_Guild();
	$guild->load($id);
	if($guild->isLoaded()) {
		$rank_list = $guild->getGuildRanksList();
		if(count($rank_list) > 0) {
			$rank_list->orderBy('level');
			foreach($rank_list as $rank_in_guild) {
				$players_with_rank = $rank_in_guild->getPlayersList();
				if(count($players_with_rank) > 0) {
					foreach($players_with_rank as $player_in_guild) {
						$player_in_guild->setRank();
						$player_in_guild->save();
					}
				}
				$rank_in_guild->delete();
			}
		}
		$guild->delete();
		return TRUE;
	}
	else
		return FALSE;
}

//is it valid nick?
function check_name($name)//sprawdza name
{
  $temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- [ ] '");
  if ($temp != strlen($name)) {
	return false;
  }
  else
  {
	$ok = "/[a-zA-Z ']{1,25}/";
	return (preg_match($ok, $name))? true: false;
  }
}

//is it valid nick?
function check_account_name($name)//sprawdza name
{
  $temp = strspn("$name", "QWERTYUIOPASDFGHJKLZXCVBNM0123456789");
  if ($temp != strlen($name))
	return false;
  if(strlen($name) > 32)
	return false;
  else
  {
	$ok = "/[A-Z0-9]/";
	return (preg_match($ok, $name))? true: false;
  }
}

//is it valid nick for new char?
function check_name_new_char($name)//sprawdza name
{
	$name_to_check = strtolower($name);
	//first word can't be:
	//names blocked:
	$names_blocked = array('gm','cm', 'god', 'tutor');
	$first_words_blocked = array('gm ','cm ', 'god ','tutor ', "'", '-');
	//name can't contain:
	$words_blocked = array('gamemaster', 'game master', 'game-master', "game'master", '--', "''","' ", " '", '- ', ' -', "-'", "'-", 'fuck', 'sux', 'suck', 'noob', 'tutor');
	foreach($first_words_blocked as $word)
		if($word == substr($name_to_check, 0, strlen($word)))
			return false;
	if(substr($name_to_check, -1) == "'" || substr($name_to_check, -1) == "-")
		return false;
	if(substr($name_to_check, 1, 1) == ' ')
		return false;
	if(substr($name_to_check, -2, 1) == " ")
		return false;
	foreach($names_blocked as $word)
		if($word == $name_to_check)
			return false;
	foreach($GLOBALS['config']['site']['monsters'] as $word)
		if($word == $name_to_check)
			return false;
	foreach($GLOBALS['config']['site']['npc'] as $word)
		if($word == $name_to_check)
			return false;
	for($i = 0; $i < strlen($name_to_check); $i++)
		if($name_to_check[$i-1] == ' ' && $name_to_check[$i+1] == ' ')
			return false;
	foreach($words_blocked as $word)
		if (!(strpos($name_to_check, $word) === false))
			return false;
	for($i = 0; $i < strlen($name_to_check); $i++)
		if($name_to_check[$i] == $name_to_check[($i+1)] && $name_to_check[$i] == $name_to_check[($i+2)])
			return false;
	for($i = 0; $i < strlen($name_to_check); $i++)
		if($name_to_check[$i-1] == ' ' && $name_to_check[$i+1] == ' ')
			return false;
	$temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '");
	if ($temp != strlen($name))
		return false;
	else
	{
		$ok = "/[a-zA-Z ']{1,25}/";
		return (preg_match($ok, $name))? true: false;
	}
}

//is rank name valid?
function check_rank_name($name)//sprawdza name
{
  $temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789-[ ] ");
  if ($temp != strlen($name)) {
	return false;
  }
  else
  {
	$ok = "/[a-zA-Z ]{1,60}/";
	return (preg_match($ok, $name))? true: false;
  }
}
//is guild name valid?
function check_guild_name($name)
{
  $temp = strspn("$name", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789- ");
  if ($temp != strlen($name)) {
	return false;
  }
  else
  {
	$ok = "/[a-zA-Z ]{1,60}/";
	return (preg_match($ok, $name))? true: false;
  }
}
//is it valid password?
function check_password($pass)//sprawdza haslo
{
  $temp = strspn("$pass", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890");
  if ($temp != strlen($pass)) {
  return false;
  }
  else
  {
  $ok = "/[a-zA-Z0-9]{1,40}/";
  return (preg_match($ok, $pass))? true: false;
  }
}
//is it valid e-mail?
function check_mail($email)//sprawdza mail
{
  $ok = "/[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}/";
  return (preg_match($ok, $email))? true: false;
}

//################### DISPLAY FUNCTIONS #####################
//return shorter text (news ticker)
function short_text($text, $chars_limit) 
{
  if (strlen($text) > $chars_limit) 
    return substr($text, 0, strrpos(substr($text, 0, $chars_limit), " ")).'...';
  else return $text;
}
//return text to news msg
function news_place() {
if($GLOBALS['subtopic'] == "latestnews") {
//add tickers to site - without it tickers will not be showed
//$news .= $GLOBALS['news_content'];
/*
//featured article
$layout_name = $GLOBALS['layout_name'];
$news .= '  <div id="featuredarticle" class="Box">
    <div class="Corner-tl" style="background-image:url('.$layout_name.'/images/content/corner-tl.gif);"></div>
    <div class="Corner-tr" style="background-image:url('.$layout_name.'/images/content/corner-tr.gif);"></div>
    <div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
    <div class="BorderTitleText" style="background-image:url('.$layout_name.'/images/content/title-background-green.gif);"></div>
    <img class="Title" src="'.$layout_name.'/images/strings/headline-featuredarticle.gif" alt="Contentbox headline" />
    <div class="Border_2">
      <div class="Border_3">
        <div class="BoxContent" style="background-image:url('.$layout_name.'/images/content/scroll.gif);">
<div id=\'TeaserThumbnail\'><img src="'.$layout_name.'/images/news/features.jpg" width=150 height=100 border=0 alt="" /></div><div id=\'TeaserText\'><div style="position: relative; top: -2px; margin-bottom: 2px;" >
<b>Tutaj wpisz tytul</b></div>
tutaj wpisz tresc newsa<br>
zdjecie laduje sie w <i>tibiacom/images/news/features.jpg</i><br>
skad sie laduje mozesz zmienic linijke ponad komentarzem
</div>        </div>
      </div>
    </div>
    <div class="Border_1" style="background-image:url('.$layout_name.'/images/content/border-1.gif);"></div>
    <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image:url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
    <div class="CornerWrapper-b"><div class="Corner-br" style="background-image:url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  </div>';
 */
}
return $news;
}
//set monster of week
function logo_monster() {
	return str_replace(" ", "", trim(mb_strtolower($GLOBALS['layout_ini']['logo_monster'])));
}
$statustimeout = 1;
foreach(explode("*", str_replace(" ", "", $config['server']['statusTimeout'])) as $status_var)
	if($status_var > 0)
		$statustimeout = $statustimeout * $status_var;
$statustimeout = $statustimeout / 1000;
$config['status'] = parse_ini_file('config/serverstatus');
if($config['status']['serverStatus_lastCheck']+$statustimeout < time())
{
	$config['status']['serverStatus_checkInterval'] = $statustimeout+3;
	$config['status']['serverStatus_lastCheck'] = time();
	$info = chr(6).chr(0).chr(255).chr(255).'info';
	$sock = @fsockopen("127.0.0.1", $config['server']['statusPort'], $errno, $errstr, 1);
	if ($sock)
	{
		fwrite($sock, $info); 
		$data=''; 
		while (!feof($sock))
			$data .= fgets($sock, 1024);
		fclose($sock);
		preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
		$config['status']['serverStatus_online'] = 1;
		$config['status']['serverStatus_players'] = $matches[1];
		$config['status']['serverStatus_playersMax'] = $matches[2];
		preg_match('/uptime="(\d+)"/', $data, $matches);
		$h = floor($matches[1] / 3600);
		$m = floor(($matches[1] - $h*3600) / 60);
		$config['status']['serverStatus_uptime'] = $h.'h '.$m.'m';
		preg_match('/monsters total="(\d+)"/', $data, $matches);
		$config['status']['serverStatus_monsters'] = $matches[1];
	}
	else
	{
		$config['status']['serverStatus_online'] = 0;
		$config['status']['serverStatus_players'] = 0;
		$config['status']['serverStatus_playersMax'] = 0;
	}
	$file = fopen("config/serverstatus", "w");
	foreach($config['status'] as $param => $data)
	{
$file_data .= $param.' = "'.str_replace('"', '', $data).'"
';
	}
	rewind($file);
	fwrite($file, $file_data);
	fclose($file);
}

//PAGE VIEWS COUNTER :)
$views_counter = "usercounter.dat";
// checking if the file exists
if (file_exists($views_counter)) {
    // het bestand bestaat, waarde + 1
    $actie = fopen($views_counter, "r+"); 
    $page_views = fgets($actie, 9); 
    $page_views++; 
    rewind($actie); 
    fputs($actie, $page_views, 9); 
    fclose($actie); 
}
else
{ 
    // the file doesn't exist, creating a new one with value 1
    $actie = fopen($views_counter, "w"); 
    $page_views = 1; 
    fputs($actie, $page_views, 9); 
    fclose($actie); 
} 
function makeOrder($arr, $order, $default) {
    // Function by Colandus!
    $type = 'asc';
    if(isset($_GET['order'])) {
        $v = explode('_', strrev($_GET['order']), 2);
        if(count($v) == 2)
            if($orderBy = $arr[strrev($v[1])])
                $default = $orderBy;
                $type = (strrev($v[0]) == 'asc' ? 'desc' : 'asc');
    }
    
    return 'ORDER BY ' . $default . ' ' . $type;
}

function getOrder($arr, $order, $this) {
    // Function by Colandus!
    $type = 'asc';
    if($orderBy = $arr[$this])
        if(isset($_GET[$order])) {
            $v = explode('_', strrev($_GET[$order]), 2);
            if(strrev($v[1]) == $this)
                $type = (strrev($v[0]) == 'asc' ? 'desc' : 'asc');
        }
    
    return $this . '_' . $type;
}  

//THE Players'REP++ System by Cybermaster
//Function by MakroMango 
function reputation($rep)
    {
        $images = array('<img src="rep/rep-.png" />', '<img src="rep/rep0.gif"/>', '<img src="rep/rep+.gif" />');
        $ranks = array(
            'Power Abuser' => array(null, -10000, $images[0].$images[0].$images[0].$images[0].$images[0].$images[0].$images[0]),
            'Evil' => array(-10000, -5000, $images[0].$images[0].$images[0].$images[0].$images[0].$images[0]),
            'Gangster' => array(-5000, -3000, $images[0].$images[0].$images[0].$images[0].$images[0]),
            'Villian' => array(-3000, -1000, $images[0].$images[0].$images[0].$images[0]),
            'PK' => array(-1000, -500, $images[0].$images[0].$images[0]),
            'Bad Guy' => array(-500, -200, $images[0].$images[0]),
            'Noob' => array(-200, 200, $images[1]),
            'Well-Known' => array(200, 500, $images[2].$images[2]),
            'Popular' => array(500, 1000, $images[2].$images[2].$images[2]),
            'Hailed' => array(1000, 3000, $images[2].$images[2].$images[2].$images[2]),
            'The Best' => array(3000, 5000, $images[2].$images[2].$images[2].$images[2].$images[2]),
            'Hero' => array(5000, 10000, $images[2].$images[2].$images[2].$images[2].$images[2].$images[2]),
            'Legendary Hero' => array(10000, null, $images[2].$images[2].$images[2].$images[2].$images[2].$images[2].$images[2])
        );

        foreach($ranks as $rank => $values)
        {
            if($values[0] == null)
            {
                if($rep <= $values[1])
                {
                    return array($rank, $values[2]);
                }
            }
            elseif($values[1] == null)
            {
                if($rep >= $values[0])
                {
                    return array($rank, $values[2]);
                }
            }
            else
            {
                if($rep >= $values[0] and $rep <= $values[1])
                {
                    return array($rank, $values[2]);
                }
            }
        }
    } 
?>

index.php

PHP:
<?PHP
//start :)
//phpinfo();
//exit;
session_start();
ob_start("ob_gzhandler");
//require('./exaBD.php');
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
//##### CONFIG #####
include('config-and-functions.php');
$action = $_REQUEST['action'];
//##### LOGOUT #####
if($action == "logout") {
unset($_SESSION['account']);
unset($_SESSION['password']);
}
//##### LOGIN #####
//check is player logged
$logged = FALSE;
if(isset($_SESSION['account'])) {
	$account_logged = $ots->createObject('Account');
	$account_logged->load($_SESSION['account']);
	if($account_logged->isLoaded() && $account_logged->getPassword() == $_SESSION['password']) {
		$logged = TRUE;
		$group_id_of_acc_logged = $account_logged->getPageAccess();
	}
	else
	{
		$logged = FALSE;
		unset($_SESSION['account']);
		unset($account_logged);
	}
}
//login with data from form
$login_account = strtoupper(trim($_POST['account_login']));
$login_password = trim($_POST['password_login']);
if(!$logged && !empty($login_account) && !empty($login_password))
{
	$login_password = password_ency($login_password);
	$account_logged = $ots->createObject('Account');
	$account_logged->find($login_account);
	if($account_logged->isLoaded())
	{
		if($login_password == $account_logged->getPassword())
		{
			$_SESSION['account'] = $account_logged->getId();
			$_SESSION['password'] = $login_password;
			$logged = TRUE;
			$account_logged->setCustomField("page_lastday", time());
			$group_id_of_acc_logged = $account_logged->getPageAccess();
		} else
			$logged = FALSE;
	}
}
//#### LOAD PAGE ##########
//load subtopic page
if(empty($_REQUEST['subtopic'])) {
	$_REQUEST['subtopic'] = "latestnews";
	$subtopic = "latestnews";
}
switch($_REQUEST['subtopic']) {
	case "paypal";
		$subtopic = "paypal";
		$topic = "Paypal";
		include("paypal.php");
	break;

 	case "bugtracker";
  	        $topic = "Bug Tracker";
 	        $subtopic = "bugtracker";
 	        include("bug.php");
	break;  

  	case "polls";
		$topic = "Polls";
		$subtopic = "polls";
		include("polls.php");
	break; 	

	case "changelog";
   		 $topic = "Changelog";
  		 $subtopic = "changelog";
  		 include("changelog.php");
	break;  

  	case "bans":
 	         $topic = "Banishments";
    	         $subtopic = "bans";
    		 include("bans.php");
 	break;  

  	case "signature":
 	         $topic = "Signature";
    	         $subtopic = "signature";
    		 include("signature.php");
 	break; 

  	case "signatures":
 	         $topic = "Signature Generator";
    	         $subtopic = "signatures";
    		 include("signatures.php");
 	break; 

  	case "shopadmin":
 	        $topic = "Shopadmin";
    	        $subtopic = "shopadmin";
    		include("shopadmin.php");
 	break; 

	case "latestnews":
		$topic = "Latest News";
		$subtopic = "latestnews";
		include("latestnews.php");
	break;
	
	case "creatures";
		$topic = "Creatures";
		$subtopic = "creatures";
		include("creatures.php");
	break;

	case "spells";
		$topic = "Spells";
		$subtopic = "spells";
		include("spells.php");
	break;
	
	case "maps";
		$topic = "Map";
		$subtopic = "maps";
		include("maps.php");
	break;
	
	case "experiencetable";
		$topic = "Experience Table";
		$subtopic = "experiencetable";
		include("experiencetable.php");
	break;
	
	case "characters";
		$topic = "Characters";
		$subtopic = "characters";
		include("characters.php");
	break;
	
    	case "rep";
          	$topic = "Reputation Highscores";
          	$subtopic = "rep";
          	include("rep.php");
    	break;  
	
	case "whoisonline";
		$topic = "Who is online?";
		$subtopic = "whoisonline";
		include("whoisonline.php");
	break;

	case "highscores";
		$topic = "Highscores";
		$subtopic = "highscores";
		include("highscores.php");
	break;
	
	case "killstatistics";
		$topic = "Last Kills";
		$subtopic = "killstatistics";
		include("killstatistics.php");
	break;
	
	case "houses";
		$topic = "Houses";
		$subtopic = "houses";
		include("houses.php");
	break;
	
	case "guilds";
		$topic = "Guilds";
		$subtopic = "guilds";
		include("guilds.php");
	break;
	
	case "accountmanagement";
		$topic = "Account Management";
		$subtopic = "accountmanagement";
		include("accountmanagement.php");
	break;
	
	case "createaccount";
		$topic = "Create Account";
		$subtopic = "createaccount";
		include("createaccount.php");
	break;
	
	case "lostaccount";
		$topic = "Lost Account Interface";
		$subtopic = "lostaccount";
		include("lostaccount.php");
	break;

	case "tibiarules";
		$topic = "Server Rules";
		$subtopic = "tibiarules";
		include("tibiarules.php");
	break;

	case "adminpanel":
		$topic = "Admin Panel";
		$subtopic = "adminpanel";
		include("adminpanel.php");
	break;
	
	case "forum":
		$topic = "Forum";
		$subtopic = "forum";
		include("forum.php");
	break;
	
	case "team";
		$subtopic = "team";
		$topic = "Gamemasters List";
		include("team.php");
	break;

	case "downloads";
		$subtopic = "downloads";
		$topic = "Downloads";
		include("downloads.php");
	break;

	case "serverinfo";
		$subtopic = "serverinfo";
		$topic = "Server Info";
		include("serverinfo.php");
	break;

	case "shopsystem";
		$subtopic = "shopsystem";
		$topic = "Shop System";
		include("shopsystem.php");
	break;
	
	case "wars";
		$subtopic = "wars";
		$topic = "Wars";
		include("wars.php");
	break;	
	
	case "buypoints";
		$subtopic = "buypoints";
		$topic = "Buy Points";
		include("buypoints.php");
	break;

	case "screenshots";
		$subtopic = "screenshots";
		$topic = "Screenshots";
		include("gallery.php");
	break;
	
	case "namelock";
		$subtopic = "namelock";
		$topic = "Namelock Manager";
		include("namelocks.php");
	break;
	
	case "archive";
		$subtopic = "archive";
		$topic = "News Archives";
		include("archive.php");
	break;

}
//generate title of page
if(empty($topic)) {
$title = $GLOBALS['config']['server']["serverName"]." - OTS";
$main_content .= 'Invalid subtopic. Can\'t load page.';
}
else
{
$title = $GLOBALS['config']['server']["serverName"]." - ".$topic;
}
//#####LAYOUT#####

$layout_header = '<script type=\'text/javascript\'>
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function MouseOverBigButton(source)
{
  source.firstChild.style.visibility = "visible";
}
function MouseOutBigButton(source)
{
  source.firstChild.style.visibility = "hidden";
}
function BigButtonAction(path)
{
  window.location = path;
}
var';
if($logged) { $layout_header .= "loginStatus=1; loginStatus='true';"; } else { $layout_header .= "loginStatus=0; loginStatus='false';"; };
$layout_header .= "var activeSubmenuItem='".$subtopic."';  var IMAGES=0; IMAGES='".$config['server']['url']."/".$layout_name."/images'; var LINK_ACCOUNT=0; LINK_ACCOUNT='http://".$_SERVER['SERVER_NAME'].$config['site']['subfolder']."';</script>";
include($layout_name."/layout.php");
ob_end_flush();
?>
 
@up I just tested all ur scripts in my gesior, and all them work fine even for the rep,
but I ask you if you unzipped the files in htdocs correctly
otherwise I'll check if I missed posting a file
tell me which distro, gesior and sql database type do you use
 
sure, first thing i did was to unrar the files in my htdocs - /var/www (linux dristro) directory :S
 
sure, first thing i did was to unrar the files in my htdocs - /var/www (linux dristro) directory :S
u got msn/gmail/yahoo? pm it to me
 
Status
Not open for further replies.
Back
Top