Jump to content
×
×
  • Create New...
  • 0

Classement des joueurs.php


Wayn
 Share

Question

Bonjour,

 

J'ai repris un site de Metin pour mon serveur mais j'ai un soucis avec la page du classement, les membres du staff sont affichés. De plus, je suis encore débutant en php.

 

<?PHP
 $CPSeite = 20;
 $markierteZeile=0;
 if(isset($_GET['p'])) {
   if(!checkInt($_GET['p']) || !($_GET['p']>0)) $aSeite = 1;
   else $aSeite = $_GET['p'];
 }
 else { $aSeite = 1; }

 if(isset($_POST['suche']) && $_POST['suche']=='ara') {
   if(!empty($_POST['charakter'])) {
     $sqlCmd="SELECT id, name, level, exp, empire, guild_name, rang
     FROM (

       SELECT id, name, level, exp, empire, guild_name, @num := @num +1 AS rang
       FROM (

         SELECT player.id, player.name, player.level, player.exp, player_index.empire, guild.name AS guild_name, @num :=0
         FROM player.player
         LEFT JOIN player.player_index ON player_index.id = player.account_id
         LEFT JOIN player.guild_member ON guild_member.pid = player.id
         LEFT JOIN player.guild ON guild.id = guild_member.guild_id
         INNER JOIN account.account ON account.id=player.account_id
         WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'
         ORDER BY player.level DESC , player.exp DESC

       ) AS t1

     ) AS t2

     WHERE name = '".mysql_real_escape_string($_POST['charakter'])."' LIMIT 1";
     $sqlQry=mysql_query($sqlCmd,$sqlServ);
     if(mysql_num_rows($sqlQry)>0) {

       $getRang = mysql_fetch_object($sqlQry);
       $aSeite = ceil($getRang->rang/$CPSeite);
       $markierteZeile = $getRang->rang;
     }

   }

 }

 $sqlCmd = "SELECT COUNT(*) as summeChars  
 FROM player.player 
 LEFT JOIN player.player_index 
 ON player_index.id=player.account_id 
 LEFT JOIN player.guild_member 
 ON guild_member.pid=player.id 
 LEFT JOIN player.guild 
 ON guild.id=guild_member.guild_id
 INNER JOIN account.account 
 ON account.id=player.account_id
 WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'
 ORDER BY player.level DESC, player.exp DESC";

 $sqlQry = mysql_query($sqlCmd,$sqlServ);

 $getSum = mysql_fetch_object($sqlQry);
 $cSeite = calcPages($getSum->summeChars,$aSeite,$CPSeite);

?>

Classement des joueurs




Classement par catégorie:

Toutes les classes
Guerrier
Sura
Ninja
Chaman








Place
Pseudo
Niveau
Expérience
Guilde
Classe
Empire

<?PHP
 $sqlCmd = "SELECT player.id,player.name,player.job,player.level,player.exp,player_index.empire,guild.name AS guild_name,guild.id AS guild_id 
 FROM player.player 
 LEFT JOIN player.player_index 
 ON player_index.id=player.account_id 
 LEFT JOIN player.guild_member 
 ON guild_member.pid=player.id 
 LEFT JOIN player.guild 
 ON guild.id=guild_member.guild_id 
 INNER JOIN account.account 
 ON account.id=player.account_id
 WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'
 ORDER BY player.level DESC, player.exp DESC 
 LIMIT 20";
 //echo $sqlCmd;
 $sqlQry = mysql_query($sqlCmd,$sqlServ);
 $x=$cSeite[1]+1;
 while($getPlayers = mysql_fetch_object($sqlQry)) {
   $zF = ($x%2==0) ? "thell" : "tdunkel";
   if(checkInt($markierteZeile) && $markierteZeile==$x) { $zF = "tmarkiert"; }
   echo "";
   echo "".$x."";
   echo "".$getPlayers->name."";
   echo "".$getPlayers->level."";
   echo "".$getPlayers->exp."";
   echo "".$getPlayers->guild_name."";
echo '';
   echo '';
   echo "";
   echo "";

   $x++;

 }
?>



	
    

 

Si vous avez une idée, je suis à votre écoute :)

 

Cordialement

Wayn

Link to comment
Share on other sites

  • Answers 11
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

11 answers to this question

Recommended Posts

  • 0

C'est plus compliqué et les requêtes utilisées sont déjà carrément tordues.

 

S'ils ont d'autres caractères spécifiques, genre des { } ça marche aussi.

 

WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'

 

devient comme ceci :

WHERE player.name NOT LIKE '{%}%' AND account.status!='BLOCK'

Link to comment
Share on other sites

  • 0

Tu as la méthode "NOT IN (SELECT ... FROM ... WHERE ...)" qui peut fonctionner plus efficacement que ta simple requête, si le membre est un GM sans crochets, il ne sera pas dans ton classement.

« A change of mind means changing many things. That's why I'm now Alkimyst. »

Link to comment
Share on other sites

  • 0

Modifies ceci :

 

 WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'

 

En ceci :

 

 WHERE player.name NOT IN(SELECT mName FROM common.gmlist) player.name NOT LIKE '[%]%' AND account.status!='BLOCK'

 

 

Et ça devrait aller :)

Link to comment
Share on other sites

  • 0

Merci pour ton aide, j'ai modifié les deux lignes, mais j'ai une erreur MySQL:

 

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /public_html/pages/joueur_classement.php on line 60

 

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /public_html/pages/joueur_classement.php on line 112

Link to comment
Share on other sites

  • 0

WHERE player.name NOT IN(SELECT mName FROM common.gmlist) player.name NOT LIKE '[%]%' AND account.status!='BLOCK'

 

Ca serait mieux avec un AND :)

 

WHERE player.name NOT IN(SELECT mName FROM common.gmlist) AND player.name NOT LIKE '[%]%' AND account.status!='BLOCK'

Link to comment
Share on other sites

  • 0
  • Retraité

Bonjour,

 

Le sujet contient la balise [glow=#800000][Résolu][/glow] ou reste sans réponse depuis deux semaines ou plus, de ce fait il a été déplacé dans la section "Résolu ou sans réponse".

 

Cordialement.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Flux d'Activité

    1. 1

      Antares2.to | modern Old-/Middleschool | START 07.10.22 | International Server

    2. 0

      Projet Genesis

    3. 4

      Shiva.international serveur privé metin2 Oldschool Start 16.09.2022

    4. 0

      Metin2 Champions - Accès anticipé

    5. 0

      Barbok

    6. 4

      Shiva.international serveur privé metin2 Oldschool Start 16.09.2022

  • Recently Browsing

    • No registered users viewing this page.

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.