[Help] Ranking Script Help

DemonuMu

Well-Known Member
Joined
May 26, 2011
Messages
1,167
Reaction score
235
I have a problem with my ranking script. would you be able to help me?

I test for season 1/2/3/4/5/ but is now show me the character you create but for 97d+99i is work 100% with no problems

Character Table
PHP:
CREATE TABLE [dbo].[Character](
	[AccountID] [varchar](10) NOT NULL,
	[Name] [varchar](10) NOT NULL,
	[cLevel] [int] NULL,
	[LevelUpPoint] [int] NULL,
	[Class] [tinyint] NULL,
	[Experience] [int] NULL,
	[Strength] [int] NULL,
	[Dexterity] [int] NULL,
	[Vitality] [int] NULL,
	[Energy] [int] NULL,
	[Leadership] [int] NULL,
	[Inventory] [varbinary](1728) NULL,
	[MagicList] [varbinary](180) NULL,
	[Money] [int] NULL,
	[Life] [real] NULL,
	[MaxLife] [real] NULL,
	[Mana] [real] NULL,
	[MaxMana] [real] NULL,
	[BP] [real] NULL,
	[MaxBP] [real] NULL,
	[Shield] [real] NULL,
	[MaxShield] [real] NULL,
	[MapNumber] [smallint] NULL,
	[MapPosX] [smallint] NULL,
	[MapPosY] [smallint] NULL,
	[MapDir] [tinyint] NULL,
	[PkCount] [int] NULL,
	[PkLevel] [int] NULL,
	[PkTime] [int] NULL,
	[MDate] [smalldatetime] NULL,
	[LDate] [smalldatetime] NULL,
	[CtlCode] [tinyint] NULL,
	[DbVersion] [tinyint] NULL,
	[Quest] [varbinary](50) NULL,
	[ChatLimitTime] [smallint] NULL,
	[FruitPoint] [int] NULL,
	[EffectList] [varbinary](208) NULL,
	[FruitAddPoint] [int] NOT NULL,
	[FruitSubPoint] [int] NOT NULL,
	[ResetCount] [int] NOT NULL,
	[MasterResetCount] [int] NOT NULL,
	[resetsWeek] [int] NOT NULL,
	[resetsMonth] [int] NOT NULL,
	[PkCountWeb] [int] NOT NULL,
	[Resets] [int] NOT NULL,
	[MResets] [int] NOT NULL,
	[image] [varchar](50) NULL,
	[MasterResetDay] [int] NOT NULL,
	[MasterResetWek] [int] NOT NULL,
	[MasterResetMon] [int] NOT NULL,
	[PkCountWebHero] [int] NOT NULL,
	[HeroDay] [int] NOT NULL,
	[HeroWeek] [int] NOT NULL,
	[HeroMonth] [int] NOT NULL,
	[PKDay] [int] NOT NULL,
	[PKWeek] [int] NOT NULL,
	[PKMonth] [int] NOT NULL,
	[ResetDay] [int] NOT NULL,
	[ResetWek] [int] NOT NULL,
	[ResetMon] [int] NOT NULL,
	[OnlineHourDay] [int] NOT NULL,
	[OnlineHourWek] [int] NOT NULL,
	[OnlineHourMon] [int] NOT NULL,
	[OnlineHour] [int] NOT NULL,


PHP Script / Ranking
PHP:
<?php
$page2 = clean_var($_GET['page']);
$mode = clean_var($_GET['mode']); 
$class = clean_var($_GET['class']); 

//Decode Class Mode
if($class == '') { $classmode = ""; }
elseif($class == 0) { $classmode = "WHERE Class='0'"; }
elseif($class == 1) { $classmode = "WHERE Class='1'"; }
elseif($class == 16) { $classmode = "WHERE Class='16'"; }
elseif($class == 17) { $classmode = "WHERE Class='17'"; }
elseif($class == 32) { $classmode = "WHERE Class='32'"; }
elseif($class == 33) { $classmode = "WHERE Class='33'"; }
elseif($class == 48) { $classmode = "WHERE Class='48'"; }

if ($mode == '') 
{ 

$search = "SELECT * FROM Character $classmode where ctlcode ='0' order by GrandResets desc,Resets desc,cLevel desc"; 


}


if ($mode == 5) { 
if($classmode !='') { $classmode = str_replace('WHERE','AND',$classmode); }
$search = "SELECT Character.TOP $limit,MEMB_STAT.ServerName FROM AccountCharacter,MEMB_STAT,Character WHERE MEMB_STAT.ConnectStat=1 AND AccountCharacter.Id=MEMB_STAT.memb___id AND Character.AccountID=MEMB_STAT.memb___id AND AccountCharacter.GameIDC=Character.Name $classmode ORDER by GrandResets desc,Resets desc,cLevel desc ";}



$msquery = "$search";
$msresults= mssql_query($msquery);

$lines = '100';
if(!isset($_GET['pages']))
{
$limit='0';
}
else
{
$page = secure($_GET['pages']);
$pages = $page - 1;
$limit = $lines * $pages;
}


echo '

<table class=tmem border=0 cellspacing=1 height=10 width=500>  
<td> <b><center>#</center></b></font></td>
<td> <b><center>Name</center></b></font></td>
<td> <b><center>LVL</center></b></font></td>
<td> <b><center>RR</center></b></font></td>
<td> <b><center>GR</center></b></font></td>
<td> <b><center>Class</center></b></font></td>
<td> <b><center>Rank</center></b></font></td>
<td> <b><center>Guild</center></b></font></td>
<td> <b><center>Status</center></b></font></td>


';


if($page == '') { $page = 1; }
$RowPerPage = 100;
$startRows = ($page-1)*$RowPerPage + 0;
$msquery = "$search";
$msresults= mssql_query($msquery);
$num_of_rows = mssql_num_rows ($msresults);
@mssql_data_seek($msresults, $startRows);
$total_pages = ceil($num_of_rows / $RowPerPage);

;
for($i=0; $i<$RowPerPage; $i++) {
$row = mssql_fetch_array($msresults);
$connect = mssql_query("SELECT * FROM MEMB_STAT WHERE memb___id='$row[AccountID]'");
$conn =  mssql_fetch_array($connect);
$querys = mssql_query("SELECT * FROM AccountCharacter WHERE id='$row[AccountID]'");
$rows =  mssql_fetch_array($querys);
$guild_mem = mssql_query("SELECT * FROM GuildMember WHERE name='$row[Name]'");
$guild =  mssql_fetch_array($guild_mem);
$guild_info = mssql_query("SELECT * FROM Guild WHERE g_name='$guild[G_Name]'");
$guilds = mssql_fetch_array($guild_info);-
$memb = mssql_query("SELECT COUNT(*) FROM GuildMember WHERE G_Name='$guild[G_Name]'");
$totalmemb = mssql_result($memb, 0, 0);
$rank = $i+1+$limit;
;

if($conn['ConnectStat'] == 1 AND $rows['GameIDC'] == $row['Name']) { $status ='<img src="http://demonumu.sytes.net/images/on.gif">'; }
else { $status='<img src="http://demonumu.sytes.net/images/off.gif">'; }
//Class


if ($row[IsVip] == 0) { $acceslevel = "Normal"; }
if ($row[IsVip] == 1) { $acceslevel = "<font color='green'>VIP</font>"; }


if ($row['Class'] == 0) { $classes = "Dark Wizzard"; }
if ($row['Class'] == 1) { $classes = "Soul Master"; }
if($row['Class'] == 3) { $classes = "Grand Master"; }
if($row['Class'] == 16) { $classes = "Dark Knight"; }
if($row['Class'] == 17) { $classes = "Blade Knight"; }
if($row['Class'] == 19) { $classes = "Blade Master"; }
if($row['Class'] == 32) { $classes = "Elf"; }
if($row['Class'] == 33) { $classes = "Muse Elf"; }
if($row['Class'] == 34) { $classes = "High Elf"; }
if($row['Class'] == 48) { $classes = "Magic Gladiator"; }
if($row['Class'] == 50) { $classes = "Duel Master"; }
if($row['Class'] == 64) { $classes = "Dark Lord"; }
if($row['Class'] == 66) { $classes = "Lord Emporer"; }
if($row['Class'] == 80) { $classes = "Summoner"; }
if($row['Class'] == 81) { $classes = "Bloody Summoner"; }
if($row['Class'] == 82) { $classes = "Dimension Master"; }

if ($rank == 1) { 
$row['Name'] = "<font color=red>$row[Name]</font>";
$rank = "<font color=red>$rank</font>";
$row['cLevel'] = "<font color=red>$row[cLevel]</font>";
$row['Resets'] = "<font color=red>$row[Resets]</font>";
$row['GrandResets'] = "<font color=red>$row[GrandResets]</font>";
$classes = "<font color=red>$classes</font>";
$guilds['G_Name'] = "<font color=red>$guilds[G_Name]</font>";
$acceslevel = "<font color=red>$acceslevel</font>";
}

if ($rank == 2) { 
$row['Name'] = "<font color=blue>$row[Name]</font>";
$rank = "<font color=blue>$rank</font>";
$row['cLevel'] = "<font color=blue>$row[cLevel]</font>";
$row['Resets'] = "<font color=blue>$row[Resets]</font>";
$row['GrandResets'] = "<font color=blue>$row[GrandResets]</font>";
$classes = "<font color=blue>$classes</font>";
$guilds['G_Name'] = "<font color=blue>$guilds[G_Name]</font>";
$acceslevel = "<font color=blue>$acceslevel</font>";
}

if ($rank == 3) { 
$row['Name'] = "<font color=green>$row[Name]</font>";
$rank = "<font color=green>$rank</font>";
$row['cLevel'] = "<font color=green>$row[cLevel]</font>";
$row['Resets'] = "<font color=green>$row[Resets]</font>";
$row['GrandResets'] = "<font color=green>$row[GrandResets]</font>";
$classes = "<font color=green>$classes</font>";
$guilds['G_Name'] = "<font color=green>$guilds[G_Name]</font>";
$acceslevel = "<font color=green>$acceslevel</font>";
}

if($guilds['G_Name']==NULL) { $guilds['G_Name'] = '<font color="silver">-</font>'; $link =""; } else { $link ="<a href='?op=guild&guild=".htmlspecialchars($guilds['G_Name'])."'>"; }
if(!$row){ break; }

echo "<tr cellpadding='2' cellspacing='1' >
            <td align=center><b><center>$rank</center></b></font></td>
            <td align=center><b><center>$row[Name]</a></center></b></font></td>
            <td align=center><b><center>$row[cLevel]</center></b></td>
            <td align=center><b><center>$row[Resets]</center></b></td>
            <td align=center><b><center>$row[GrandResets]</center></b></td>
            <td align=center><b><center>$classes</center></b></td>
            <td align=center><b><center>$acceslevel</center></b></td>
            <td align=center><b><center>$guilds[G_Name]</center></b></td>
            <td align=center><b><center>$status</center></b></td>
</tr>

";
}
?>
</table>



<?php
if(!isset($_GET['pages'])) { $page = '1'; }

$result1 = 1+$limit;
$result2 = $result1+$lines-1;

$count = mssql_query("Select count(*) From Character");
$resultyeah = mssql_result($count, 0, 0);

$next = $page + 1;
$prev = $page - 1;

if($resultyeah > $result2) { $nextpage = " <a href='index.php?page=ranking&pages=$next' title='Next Page'>-> </a> "; }
if($page >= "2") { $prevpage = "<a href=index.php?page=ranking&pages=$prev title='Previous Page'><- </a> "; }

echo"
<table class=tmem border=0 cellspacing=0 height=10 width=500>  
<tr>
<td> <b>
$prevpage [$page  || <b>$result1-$result2</b>] <span class='text-information'>$nextpage</span>
</td>
</tr>
</table></br>
";
?>

Thanks for help.
 
Last edited:
In character table you didn't have GrandResets column
 
I did some changes blind without testing and the worst things I saw are probably fixed but I doubt that this script will work anyway. The pagination most likely not. You had 2 different pagination definitions, crazy stuff. This script is kind of mixing and never worked for sure.

Better forget about it and use another.

PHP:
<?php
$page  = (int)($_GET['page']);
$mode  = (int)($_GET['mode']); 
$class = (int)($_GET['class']); 

$RowPerPage  = 100;

switch($class){
	case 0  : $classmode = "where Class='".$class."'";
	case 1  : $classmode = "where Class='".$class."'";
	case 16 : $classmode = "where Class='".$class."'";
	case 17 : $classmode = "where Class='".$class."'";
	case 32 : $classmode = "where Class='".$class."'";
	case 33 : $classmode = "where Class='".$class."'";
	case 48 : $classmode = "where Class='".$class."'";
	default : $classmode = "";
}

if ($mode == 5) { 
$search = "SELECT Character.TOP $RowPerPage,MEMB_STAT.ServerName FROM AccountCharacter,MEMB_STAT,Character WHERE MEMB_STAT.ConnectStat=1 AND AccountCharacter.Id=MEMB_STAT.memb___id AND Character.AccountID=MEMB_STAT.memb___id AND AccountCharacter.GameIDC=Character.Name $classmode ORDER by Resets desc,cLevel desc ";
}
else{
	$search = "Select * from Characters order by Resets desc, Clevel desc";
}

$msresults= mssql_query($search);
if($page == '' || $page == 0) { $page = 1; }
$num_of_rows = mssql_num_rows ($msresults);
$total_pages = ceil($num_of_rows / $RowPerPage);



echo '

<table class=tmem border=0 cellspacing=1 height=10 width=500>  
<td> <b><center>#</center></b></font></td>
<td> <b><center>Name</center></b></font></td>
<td> <b><center>LVL</center></b></font></td>
<td> <b><center>RR</center></b></font></td>
<td> <b><center>GR</center></b></font></td>
<td> <b><center>Class</center></b></font></td>
<td> <b><center>Rank</center></b></font></td>
<td> <b><center>Guild</center></b></font></td>
<td> <b><center>Status</center></b></font></td>


';



;
for($i=0; $i<$num_of_rows; $i++) {
$row = mssql_fetch_array($msresults);
$connect = mssql_query("SELECT * FROM MEMB_STAT WHERE memb___id='$row[AccountID]'");
$conn =  mssql_fetch_array($connect);
$querys = mssql_query("SELECT * FROM AccountCharacter WHERE id='$row[AccountID]'");
$rows =  mssql_fetch_array($querys);
$guild_mem = mssql_query("SELECT * FROM GuildMember WHERE name='$row[Name]'");
$guild =  mssql_fetch_array($guild_mem);
$guild_info = mssql_query("SELECT * FROM Guild WHERE g_name='$guild[G_Name]'");
$guilds = mssql_fetch_array($guild_info);-
$memb = mssql_query("SELECT COUNT(*) FROM GuildMember WHERE G_Name='$guild[G_Name]'");
$totalmemb = mssql_result($memb, 0, 0);
$rank = $i+$RowPerPage;
;

if($conn['ConnectStat'] == 1 AND $rows['GameIDC'] == $row['Name']) { $status ='<img src="http://demonumu.sytes.net/images/on.gif">'; }
else { $status='<img src="http://demonumu.sytes.net/images/off.gif">'; }
//Class


if ($row[IsVip] == 0) { $acceslevel = "Normal"; }
if ($row[IsVip] == 1) { $acceslevel = "<font color='green'>VIP</font>"; }


if ($row['Class'] == 0) { $classes = "Dark Wizzard"; }
if ($row['Class'] == 1) { $classes = "Soul Master"; }
if($row['Class'] == 3) { $classes = "Grand Master"; }
if($row['Class'] == 16) { $classes = "Dark Knight"; }
if($row['Class'] == 17) { $classes = "Blade Knight"; }
if($row['Class'] == 19) { $classes = "Blade Master"; }
if($row['Class'] == 32) { $classes = "Elf"; }
if($row['Class'] == 33) { $classes = "Muse Elf"; }
if($row['Class'] == 34) { $classes = "High Elf"; }
if($row['Class'] == 48) { $classes = "Magic Gladiator"; }
if($row['Class'] == 50) { $classes = "Duel Master"; }
if($row['Class'] == 64) { $classes = "Dark Lord"; }
if($row['Class'] == 66) { $classes = "Lord Emporer"; }
if($row['Class'] == 80) { $classes = "Summoner"; }
if($row['Class'] == 81) { $classes = "Bloody Summoner"; }
if($row['Class'] == 82) { $classes = "Dimension Master"; }

if ($rank == 1) { 
$row['Name'] = "<font color=red>$row[Name]</font>";
$rank = "<font color=red>$rank</font>";
$row['cLevel'] = "<font color=red>$row[cLevel]</font>";
$row['Resets'] = "<font color=red>$row[Resets]</font>";
$row['GrandResets'] = "<font color=red>$row[GrandResets]</font>";
$classes = "<font color=red>$classes</font>";
$guilds['G_Name'] = "<font color=red>$guilds[G_Name]</font>";
$acceslevel = "<font color=red>$acceslevel</font>";
}

if ($rank == 2) { 
$row['Name'] = "<font color=blue>$row[Name]</font>";
$rank = "<font color=blue>$rank</font>";
$row['cLevel'] = "<font color=blue>$row[cLevel]</font>";
$row['Resets'] = "<font color=blue>$row[Resets]</font>";
$row['GrandResets'] = "<font color=blue>$row[GrandResets]</font>";
$classes = "<font color=blue>$classes</font>";
$guilds['G_Name'] = "<font color=blue>$guilds[G_Name]</font>";
$acceslevel = "<font color=blue>$acceslevel</font>";
}

if ($rank == 3) { 
$row['Name'] = "<font color=green>$row[Name]</font>";
$rank = "<font color=green>$rank</font>";
$row['cLevel'] = "<font color=green>$row[cLevel]</font>";
$row['Resets'] = "<font color=green>$row[Resets]</font>";
$row['GrandResets'] = "<font color=green>$row[GrandResets]</font>";
$classes = "<font color=green>$classes</font>";
$guilds['G_Name'] = "<font color=green>$guilds[G_Name]</font>";
$acceslevel = "<font color=green>$acceslevel</font>";
}

if($guilds['G_Name']==NULL) { $guilds['G_Name'] = '<font color="silver">-</font>'; $link =""; } else { $link ="<a href='?op=guild&guild=".htmlspecialchars($guilds['G_Name'])."'>"; }
if(!$row){ break; }

echo "<tr cellpadding='2' cellspacing='1' >
            <td align=center><b><center>$rank</center></b></font></td>
            <td align=center><b><center>$row[Name]</a></center></b></font></td>
            <td align=center><b><center>$row[cLevel]</center></b></td>
            <td align=center><b><center>$row[Resets]</center></b></td>
            <td align=center><b><center>$row[GrandResets]</center></b></td>
            <td align=center><b><center>$classes</center></b></td>
            <td align=center><b><center>$acceslevel</center></b></td>
            <td align=center><b><center>$guilds[G_Name]</center></b></td>
            <td align=center><b><center>$status</center></b></td>
</tr>

";
}
echo '</table>';

$result1 = 1+$RowPerPage;
$result2 = $result1+$rank-1;

$count = mssql_query("Select count(*) From Character");
$resultyeah = mssql_result($count, 0, 0);

$next = $page + 1;
$prev = $page - 1;

if($num_of_rows > $result2) { $nextpage = " <a href='index.php?page=ranking&pages=$next' title='Next Page'>-> </a> "; }
if($page >= "2") { $prevpage = "<a href=index.php?page=ranking&pages=$prev title='Previous Page'><- </a> "; }

echo"
<table class=tmem border=0 cellspacing=0 height=10 width=500>  
<tr>
<td> <b>
$prevpage [$page  || <b>$result1-$result2</b>] <span class='text-information'>$nextpage</span>
</td>
</tr>
</table></br>
";
?>
 
I did some changes blind without testing and the worst things I saw are probably fixed but I doubt that this script will work anyway. The pagination most likely not. You had 2 different pagination definitions, crazy stuff. This script is kind of mixing and never worked for sure.

Better forget about it and use another.

PHP:
<?php
$page  = (int)($_GET['page']);
$mode  = (int)($_GET['mode']); 
$class = (int)($_GET['class']); 

$RowPerPage  = 100;

switch($class){
	case 0  : $classmode = "where Class='".$class."'";
	case 1  : $classmode = "where Class='".$class."'";
	case 16 : $classmode = "where Class='".$class."'";
	case 17 : $classmode = "where Class='".$class."'";
	case 32 : $classmode = "where Class='".$class."'";
	case 33 : $classmode = "where Class='".$class."'";
	case 48 : $classmode = "where Class='".$class."'";
	default : $classmode = "";
}

if ($mode == 5) { 
$search = "SELECT Character.TOP $RowPerPage,MEMB_STAT.ServerName FROM AccountCharacter,MEMB_STAT,Character WHERE MEMB_STAT.ConnectStat=1 AND AccountCharacter.Id=MEMB_STAT.memb___id AND Character.AccountID=MEMB_STAT.memb___id AND AccountCharacter.GameIDC=Character.Name $classmode ORDER by Resets desc,cLevel desc ";
}
else{
	$search = "Select * from Characters order by Resets desc, Clevel desc";
}

$msresults= mssql_query($search);
if($page == '' || $page == 0) { $page = 1; }
$num_of_rows = mssql_num_rows ($msresults);
$total_pages = ceil($num_of_rows / $RowPerPage);



echo '

<table class=tmem border=0 cellspacing=1 height=10 width=500>  
<td> <b><center>#</center></b></font></td>
<td> <b><center>Name</center></b></font></td>
<td> <b><center>LVL</center></b></font></td>
<td> <b><center>RR</center></b></font></td>
<td> <b><center>GR</center></b></font></td>
<td> <b><center>Class</center></b></font></td>
<td> <b><center>Rank</center></b></font></td>
<td> <b><center>Guild</center></b></font></td>
<td> <b><center>Status</center></b></font></td>


';



;
for($i=0; $i<$num_of_rows; $i++) {
$row = mssql_fetch_array($msresults);
$connect = mssql_query("SELECT * FROM MEMB_STAT WHERE memb___id='$row[AccountID]'");
$conn =  mssql_fetch_array($connect);
$querys = mssql_query("SELECT * FROM AccountCharacter WHERE id='$row[AccountID]'");
$rows =  mssql_fetch_array($querys);
$guild_mem = mssql_query("SELECT * FROM GuildMember WHERE name='$row[Name]'");
$guild =  mssql_fetch_array($guild_mem);
$guild_info = mssql_query("SELECT * FROM Guild WHERE g_name='$guild[G_Name]'");
$guilds = mssql_fetch_array($guild_info);-
$memb = mssql_query("SELECT COUNT(*) FROM GuildMember WHERE G_Name='$guild[G_Name]'");
$totalmemb = mssql_result($memb, 0, 0);
$rank = $i+$RowPerPage;
;

if($conn['ConnectStat'] == 1 AND $rows['GameIDC'] == $row['Name']) { $status ='<img src="http://demonumu.sytes.net/images/on.gif">'; }
else { $status='<img src="http://demonumu.sytes.net/images/off.gif">'; }
//Class


if ($row[IsVip] == 0) { $acceslevel = "Normal"; }
if ($row[IsVip] == 1) { $acceslevel = "<font color='green'>VIP</font>"; }


if ($row['Class'] == 0) { $classes = "Dark Wizzard"; }
if ($row['Class'] == 1) { $classes = "Soul Master"; }
if($row['Class'] == 3) { $classes = "Grand Master"; }
if($row['Class'] == 16) { $classes = "Dark Knight"; }
if($row['Class'] == 17) { $classes = "Blade Knight"; }
if($row['Class'] == 19) { $classes = "Blade Master"; }
if($row['Class'] == 32) { $classes = "Elf"; }
if($row['Class'] == 33) { $classes = "Muse Elf"; }
if($row['Class'] == 34) { $classes = "High Elf"; }
if($row['Class'] == 48) { $classes = "Magic Gladiator"; }
if($row['Class'] == 50) { $classes = "Duel Master"; }
if($row['Class'] == 64) { $classes = "Dark Lord"; }
if($row['Class'] == 66) { $classes = "Lord Emporer"; }
if($row['Class'] == 80) { $classes = "Summoner"; }
if($row['Class'] == 81) { $classes = "Bloody Summoner"; }
if($row['Class'] == 82) { $classes = "Dimension Master"; }

if ($rank == 1) { 
$row['Name'] = "<font color=red>$row[Name]</font>";
$rank = "<font color=red>$rank</font>";
$row['cLevel'] = "<font color=red>$row[cLevel]</font>";
$row['Resets'] = "<font color=red>$row[Resets]</font>";
$row['GrandResets'] = "<font color=red>$row[GrandResets]</font>";
$classes = "<font color=red>$classes</font>";
$guilds['G_Name'] = "<font color=red>$guilds[G_Name]</font>";
$acceslevel = "<font color=red>$acceslevel</font>";
}

if ($rank == 2) { 
$row['Name'] = "<font color=blue>$row[Name]</font>";
$rank = "<font color=blue>$rank</font>";
$row['cLevel'] = "<font color=blue>$row[cLevel]</font>";
$row['Resets'] = "<font color=blue>$row[Resets]</font>";
$row['GrandResets'] = "<font color=blue>$row[GrandResets]</font>";
$classes = "<font color=blue>$classes</font>";
$guilds['G_Name'] = "<font color=blue>$guilds[G_Name]</font>";
$acceslevel = "<font color=blue>$acceslevel</font>";
}

if ($rank == 3) { 
$row['Name'] = "<font color=green>$row[Name]</font>";
$rank = "<font color=green>$rank</font>";
$row['cLevel'] = "<font color=green>$row[cLevel]</font>";
$row['Resets'] = "<font color=green>$row[Resets]</font>";
$row['GrandResets'] = "<font color=green>$row[GrandResets]</font>";
$classes = "<font color=green>$classes</font>";
$guilds['G_Name'] = "<font color=green>$guilds[G_Name]</font>";
$acceslevel = "<font color=green>$acceslevel</font>";
}

if($guilds['G_Name']==NULL) { $guilds['G_Name'] = '<font color="silver">-</font>'; $link =""; } else { $link ="<a href='?op=guild&guild=".htmlspecialchars($guilds['G_Name'])."'>"; }
if(!$row){ break; }

echo "<tr cellpadding='2' cellspacing='1' >
            <td align=center><b><center>$rank</center></b></font></td>
            <td align=center><b><center>$row[Name]</a></center></b></font></td>
            <td align=center><b><center>$row[cLevel]</center></b></td>
            <td align=center><b><center>$row[Resets]</center></b></td>
            <td align=center><b><center>$row[GrandResets]</center></b></td>
            <td align=center><b><center>$classes</center></b></td>
            <td align=center><b><center>$acceslevel</center></b></td>
            <td align=center><b><center>$guilds[G_Name]</center></b></td>
            <td align=center><b><center>$status</center></b></td>
</tr>

";
}
echo '</table>';

$result1 = 1+$RowPerPage;
$result2 = $result1+$rank-1;

$count = mssql_query("Select count(*) From Character");
$resultyeah = mssql_result($count, 0, 0);

$next = $page + 1;
$prev = $page - 1;

if($num_of_rows > $result2) { $nextpage = " <a href='index.php?page=ranking&pages=$next' title='Next Page'>-> </a> "; }
if($page >= "2") { $prevpage = "<a href=index.php?page=ranking&pages=$prev title='Previous Page'><- </a> "; }

echo"
<table class=tmem border=0 cellspacing=0 height=10 width=500>  
<tr>
<td> <b>
$prevpage [$page  || <b>$result1-$result2</b>] <span class='text-information'>$nextpage</span>
</td>
</tr>
</table></br>
";
?>

this rankings work for season ?
 
One of the stupid places were here:
PHP:
for($i=0; $i<$RowPerPage; $i++)

So you expect a pagination/pages but you are doing cycle only up to the lines per every page, so only one page will be displayed as a result. Doesn't make any sense. It must be
PHP:
for($i=0; $i<All available rows depending on the main query; $i++)

And so on... many many issues. Just leave it, really.
 
One of the stupid places were here:
PHP:
for($i=0; $i<$RowPerPage; $i++)

So you expect a pagination/pages but you are doing cycle only up to the lines per every page, so only one page will be displayed as a result. Doesn't make any sense. It must be
PHP:
for($i=0; $i<All available rows depending on the main query; $i++)

And so on... many many issues. Just leave it, really.

anyone thanks for info can someone help me ?
 
Man the ranking doesn't depend on what Season you are runing it. This script doesn't work by default.

I understand you do not want to fix it maybe it's a lot of work I do not know but thank you anyway for info
 
Last edited:
yes bro i try but same problems no work to show the char

Here Domino ((xax)) try with this one

PHP:
<?php

$class = clean_var($_GET['class']);
$lines = '100'; //How many characters to show

function findClass($var) {
    switch ($var) {
        case 0:
            return "Dark Wizzard";
            break;
        case 1:
            return "Soul Master";
            break;
        case 3:
            return "Grand Master";
            break;
        case 16:
            return "Dark Knoght";
            break;
        case 17:
            return "Blade Knight";
            break;
        case 19:
            return "Blade Master";
            break;
        case 32:
            return "Elf";
            break;
        case 33:
            return "Muse Elf";
            break;
        case 34:
            return "High Elf";
            break;
        case 48:
            return "Magic Gladiator";
            break;
        case 50:
            return "Duel Master";
            break;
        case 64:
            return "Dark Lord";
            break;
        case 66:
            return "Lord Emperor";
            break;
        case 80:
            return "Summoner";
            break;
        case 81:
            return "Bloody Summoner";
            break;
        case 82:
            return "Dimension Master";
            break;
        default:
            return "Unknown " . $var;
            break;
    }
}

$classes = array(0, 1, 3, 16, 17, 19, 32, 33, 34, 48, 50, 64, 66, 80, 81, 82);
if (in_array($class, $classes)) {
    $showClass = "AND [Class]='" . $class . "'";
} else {
    $showClass = "";
}

echo "<table class=tmem border=0 cellspacing=1 height=10 width=500>
<td> <b><center>#</center></b></font></td>
<td> <b><center>Name</center></b></font></td>
<td> <b><center>LVL</center></b></font></td>
<td> <b><center>RR</center></b></font></td>
<td> <b><center>Class</center></b></font></td>
<td> <b><center>Rank</center></b></font></td>
<td> <b><center>Guild</center></b></font></td>
<td> <b><center>Status</center></b></font></td>";

$query = mssql_query("SELECT TOP " . $lines . " * FROM [Character] WHERE [CtlCode]='0' " . $showClass . " ORDER BY [Resets] desc, [cLevel] desc");

$rank = 0;
while ($array = mssql_fetch_array($query)) {
    $rank++;

    //Guild
    $guild = mssql_fetch_row(mssql_query("SELECT [G_Name] FROM [GuildMember] WHERE [Name]='" . $array['Name'] . "'"));

    //Character Status
    $stat = mssql_fetch_row(mssql_query("SELECT [ConnectStat] FROM [MEMB_STAT] WHERE [memb___id]='" . $array['AccountID'] . "'"));
    $gidc = mssql_fetch_row(mssql_query("SELECT [GameIDC] FROM [AccountCharacter] WHERE [Id]='" . $row['AccountID'] . "'"));

    if ($stat[0] == 1 && $gidc[0] == $array['Name']) {
        $status = '<img src="./images/on.gif">';
    } else {
        $status = '<img src="./images/off.gif">';
    }

    //VIP STATUS
    if ($array['IsVip'] == 0) {
        $acceslevel = "Normal";
    } else {
        $acceslevel = "<font color='green'>VIP</font>";
    }

    //Class Finder
    $classes = findClass($array['Class']);

    //Some crazy rank shit xD
    if ($rank == 1) {
        $array['Name'] = "<font color=red>" . $array['Name'] . "</font>";
        $rank = "<font color=red>$rank</font>";
        $array['cLevel'] = "<font color=red>" . $array['cLevel'] . "</font>";
        $array['Resets'] = "<font color=red>" . $array['Resets'] . "</font>";
        $classes = "<font color=red>" . $classes . "</font>";
        $guild[0] = "<font color=red>" . $guild[0] . "</font>";
        $acceslevel = "<font color=red>" . $acceslevel . "</font>";
    } elseif ($rank == 2) {
        $array['Name'] = "<font color=blue>" . $array['Name'] . "</font>";
        $rank = "<font color=blue>" . $rank . "</font>";
        $array['cLevel'] = "<font color=blue>" . $array['cLevel'] . "</font>";
        $array['Resets'] = "<font color=blue>" . $array['Resets'] . "</font>";
        $classes = "<font color=blue>" . $classes . "</font>";
        $guild[0] = "<font color=blue>" . $guild[0] . "</font>";
        $acceslevel = "<font color=blue>" . $acceslevel . "</font>";
    } elseif ($rank == 3) {
        $array['Name'] = "<font color=green>" . $array['Name'] . "</font>";
        $rank = "<font color=green>" . $rank . "</font>";
        $array['cLevel'] = "<font color=green>" . $array['cLevel'] . "</font>";
        $array['Resets'] = "<font color=green>" . $array['Resets'] . "</font>";
        $classes = "<font color=green>" . $classes . "</font>";
        $guild[0] = "<font color=green>" . $guild[0] . "</font>";
        $acceslevel = "<font color=green>" . $acceslevel . "</font>";
    }

    if ($guild[0] == NULL) {
        $guild = '<font color="silver">-</font>';
    } else {
        $guild = "<a href='?op=guild&guild=" . htmlspecialchars($guild[0]) . "'>" . htmlspecialchars($guild[0]) . "</a>";
    }

    echo "<tr cellpadding='2' cellspacing='1' >
            <td align=center><b><center>" . $rank . "</center></b></font></td>
            <td align=center><b><center>" . $array['Name'] . "</a></center></b></font></td>
            <td align=center><b><center>" . $array['cLevel'] . "</center></b></td>
            <td align=center><b><center>" . $array['Resets'] . "</center></b></td>
            <td align=center><b><center>" . $classes . "</center></b></td>
            <td align=center><b><center>" . $acceslevel . "</center></b></td>
            <td align=center><b><center>" . $guild . "</center></b></td>
            <td align=center><b><center>" . $status . "</center></b></td>
        </tr>";
}

echo "</table>";
 
Last edited:
Here Domino ((xax)) try with this one

PHP:
<?php

$class = clean_var($_GET['class']);
$lines = '100'; //How many characters to show

function findClass($var) {
    switch ($var) {
        case 0:
            return "Dark Wizzard";
            break;
        case 1:
            return "Soul Master";
            break;
        case 3:
            return "Grand Master";
            break;
        case 16:
            return "Dark Knoght";
            break;
        case 17:
            return "Blade Knight";
            break;
        case 19:
            return "Blade Master";
            break;
        case 32:
            return "Elf";
            break;
        case 33:
            return "Muse Elf";
            break;
        case 34:
            return "High Elf";
            break;
        case 48:
            return "Magic Gladiator";
            break;
        case 50:
            return "Duel Master";
            break;
        case 64:
            return "Dark Lord";
            break;
        case 66:
            return "Lord Emperor";
            break;
        case 80:
            return "Summoner";
            break;
        case 81:
            return "Bloody Summoner";
            break;
        case 82:
            return "Dimension Master";
            break;
        default:
            return "Unknown " . $var;
            break;
    }
}

$classes = array(0, 1, 3, 16, 17, 19, 32, 33, 34, 48, 50, 64, 66, 80, 81, 82);
if (in_array($class, $classes)) {
    $showClass = "AND [Class]='" . $class . "'";
} else {
    $showClass = "";
}

echo "<table class=tmem border=0 cellspacing=1 height=10 width=500>
<td> <b><center>#</center></b></font></td>
<td> <b><center>Name</center></b></font></td>
<td> <b><center>LVL</center></b></font></td>
<td> <b><center>RR</center></b></font></td>
<td> <b><center>Class</center></b></font></td>
<td> <b><center>Rank</center></b></font></td>
<td> <b><center>Guild</center></b></font></td>
<td> <b><center>Status</center></b></font></td>";

$query = mssql_query("SELECT TOP " . $lines . " * FROM [Character] WHERE [CtlCode]='0' " . $showClass . " ORDER BY [Resets] desc, [cLevel] desc");

$rank = 0;
while ($array = mssql_fetch_array($query)) {
    $rank++;

    //Guild
    $guild = mssql_fetch_row(mssql_query("SELECT [G_Name] FROM [GuildMember] WHERE [Name]='" . $array['Name'] . "'"));

    //Character Status
    $stat = mssql_fetch_row(mssql_query("SELECT [ConnectStat] FROM [MEMB_STAT] WHERE [memb___id]='" . $array['AccountID'] . "'"));
    $gidc = mssql_fetch_row(mssql_query("SELECT [GameIDC] FROM [AccountCharacter] WHERE [Id]='" . $row['AccountID'] . "'"));

    if ($stat[0] == 1 && $gidc[0] == $array['Name']) {
        $status = '<img src="./images/on.gif">';
    } else {
        $status = '<img src="./images/off.gif">';
    }

    //VIP STATUS
    if ($array['IsVip'] == 0) {
        $acceslevel = "Normal";
    } else {
        $acceslevel = "<font color='green'>VIP</font>";
    }

    //Class Finder
    $classes = findClass($array['Class']);

    //Some crazy rank shit xD
    if ($rank == 1) {
        $array['Name'] = "<font color=red>" . $array['Name'] . "</font>";
        $rank = "<font color=red>$rank</font>";
        $array['cLevel'] = "<font color=red>" . $array['cLevel'] . "</font>";
        $array['Resets'] = "<font color=red>" . $array['Resets'] . "</font>";
        $classes = "<font color=red>" . $classes . "</font>";
        $guild[0] = "<font color=red>" . $guild[0] . "</font>";
        $acceslevel = "<font color=red>" . $acceslevel . "</font>";
    } elseif ($rank == 2) {
        $array['Name'] = "<font color=blue>" . $array['Name'] . "</font>";
        $rank = "<font color=blue>" . $rank . "</font>";
        $array['cLevel'] = "<font color=blue>" . $array['cLevel'] . "</font>";
        $array['Resets'] = "<font color=blue>" . $array['Resets'] . "</font>";
        $classes = "<font color=blue>" . $classes . "</font>";
        $guild[0] = "<font color=blue>" . $guild[0] . "</font>";
        $acceslevel = "<font color=blue>" . $acceslevel . "</font>";
    } elseif ($rank == 3) {
        $array['Name'] = "<font color=green>" . $array['Name'] . "</font>";
        $rank = "<font color=green>" . $rank . "</font>";
        $array['cLevel'] = "<font color=green>" . $array['cLevel'] . "</font>";
        $array['Resets'] = "<font color=green>" . $array['Resets'] . "</font>";
        $classes = "<font color=green>" . $classes . "</font>";
        $guild[0] = "<font color=green>" . $guild[0] . "</font>";
        $acceslevel = "<font color=green>" . $acceslevel . "</font>";
    }

    if ($guild[0] == NULL) {
        $guild = '<font color="silver">-</font>';
    } else {
        $guild = "<a href='?op=guild&guild=" . htmlspecialchars($guild[0]) . "'>" . htmlspecialchars($guild[0]) . "</a>";
    }

    echo "<tr cellpadding='2' cellspacing='1' >
            <td align=center><b><center>" . $rank . "</center></b></font></td>
            <td align=center><b><center>" . $array['Name'] . "</a></center></b></font></td>
            <td align=center><b><center>" . $array['cLevel'] . "</center></b></td>
            <td align=center><b><center>" . $array['Resets'] . "</center></b></td>
            <td align=center><b><center>" . $classes . "</center></b></td>
            <td align=center><b><center>" . $acceslevel . "</center></b></td>
            <td align=center><b><center>" . $guild . "</center></b></td>
            <td align=center><b><center>" . $status . "</center></b></td>
        </tr>";
}

echo "</table>";

nop same problems
 
Last edited:
nop same problems

Remove "clean_var" since it has never been set as a function and allow your errors to show in the website so next time you can just copy/paste the errors and we will be able to help you straight away not needing to guess what the problem is...

First row
PHP:
$class = clean_var($_GET['class']);
Should become like that
PHP:
$class = $_GET['class']; //+ a security function would be nice if you have one ^_^
 
case 0 : $classmode = "where Class='".$class."'";
case 1 : $classmode = "where Class='".$class."'";
case 16 : $classmode = "where Class='".$class."'";
case 17 : $classmode = "where Class='".$class."'";
case 32 : $classmode = "where Class='".$class."'";
case 33 : $classmode = "where Class='".$class."'";
case 48 : $classmode = "where Class='".$class."'";


you are missing lines with case numbers for bm,gm,he,dm,le etc etc