как се прави бонус система за тракер?

mizarck

Registered
Зависи какво имаш предвид
ако да се добавя напримерно 1гб ъплоуд трафик на даден потребител след дадено действие ще стане лесно но ако имаш предвид да се дава бонус по много критерии става трудно
поясни какво изкаш да направиш
 

TiMaTa

Registered
A moje li da vi popitam - ima li TRAKERI koito ne iziskvat MySQL i ako nqkoi iam TRAKER za Torrents pls da mi go dade plss zashtoto mnogo mi trqbva :)
 

mizarck

Registered
TiMaTa каза:
A moje li da vi popitam - ima li TRAKERI koito ne iziskvat MySQL i ako nqkoi iam TRAKER za Torrents pls da mi go dade plss zashtoto mnogo mi trqbva :)
пиши на кирилица

да има тракер без база данни
казвасе Torrent Trader
потърси го
 

kpacuTo

Registered
renegat96 какво общо има това с това което търся ...

-Намерих каквото търсех но нещо ми дава грешка. Ето го code:

I know you all waited so long for this one, and, at the presure of my tracker's users... i made it...
;)
Run the mysql querys:
Код:
ALTER TABLE `users` ADD `seedbonus` DECIMAL( 5, 1 ) NOT NULL;
and:
Код:
CREATE TABLE `bonus` (
  `id` int(5) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `points` decimal(4,1) NOT NULL default '000.0',
  `traffic` bigint(20) unsigned NOT NULL default '0',
  `gb` int(9) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

INSERT INTO `bonus` (`id`, `name`, `points`, `traffic`, `gb`) VALUES (3, '1', 030.0, 1073741824, 1),
(4, '2', 050.0, 2147483648, 2),
(5, '3', 100.0, 5368709120, 5);

Open include/sanity.php
Find:
Код:
global $PRIVATE_ANNOUNCE, $TORRENTSDIR, $CURRENTPATH, $LIVESTATS, $LOG_HISTORY;
After Add:
Код:
/////////Update Seederbonus for BtitTracker by CobraCRK         (original ideea from TvRecall)   /////////
   $res = mysql_query("SELECT DISTINCT pid FROM peers WHERE status = 'seeder'");
   if (mysql_num_rows($res) > 0)
   {
       while ($arr = mysql_fetch_assoc($res))
       {
	   $x=$arr['pid'];
       mysql_query("UPDATE users SET seedbonus = seedbonus+0.166 WHERE pid = '$x'");
       }
   }

Create a new file named seedbonus.php and write in it:
Код:
<?
// SeedBonus Mod by CobraCRK   -   original ideea by TvRecall...
//cobracrk@yahoo.com
//www.extremeshare.org

require_once ("include/functions.php");
require_once ("include/config.php");

dbconn();

standardheader('Seed Bonus');

if ($CURUSER["view_torrents"]=="no")
   {
       err_msg(ERROR,NOT_AUTH_VIEW_NEWS);
       stdfoot();
       exit;
}
else
    {

block_begin("Seed Bonus");

?>
<style type="text/css">

</style>

<p align="center"><?php
$r=mysql_query("SELECT seedbonus FROM users WHERE id=$CURUSER[uid]");
$cc=mysql_result($r,0,"seedbonus");
echo "<br><center><h1>".BONUS_INFO1."$cc ).<br>".BONUS_INFO2."</h1></center>";

?></p>
<p> </p>
<table width="474" border="1" align="center" cellpadding="2" cellspacing="0">
  <tr>
    <td width="26"><?php echo OPTION; ?></td>
    <td width="319"><?php echo WHAT_ABOUT; ?></td>
    <td width="41"><?php echo POINTS; ?></td>
    <td width="62"><?php echo EXCHANGE; ?> </td>
  </tr>
  <?php
  $uid=$CURUSER['uid'];
  $r=mysql_query("SELECT * from users where id=$uid");
  $c=mysql_result($r,0,"seedbonus");
  $r=mysql_query("SELECT * FROM bonus");
  while($row = mysql_fetch_array($r)){  
  if($c<$row['points']) { $enb="disabled"; }
  echo "<form action=seedbonus_exchange.php?id=".$row['id']." method=post><tr>
    <td><h1><center>".$row['name']."</center></h1></td>
    <td><b>".$row['gb']." GB Upload</b><br>".BONUS_DESC."</td>
    <td>".$row['points']."</td>
    <td><input type=submit name=submit value=\"".EXCHANGE."!\" $enb></td>
  </tr></form>";

}
?>

</table>
<p align="center" class="style1"> </p>
<p class="style2"><?
echo "<center><h1>".BONUS_INFO3."</h1></center>";
block_end();
}

stdfoot();
?>
</p>

Create a new file named seedbonus_exchange.php and write in it:
Код:
<?php
// SeedBonus Mod by CobraCRK   -   original ideea by TvRecall...
//cobracrk@yahoo.com
//www.extremeshare.org
require_once ("include/functions.php");
require_once ("include/config.php");
dbconn();

$id=$_GET['id'];
if(is_null($id)||!is_numeric($id)||$CURUSER["view_torrents"]=="no"){
standardheader('Not allowed');
  err_msg(ERROR,"What tha hell do you want?");
       stdfoot();
       exit;
}

$r=mysql_query("SELECT * FROM bonus WHERE id=$id");
$p=mysql_result($r,0,"points");
$t=mysql_result($r,0,"traffic");
$uid=$CURUSER["uid"];
$r=mysql_query("SELECT seedbonus FROM users WHERE id=$uid");
$u=mysql_result($r,0,"seedbonus");
if($u<$p) {
standardheader('ERROR');
  err_msg(ERROR,"You don't have enough points");
       stdfoot();
       exit;
}else {
@mysql_query("UPDATE users SET uploaded=uploaded+$t,seedbonus=seedbonus-$p WHERE id=$uid");
header("Location: seedbonus.php");

}

?>

Add in your language files:
Код:
define("WHAT_ABOUT" ,"What is this about?");
define("OPTION" ,"Option");
define("POINTS" ,"Points");
define("EXCHANGE" ,"Exchange");
define("BONUS_DESC","If you reach the points for this case, you can exchange these points on the fly into traffic, we take off the points and you receive the traffic.");
define("BONUS_INFO1","Here you can exchange your Seeder-Bonus (current ");
define("BONUS_INFO2","(If the buttons deactivated, you have not enough to trade!");
define("BONUS_INFO3","For what I get points?<br>You receive for every hour the system is registering you as a seeder 1 point.");

Open blocks/menu_block.php
Find:
Код:
print("<tr><td class=blocklist align=center><a href=extra-stats.php>".MNU_STATS."</a></td></tr>\n");
After add:
Код:
print("<tr><td class=blocklist align=center><a href=seedbonus.php>Seed Bonus</a></td></tr>\n");


Live demo: http://www.extremeshare.org/tracker/seedbonus.php

ScreenShot:


Enjoy!!!
 

kpacuTo

Registered
hrischo каза:
kpacuTo каза:
-Намерих каквото търсех но нещо ми дава грешка. Ето го code:
Ами може поне да кажеш каква грешка ти дава....
Ами появява се бутона seedbonus кликвам върху него и ми излиза празна страница.
 

Горе