Jump to content
  • 0

Ranking Gilden


BerkayAta

Question

If I click to last (Son) page I am going to first page in ranking gilden. 

 

Screen :

 

VpErEn.png

 

Ranking_gilden.php :

<?PHP
  $CPSeite = 25;
  $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['Arama']) && $_POST['Arama']=='Arama') {
    if(!empty($_POST['gilde'])) {
      $sqlCmd="SELECT id,name,master,level,exp,ladder_point, rang
      FROM (
      
        SELECT id,name,master,level,exp,ladder_point, @num := @num +1 AS rang
        FROM (
        
          SELECT id,name,master,level,exp,ladder_point, @num :=0
          FROM player.guild
          ORDER BY level DESC, exp DESC, win DESC, ladder_point DESC
          
        ) AS t1
        
      ) AS t2
       
      WHERE name = '".mysql_real_escape_string($_POST['gilde'])."' 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.guild 
  ORDER BY level DESC, exp DESC, win DESC, ladder_point DESC";
  
  $sqlQry = mysql_query($sqlCmd,$sqlServ);
  
  $getSum = mysql_fetch_object($sqlQry);
  $cSeite = calcPages($getSum->summeChars,$aSeite,$CPSeite);
  
?>
<div id="con-top">Lonca Sıralaması</div>
<div id="con-mid">
<div class="center">

<form name="form">
<select name="link" SIZE="1" onChange="window.location.href = document.form.link.options[document.form.link.selectedIndex].value;">
<option selected value="#">Lonca Sıralaması</option>
<option value="?s=ranking_chars">Karakter Sıralaması</option>
</select>
</form>

<br/>
<form action="?s=ranking_gilden" method="POST">
      <b>Arama :</b>
      <input type="text" name="gilde" maxlength="20" size="20"  class="txt"/>
      <input type="submit" name="Arama" value="Arama" maxlength="20" size="20" class="button"/>
</form>
</div>

<table>
<tr>
  <th class="topLine">Sıra</th>
  <th class="topLine">Ad</th>
  <th class="topLine">Başkan</th>
  <th class="topLine">Level</th>
  <th class="topLine">Exp</th>
  <th class="topLine">Puan</th>
</tr>
<?PHP
  $sqlCmd = "SELECT id,name,master,level,exp,ladder_point 
  FROM player.guild 
  ORDER BY level DESC, exp DESC, win DESC, ladder_point DESC 
  LIMIT ".$cSeite[1].",".$CPSeite;
  $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 "<tr>";
    echo "<td class="$zF">".$x."</td>";
    echo "<td class="$zF"><a href='index.php?s=guild&guild=".$getPlayers->name."'>".$getPlayers->name."</a></td>";
    echo "<td class="$zF"><a href='index.php?s=char&char=".charname($getPlayers->master)."'>".charname($getPlayers->master)."</a></td>";
    echo "<td class="$zF">".$getPlayers->level."</td>";
    echo "<td class="$zF">".$getPlayers->exp."</td>";
	echo "<td class="$zF">".$getPlayers->ladder_point."</td>";
    echo "</tr>";
    
    $x++;
    
  }
?>
</table>
<div class="center">
<?PHP
  $maxRange = 4;
  $maxStep = 15;
  $totalpages = ceil(mysql_num_rows($sqlQry)/$CPSeite);
  if(($aSeite-$maxRange)>0) $sStart = $aSeite-$maxRange;
  else $sStart = 1;
  if(($aSeite+$maxRange)<=$cSeite[0]) $sEnde = $aSeite+$maxRange;
  else $sEnde = $cSeite[0];
  
  if(($aSeite)>1) echo '<span class="ranking2"><a href="index.php?s=ranking_gilden&p=1">İlk</a></span> &laquo; ';
  
  
  for($i=$sStart;$i<=$sEnde;$i++) {
    $sKlasse = ($i==$aSeite) ? "ranking1" : "ranking2";
    echo'<span class="'.$sKlasse.'">';
    echo'<a href="index.php?s=ranking_gilden&p='.$i.'">'.$i.'</a></span>';
  }
  
  if(($aSeite+$maxStep)<=$cSeite[0]) echo ' &raquo; <span class="ranking2"><a href="index.php?s=ranking_gilden&p='.$totalpages.'">Son</span></a>';
?>
</div>
</div>
<div id="con-bot"></div>
Link to comment
  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

5 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

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.