Merhaba Arkadaşlar bir cok kişi bu kodu arıyor bende zamanında cok
aramiştim sizinle paylaşmak istedim.
KOD
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'yn hemen altyna ?u kodu yapy?tyralym :
----- 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 Yapy?tyrdyktan Sonra Kaydedip Çykalym ve Query Analyzer'i Açalym
Query Analyzer'i Açtyktan Sonra Günlük NP'nin Çaly?masy için Bu Kodu Yapy?tyryyoruz :
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 Syfyrlasyn )
Günlük NP Proceduresinin Sa?lykly Çaly?masy Yçin Ne Gerekiyorsa Yaptyk Burada Y?imiz Bitmi?tir...
Kod K2D Yapımcısından Alıntıdır.
Sırada Php Kodunda!
PHP- Kodu:
<?
// 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" > <img src="../imgs/arti.gif" width="9" height="9" /> <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" > <img src="../imgs/arti.gif" width="9" height="9" /> <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>
<?
}
}
?>
aramiştim sizinle paylaşmak istedim.
KOD
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'yn hemen altyna ?u kodu yapy?tyralym :
----- 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 Yapy?tyrdyktan Sonra Kaydedip Çykalym ve Query Analyzer'i Açalym
Query Analyzer'i Açtyktan Sonra Günlük NP'nin Çaly?masy için Bu Kodu Yapy?tyryyoruz :
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 Syfyrlasyn )
Günlük NP Proceduresinin Sa?lykly Çaly?masy Yçin Ne Gerekiyorsa Yaptyk Burada Y?imiz Bitmi?tir...
Kod K2D Yapımcısından Alıntıdır.
Sırada Php Kodunda!
PHP- Kodu:
<?
// 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" > <img src="../imgs/arti.gif" width="9" height="9" /> <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" > <img src="../imgs/arti.gif" width="9" height="9" /> <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>
<?
}
}
?>