KarahanMetin2

17 Ocak 2014 Cuma

Home » , » Günlük NP Sıralaması

Günlük NP Sıralaması

1. KOD SQL içindir.
2. KOD Aga Panel İçindir
3. KOD Normal Herhangi Bir Panel İçindir

Kod:
Query Analyzer'a Girip Gerekli Column'u Ekleyelim
------
ALTER TABLE USERDATA
 ADD GunLukLoyalty int

------
------
Eklenecek Tablo : 

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GUNLUK_NP_TAKIP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GUNLUK_NP_TAKIP]
GO

CREATE TABLE [dbo].[GUNLUK_NP_TAKIP] (
    [StrUserID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [Giris] [int] NULL ,
    [cikis] [int] NULL 
) ON [PRIMARY]
GO

------

1. Account_Logout Procedure'sine girelim

BEGIN TRAN'ın Hemen Altına Yapıştıralım

----- gunluk baslangic
DECLARE @girisnp int , @cikisnp int , @id varchar(50), @logvarmi int
select @id = StrCharID from CURRENTUSER where StrAccountID = @AccountID
select @girisnp = Giris from GUNLUK_NP_TAKIP where StrUserID = @id
select @cikisnp = Loyalty from USERDATA where StrUserID = @id
if  @girisnp > @cikisnp 
BEGIN
update USERDATA set GunlukLoyalty = GunlukLoyalty + (@girisnp - @cikisnp) where StrUserID = @id
DELETE FROM GUNLUK_NP_TAKIP where StrUserID = @id
END
if @cikisnp > @girisnp
BEGIN
update USERDATA set GunlukLoyalty = GunlukLoyalty + (@cikisnp - @girisnp) where StrUserID = @id
DELETE FROM GUNLUK_NP_TAKIP where StrUserID = @id
END
---- gunluk bitis

Kodumuzu Yapy?tyrdyktan Sonra Kaydedip Çykalym Bu Procedure'den.


2. Load_User_Data Procedure'sine girelim

EXEC REPAIR_USER_STAT_POINTS @id hemen üstüne gelicek ?ekilde kodu yapy?tyralym : 

-- gunluk baslangic
DECLARE @girisnp int
select @girisnp = Loyalty from userdata where StrUserID = @id
insert into GUNLUK_NP_TAKIP (StrUserID, Giris, Cikis) VALUES (@id, @girisnp, '0')
-- gunluk bitis

EXEC REPAIR_USER_STAT_POINTS @id

Kodumuzu Yapıştırdıkdan Sonra Kaydedip Çıkalım QA Kapatalım.
QA Açtıktan Sonra Günlük NP'nin Çalışması İçin Bu Kodu Yapıştırıyoruz ;

update userdata set GunlukLoyalty = '0' ve F5'E Basyyoruz 

( Her Gün Saat 00:00'da Bu Kodu Girmelisiniz ki Günlük NP'yi Sıfırlansın.  Bunu JOB İşlemleri İle Otamatik Yapabilrsin. )

Günlük NP Proceduresinin Sağlıklı Çalışması İçin Ne Gerekiyorsa Yaptık Burada İşimiz Bitmiştir...
Altta Verdiğim KOD Aga Panel İçindir. Onunda Altında Normal Panel İçin Vereceğim

Kod:
<? 
// Oturumlar 
ob_start(); 
session_start(); 


if ($_SESSION['sesusera'] == '') { 
     
     
    echo 'Üye Girisi yapiniz!'; 
     
    } 
     
    else { 

?>  
<center> <B> <a href="index.php?sayfa=gunluk"> Ortak Gunluk Siralama </a> | <a href="index.php?sayfa=gunluk&irk=hmn"> Human Gunluk Siralama </a> | <a href="index.php?sayfa=gunluk&irk=krs"> Karus Gunluk Siralama </a> 

<br /><br />Hergun Saat 24:00'da resetlenir.<br />  


 <?  
$irkg = $_GET['irk']; 

if ($irkg == '') { 
     
     $irkgunluk = "ORTAK"; 
      
     
    } 
    elseif ($irkg == 'hmn') { 
         
        $irkgunluk = "HUMAN"; 
        $irks = "2"; 
         
        } 
        elseif ($irkg == 'krs') { 
         
        $irkgunluk = "KARUS"; 
        $irks = "1"; 
         
        } 
         
        else { 
             
            $irkgunluk = "ORTAK"; 
             
            } 
             
            if ($irks == '') { 
                 
                ///  ORTAK 
                 
                ?> 
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> 
<title><? echo $titled; ?></title> 
<link href="../style.css" rel="stylesheet" type="text/css" /> 
 <link href="style.css" rel="stylesheet" type="text/css" /> 

<style type="text/css"> 
<!-- 
.style1 {color: #000000} 
.style2 {color: #FFFFFF} 
.style3 {color: #FFFFFF; font-weight: bold; } 
--> 
</style> 

</head> 

<body background="../imgs/bg.jpg" topmargin="0" marginheight="0"> 
<table width="520" border="0" cellpadding="0" cellspacing="0"> 
  <tr> 
    <td height="24" align="left"  >&nbsp;<img src="../imgs/arti.gif" width="9" height="9" />&nbsp;<strong><center>Gunluk NP Siralamasi - <? echo ($irkgunluk) ; ?></strong></td> 
  </tr> 
  <tr> 
  <? 
    function GNation($nation) 
{ 
    if ($nation == 1) { 
        $nation = '<img src="../imgs/karus.gif">'; 
    } elseif ($nation == 2) { 
        $nation = '<img src="../imgs/elmo.gif">'; 
    } 

    return $nation; 
} 
?> 
    <td align="left" valign="top" background="../imgs/bg.png"> 

       <table width="520" border="0" cellpadding="0" cellspacing="0"> 

          <?     
     

$results=odbc_exec($conn,"SELECT TOP 50 strUserID, Level, Nation, Class, Knights, Loyalty, GunlukLoyalty strCharID FROM USERDATA   ORDER  BY GunlukLoyalty DESC, LEVEL DESC"); 
$asd = 0; 
$tablo_1 = ' 
 <center> <tr> 
      <td width="25" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Sira</span></td> 
  
    <td width="100" align="center" height="14" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Karakter Ady </span></td> 
    <td width="100" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Level</span></td> 
     
  
   
    <td width="100" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">National Point</span></td>   
  <td width="100" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Gunluk NP</span></td> 
  </tr> 
'; 
echo $tablo_1; 
while (odbc_fetch_row($results)) { 
$user = odbc_result($results,1); 
         
    $np = odbc_result($results, 6); 
    $aylik = odbc_result($results, 7); 
    $level = odbc_result($results, 2); 
    $clan = odbc_result($results, 5); 
    $clannm = odbc_result($results, 5); 
        $clanr=odbc_exec($conn,"SELECT IDName FROM KNIGHTS WHERE IDNum = '$clan'"); 
    $clan=odbc_result($clanr, 1); 
    if ($clan == '') { 
        $clan = 'Yok'; 
    } 
    $sira++; 

?> 

<? 


$tablo_2 = ' 

            <tr class="textwhite"> 
            <td align="center"><font color="#990000">'.$sira.'</font></td> 
     
            <td align="center"><a href="index.php?sayfa=userdetay&karakter='.$user.'"><font color="#990000">'.$user.'</a></td> 
            <td align="center"><font color="#990000">'.$level.'</font></td> 
               
                   
                     
<td align="center"><font color="#990000">'.number_format($np).'</font></td>                       
<td align="center"><font color="#990000">'.number_format($aylik).'</font></td> 
          </tr> 
'; 
echo $tablo_2; 
} 

?>   
    </table></td> 
  </tr> 
</table> 
</body> 
</html> 

                 
        <?        } 
                 
                 
                else { ?> 
                     
                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> 
<title><? echo $titled; ?></title> 
<link href="../style.css" rel="stylesheet" type="text/css" /> 
 <link href="style.css" rel="stylesheet" type="text/css" /> 

<style type="text/css"> 
<!-- 
.style1 {color: #000000} 
.style2 {color: #FFFFFF} 
.style3 {color: #FFFFFF; font-weight: bold; } 
--> 
</style> 

</head> 

<body background="../imgs/bg.jpg" topmargin="0" marginheight="0"> 
<table width="520" border="0" cellpadding="0" cellspacing="0"> 
  <tr> 
    <td height="24" align="left"  >&nbsp;<img src="../imgs/arti.gif" width="9" height="9" />&nbsp;<strong><center>Gunluk NP Siralamasi - <? echo ($irkgunluk) ; ?></strong></td> 
  </tr> 
  <tr> 
  <? 
    function GNation($nation) 
{ 
    if ($nation == 1) { 
        $nation = '<img src="../imgs/karus.gif">'; 
    } elseif ($nation == 2) { 
        $nation = '<img src="../imgs/elmo.gif">'; 
    } 

    return $nation; 
} 
?> 
    <td align="left" valign="top" background="../imgs/bg.png"> 

       <table width="520" border="0" cellpadding="0" cellspacing="0"> 

          <?     
     

$results=odbc_exec($conn,"SELECT TOP 50 strUserID, Level, Nation, Class, Knights, Loyalty, GunlukLoyalty strCharID FROM USERDATA WHERE Nation = '".$irks."'   ORDER  BY GunlukLoyalty DESC, LEVEL DESC"); 
$asd = 0; 
$tablo_1 = ' 
 <center> <tr> 
      <td width="25" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Sira</span></td> 
  
    <td width="100" align="center" height="14" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Karakter Ady </span></td> 
    <td width="100" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Level</span></td> 
     
  
   
    <td width="100" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">National Point</span></td>   
  <td width="100" align="center" background="../imgs/menubg.gif" bgcolor="#FF9900"><b><font color="#ffffff">Gunluk NP</span></td> 
  </tr> 
'; 
echo $tablo_1; 
while (odbc_fetch_row($results)) { 
$user = odbc_result($results,1); 
         
    $np = odbc_result($results, 6); 
    $aylik = odbc_result($results, 7); 
    $level = odbc_result($results, 2); 
    $clan = odbc_result($results, 5); 
    $clannm = odbc_result($results, 5); 
        $clanr=odbc_exec($conn,"SELECT IDName FROM KNIGHTS WHERE IDNum = '$clan'"); 
    $clan=odbc_result($clanr, 1); 
    if ($clan == '') { 
        $clan = 'Yok'; 
    } 
    $sira++; 

?> 

<? 


$tablo_2 = ' 

          <tr class="textwhite"> 
            <td align="center"><font color="#990000">'.$sira.'</font></td> 
     
            <td align="center"><a href="index.php?sayfa=userdetay&karakter='.$user.'"><font color="#990000">'.$user.'</a></td> 
            <td align="center"><font color="#990000">'.$level.'</font></td> 
               
                   
                     
<td align="center"><font color="#990000">'.number_format($np).'</font></td>                       
<td align="center"><font color="#990000">'.number_format($aylik).'</font></td> 
          </tr> 
       
'; 
echo $tablo_2; 
} 

?> 
    </table></td> 
  </tr> 
</table> 
</body> 
</html> 
<? 
                     
                     
                     
                     
                     
                    } 

    } 

?>

Kod:
<?php //Cimmy-Ah1CxM Tarafindan yeniden yazıldı..

ob_start(); 
session_start(); 

$dns_Adi = "KN_Online"; //Db Adınız
$dbuser = "cem"; //Database güvenlik adi
$dbpass = "cimmy"; //database güvenlik şifresi

$conn = odbc_connect("$dns_Adi","$dbuser","$dbpass") or die ("Veri Tabanı Bulunamadı.");

?>  

<center>  <a href="gunluk.php"> Ortak Gunluk Siralama </a> | <a href="?irk=hmn"> Human Gunluk Siralama </a> | <a href="?irk=krs"> Karus Gunluk Siralama </a> 

<br /><br />Hergun Saat 24:00'da resetlenir.<br /><br /> 

                
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> 
<title>3nqiN Günlük NP Sıralaması</title> 
<style>
body{
  font-weight:bold;
  font-family: Geneva, Arial, Helvetica, sans-serif;
}
a,a:hover{
  text-decoration:none;
  color:orange;
}

#Tablo {
Width:520px;
border-spacing:0;
border-padding:0; 
border:1px solid black;
}

#Tablo .baslik{
Height:20px;
background:orange;
border:1px solid black;
}
#Tablo td{
color: #990000;
border:1px solid black;
}
.textwhite:hover{
  background:grey;
}

</style>
</head> 
  
<?php

$irkg = $_GET['irk']; 

if ($irkg == '') { 
     
     $irkgunluk = "ORTAK"; 
      
}elseif ($irkg == 'hmn') { 
         
        $irkgunluk = "HUMAN"; 
        $irks = " Where Nation = '2' "; 
         
}elseif ($irkg == 'krs') { 
         
        $irkgunluk = "KARUS"; 
        $irks = " Where Nation = '1' "; 
         
}else { 
        $irkgunluk = "ORTAK"; 
             
} 

                 

  function GNation($nation) 
    { 
    if ($nation == 1) { 
        $nation = '<img src="http://www.**********.com/imgs/karus.gif">'; 
    } elseif ($nation == 2) { 
        $nation = '<img src="http://www.**********.com/imgs/elmo.gif">'; 
    } 
      return $nation; 
    } 
    echo'<table id="Tablo">';     

$results=odbc_exec($conn,"SELECT TOP 50 strUserID, Level, Nation, Class, Knights, Loyalty, GunlukLoyalty strCharID FROM USERDATA $irks ORDER  BY GunlukLoyalty DESC, LEVEL DESC"); 
$sira = 0; 
echo ' 
  <tr class="Baslik"> 
    <td align="center">Sıra</td> 
    <td align="center">Karakter Adı </td> 
    <td align="center">Level</td> 
    <td align="center">National Point</td>   
    <td align="center">Gunluk NP</td> 
  </tr> 
';  
while (odbc_fetch_row($results)) { 
    $user = odbc_result($results,1);  
    $np = odbc_result($results, 6); 
    $aylik = odbc_result($results, 7); 
    $level = odbc_result($results, 2); 
    $clan = odbc_result($results, 5); 
    $clannm = odbc_result($results, 5); 
        $clanr=odbc_exec($conn,"SELECT IDName FROM KNIGHTS WHERE IDNum = '$clan'"); 
    $clan=odbc_result($clanr, 1); 
    if ($clan == '') { 
        $clan = 'Yok'; 
    } 
    $sira++; 


echo ' 
          <tr class="textwhite"> 
            <td align="center">'.$sira.'</td> 
            <td align="center">'.$user.'</td> 
            <td align="center">'.$level.'</td>                    
            <td align="center">'.number_format($np).'</td>                       
            <td align="center">'.number_format($aylik).'</td> 
          </tr>';
} 
echo '</table>';
?> 
</body> 
</html>
Yukarıdaki Kodu gunluk.php Olarak Kayıt Ediniz.

0 yorum:

Yorum Gönder