Własny tracker sieci BitTorrent

W tym dziale znajdziemy informacje dotyczące instalacji własnego trackera i strony torrentowej w oparciu o TBdev.net. Przedstawimy warte uwagi serwery, dostępne style i grafiki oraz dodatkowe moduły i komponenty.

Gotowe Mody

WERSJE ZMODYFIKOWANE

1. TBDEV.NET (netmaniack's edition) - źródło z dodatkami

autor: netmaniack
źródło: www.tbdev.net
wersja: 1.3
zrobione na wersji: 01-03-06

 


Pobierz plikPobierz:
TBDEV(netmaniack)


Dziennik zmian:

-------------------------------------------------------------------------------------------
Version 1.3
-------------------------------------------------------------------------------------------
disabled right click
added Modified Abnormal Upload Speed Detector
added Mysql driven rules
added Stop Warned users deleting there accounts
added rules in rules.php page
removed Massive message, by nan4k7 (removed on v1.0, I just forgot to log that biggrin.gif)
added code for Floods and Cheats block!, created by A1
added 4new tags (see tags.php for examples)
removed if supports DHT will add private flag (removed on v1.0, I just forgot to log that biggrin.gif)
added Seeding Bonus
added Currently Online, on index
added BB Codes to edit.php sendmessage.php upload.php details.php (BB codes by Nazaret2005)
added Replace .torrent .rar .avi .exe .zip .wmv .iso .7z .mp3 characters with spaces
added custom error pages
removed ghost torrent cleaning (not working correctly)
removed Site Log, Site Log like supremetorrent (removed on v1.0, I just forgot to log that biggrin.gif)
and ofcorse some bugfix
-------------------------------------------------------------------------------------------
Version 1.2
-------------------------------------------------------------------------------------------
fixed some 1.1 version bugs
added Stopping staff from being added to the friends list
added Garu nosaukumu beigu norāvējs (by Janhouse)
-------------------------------------------------------------------------------------------
Version 1.1
-------------------------------------------------------------------------------------------
updated QUOTE function
added MySQL driven FAQ By avataru
+ some bugfixes
-------------------------------------------------------------------------------------------
Version 1.0 (based on tbdev.net-01-03-06)
-------------------------------------------------------------------------------------------

added Private Tracker Patch (REWRITE), Based on Tux2005's mod, with more features!
added Better client recognition
added Client Ban - User Agent or Peer ID, ban torrent client thru user agent or peer id
added List Unconfirmed Users uncon.php, List Unconfirmed Users uncon.php
added statusbar
added advanced staff page
added Site Log, Site Log like supremetorrent
added Advanced Log, Searches and Page Numbers by dkray+wilba
added Massive message, by nan4k7
added Search Torrents in browse.php, By Lamers
added chat script (pjirc)
added control panel for Administration
added Manage Tracker Categories, By LiquidAtoR
added When user change his pass, he must write the old pass
added Sysop's Reset Users Password, Rest lost Passwords
added Forum Manager
added Show users with ratio under 0.40
added Park your account mod by psor
added Page Executed In.....Seconds By Angel
added Request Section by EnzoF1 & Oink
added Nuke Mod
added BitBucket TBDev Powered, It Resizes, validates, a must for avatars
added Anticheat: Increase ratio using Firefox, by unknow
added countries list from TorrentStrike_V0.4
added ghost torrent cleaning
added g-zip support
added MAC skin (default skin whit MAC PC support, font sizes below 9 may be illegible in Mac browser)
added Torrent File Info, gives similar information to TorrentSpy
added Traceroute, Traceroute admin tools
added Simple Announcement MOD, A simple to implement Working Announcement MOD
added Uploaders info panel, by repT|Le
added Unconnectable Peers issue - a fix by laffin
added passkey By SKORPiUS
added New releases get NEW TAG, By psor
added if supports DHT will add private flag
added Avoid thumbs.db in torrents
added in cleanup.php my_sql optimization

 

2. TBDEV.NET___(sa27's edition)

autor: sa27
źródło: www.tbdev.net
wersja: 1.0


Pobierz plikPobierz:
TBDEV.NET(sa27' edition)


Zawartość paczki:

------------------------------------------------------------
Manage tracker countries by HCLivess
Private Tracker Patch (REWRITE) by laffin & Tux2005
Stopping staff from being added to the friends lis by thebrass
Updated QUOTE function by Retro
Current mood
True user speed by lords
Release Groups by Nazaret2005
Totaltraffic in details.php by RAW
Client Ban User Agent or Peer ID by tmwsiy
Hannes' Shoutbox with Clickable Smilies, Classes by okiee
List Unconfirmed Users uncon.php, List Unconfirmed Users uncon.php
Request a reseed By rsaver
Status Bar by Psor
Seeder need mod
Advanced Log, Searches and Page Numbers by dkray+wilba
Massive message, by nan4k7
BBcods And Smilies In Sendmessage By RAW
BBcods function by Nazeret2005
Search Torrents in browse.php, By Lamers
Site Log By Norris
Numbers Only In vImage By Gollum
PJirc (chat script)
added MySQL driven FAQ By avataru
control panel for Administration
Manage Tracker Categories, By LiquidAtoR
Mailbox System By Tux2005
Book mark mod by OiNK
Old password by RAW
Sort torrents by columns in "TorrentTable" By MarkoStamcar
Sysop's Reset Users Password, Rest lost Passwords
Forum Manager
Torrent Speed In Browse Page By Devinkray
Show users with ratio under 0.40
Park your account mod by psor
Page Executed In.....Seconds By Angel
Request Section by EnzoF1 & OiNK
Better client recognition
Firstline Support By aQuatomic
Change User Class Text To Image by nazaret2005
Gender Mod By EnzoF1
Quick Reply in Comments by ltn100
Snatched List
Last (X) snatches by psor
Automatic Welcome PM to New User By thebrass
Topic Description in Forum By devinkray
User Info edit by admins by UrbanD
Cut Torrentnames in Browse
Nuked Mod by RAW
Forum Users Online By Coldfusion
BitBucket TBDev Powered, It Resizes, validates, a must for avatars
Anticheat: Increase ratio using Firefox, by unknow
countries list from TorrentStrike_V0.4
ghost torrent cleaning
g-zip support
Showing MB/Day By samehzone
MAC skin (default skin whit MAC PC support, font sizes below 9 may be illegible in Mac browser)
Torrent File Info by ltn100
Traceroute, Traceroute admin tools
Simple Announcement MOD, A simple to implement Working Announcement MOD
Uploaders info panel, by repT|Le
Unconnectable Peers issue - a fix by laffin
passkey By SKORPiUS
New releases get NEW TAG, By psor
Help Desk By nuerher
if supports DHT will add private flag
Avoid thumbs.db in torrents
BBcods And Smilies In Upload Page By RAW
in cleanup.php my_sql optimization
Optimized Users.php By DRRRR
Number Confirmation On Signup By DemoN
Average Progress Bar modified to be more dynamic by dumpydooby
Report User by Oink
Redirect On Http By Wilba
Clickable Thank You Button By Angel
---------------------------------------------------------------------------------------

Instalacja silnika TBDEV.NET

JAK ZAINSTALOWAĆ TBDEV.NET?

I. Potrzebujemy jakiegoś dobrego serwera, rozsądną ofertę znajdziemy na Webd.pl, jest szybki i co najważniejsze za rozsądną cenę.

>>> Rejestracja na serwerze

1. Wchodzimy na http://www.webd.pl ( lub na inną stronę, która oferuje serwery)

2. Wybieramy jeden z dostępnych opcji serwera, dla początkujących polecam (medium 6.99 zł)

3. Klikamy "zamawiam" 

4. Teraz wyświetli się lista w, której trzeba podać swoje dane osobowe. 

5. Po udanej rejestracji wyślą na wasz adres e-maila z informacjami. 

6. Wejdźcie do poczty i kliknijcie na link, który wam przysłali. Już macie swoje konto! 

7. Musimy utworzyć swoją bazę danych zrobimy w w panelu administracyjnym naszej strony. 

8. Zakładka zarządzanie witryną z niej wybieramy Baza danych MySQL 

9. Tworzymy nową bazę danych i użytkownika (nasza nawa bedzie poprezdzona naszym loginiem), naszym HOSTEM bedzie sofa2 

10. Wszystko gotowe teraz instalacja tbdev.net 

II.  ŚCIĄGAMY PLIKI DO INSTALACJI TRACKERA 


Pobierz plikPobierz:

TBDEV.NET - plik główny




III. INSTALACJA

1. Wypakowujemy pliki.

2. Wchodzimy do folderu include/secrets.php

3. Wypełniamy wedle poniższych wskazań



KOD

<?



$mysql_host = "localhost"; (nazwa towjego hosta w tym wypadku sofa2) 

$mysql_user = "tb"; (nazwa użytkownika bazy danych którą wcześniej stworzyliście) 

$mysql_pass = ""; (hasło użytkownika które podaliście) 

$mysql_db = "bittorrent"; (nazwa bazy danych którą stwotzyliście) 



?> 



przykładowa konfiguracja: 

<? 



$mysql_host = "sofa2"; 

$mysql_user = "test_test"; 

$mysql_pass = "haslo"; 

$mysql_db = "test_test"; 



?>

4. Otwieramy plik include/bittorrent.php

--------------------[znajdz]-------------------- 

$maxusers = 75000; // LoL Who we kiddin' here? 



(liczba 75000 to liczba userow jaka ma byc na twojej stronie wpisz własną.) 



---------------------[znajdz]------------------- 

$torrent_dir = "/var/tb/torrents"; 



(tutaj podajemy ścieżkę gdzie bedą zapisywane twoje torrenty na serwerze FTP) 



---------------------[znajdz]------------------- 

$announce_urls[] = "http://domain.com:81/announce.php"; 



(tutaj podajemy adres naszego serwera, strony (musi zaczynać sie od http://...) 



---------------------[znajdz]------------------- 

$DEFAULTBASEURL = "http://domain.com"; 



(tutaj podajemy adres naszej strony) 



---------------------[znajdz]------------------- 

$SITEEMAIL = "noreply@domain.com"; 



(tutaj podajemy adres email naszej strony) 



---------------------[znajdz]------------------- 

$SITENAME = "TBDEV.NET"; 



(tutaj wpisujemy nazwe naszej strony)

5. Teraz należy wybrać bazę danych

a) wchodzimy w phpmyadmina i importujemy pliki z rozszerzeniem .sql w folderze SQL. Najpierw plik database.sql potem reszta.

6. Wrzucamy wszystkie pliki do katalogu na serwerze public_html/

7. Nastepnie zmieniamy chamody pliku secrets.php na 666 możemy to zrobić za pomocą Total Commandera najłatwiej. 

a) po wrzuceniu plików na serwer zaznaczmy plik secrets.php i z menu wybieramy plik/ zmień atrybuty.../ i w okienku wpisujemy 666

ABY TORRENTY DZIAŁAŁY należy także zmienić chamody katalogu torrents, jezeli takiego nie masz utwórz go i zmień mu chamody na 777

8. Aby strona sie wyswietliła należy zainstalować theme

 





Artykuł opracowany na podstawie: http://www.sourceinfo.webd.pl

Mody & Porady

Tutaj znajduje się zbiór dostępnych dla TBDEV.NET modów oraz porad jak właściwie zmodyfikować skrypt naszego trackera.

AutoBackup

Chciałem dodać tutaj bardzo interesujący mod, i przy okazji bardzo praktyczny. Tyle się słyszy o włamaniach na konkurencyjne stronki torrentowe różnych Hackerów. By spać bezpiecznie warto robić Backupy ale są one nieco uciążliwe.





Oto mod który będzie nam automatycznie robił Backupy i wysyłał na dowolny adres e-mail.





tb



tb


mysql.backup.rar
Pobierz Plik ściągnięto 0 raz(y) 2,31 KB

FreeLeech

Instrukcja:



1. My najpierw musimy utworzyć nową kolumnę w phpmyadmin ( w bazie MySQL ) w tabeli "torrents"


Kod:
ALTER TABLE `torrents` ADD `freeleech` VARCHAR( 3 ) DEFAULT 'no' NOT NULL;





2. Nastepnie edytujemy plik announce.php



Znajdź poniższą linijkę ( powinna być 170)


Kod:
  if ($upthis > 0 || $downthis > 0)

        mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error 3");





Zamień ja na:


Kod:
  if ($upthis > 0 || $downthis > 0)

    {

        $freelech = mysql_query("SELECT * FROM torrents WHERE id='$torrentid' AND freeleech='yes'");

        if (mysql_num_rows($freelech) == 1)

        {

                    mysql_query("UPDATE users SET uploaded = uploaded + $upthis WHERE id=$userid") or err("Tracker error 3");

        }

        else

        {

                    mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error 3");

        }

    }





3. Teraz utwórz nowy plik freeleech.php w głównym katalogu i wklej poniższy kod do niego:


Kod:
echo "<table width=\"500\" border=\"0\">

  <tr>

    <td class=rowhead><center>Id</center></td>

    <td class=rowhead><center>Ime</center></td>

    <td class=rowhead><center>FreeLeech</center></td>

    </tr>"; // Ime = Name



   



while ($vrstica = mysql_fetch_array($rezultat))

{

    echo "

  <tr>

    <td><center>$vrstica[id]</center></td>

    <td><center><a href=\"http://www.slo-scene.net/details.php?id=$vrstica[id]\" target=\"_blank\">".format_comment($vrstica[name])."</a></center></td>

        <td><center><a href=\"freeleech.php?akcija=odstrani&odstraniid=$vrstica[id]\">Odstrani</a></center></td>

    </tr>"; // Odstrani = Remove

}

echo "</table><br /><br />Copyrights &#169; for free leech by Kami</div>";



if ($akcija == "odstrani")

{

    $rezultat = mysql_query("SELECT * from torrents WHERE id='$odstraniid'");

    mysql_query("UPDATE torrents SET freeleech='no' WHERE id='$odstraniid'");

   

    while ($vrstica = mysql_fetch_array($rezultat))

    {

        $ime = str_replace(" [FreeLeech]", " ", $vrstica[name]);

        mysql_query("UPDATE torrents SET name='$ime' WHERE id='$odstraniid'");

    }

   

    header("Location: freeleech.php?napaka=3");

}

stdfoot();

die();

?>





To wygląda mniej więcej tak:



freeleech



4. Teraz musimy edytować plik bittorrent.php



Znajdź to:


Kod:
$dispname = htmlspecialchars($row["name"]);





Zamień na to:


Kod:
$dispname = format_comment(htmlspecialchars($row["name"]));





5. Teraz zedytujemy plik userdetails.php



Znajdź to:


Kod:
  while ($a = mysql_fetch_assoc($r))

  {

        $r2 = mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE__, __LINE__);

        $a2 = mysql_fetch_assoc($r2);

        $cat = "<img src=\"/pic/$a2[image]\" alt=\"$a2[name]\">";

      $torrents .= "<tr><td style='padding: 0px'>$cat</td><td><a href=details.php?id=" . $a["id"] . "&hit=1><b>" . htmlspecialchars($a["name"]) . "</b></a></td>" .

        "<td align=right>$a[seeders]</td><td align=right>$a[leechers]</td></tr>\n";

  }





Zamień na to:


Kod:
  while ($a = mysql_fetch_assoc($r))

  {

  $r2 = mysql_query("SELECT name, image FROM categories WHERE id=$a[category]") or sqlerr(__FILE__, __LINE__);

  $a2 = mysql_fetch_assoc($r2);

  $cat = "<img src=\"/pic/$a2[image]\" alt=\"$a2[name]\">";

   $torrents .= "<tr><td style='padding: 0px'>$cat</td><td><a href=details.php?id=" . $a["id"] . "&hit=1><b>" .



format_comment(htmlspecialchars($a["name"])) . "</b></a></td>" .

  "<td align=right>$a[seeders]</td><td align=right>$a[leechers]</td></tr>\n";

  }





A następnie znajdź to:


Kod:
  $ret .= "<tr><td style='padding: 0px'><img src=\"pic/$catimage\" alt=\"$catname\" width=42 height=42></td>\n" .

        "<td><a href=details.php?id=$arr[torrent]&amp;hit=1><b>" . htmlspecialchars($arr["torrentname"]) .

        "</b></a></td><td align=center>$ttl</td><td align=center>$size</td><td align=right>$seeders</td><td align=right>$leechers</td><td align=center>$uploaded</td>\n" .

        "<td align=center>$downloaded</td><td align=center>$ratio</td></tr>\n";





i analogicznie zamień na to:


Kod:
$ret .= "<tr><td style='padding: 0px'><img src=\"pic/$catimage\" alt=\"$catname\" width=42 height=42></td>\n" .

        "<td><a href=details.php?id=$arr[torrent]&amp;hit=1><b>" . format_comment(htmlspecialchars($arr["torrentname"])) .

        "</b></a></td><td align=center>$ttl</td><td align=center>$size</td><td align=right>$seeders</td><td align=right>$leechers</td><td align=center>$uploaded</td>\n" .

        "<td align=center>$downloaded</td><td align=center>$ratio</td></tr>\n";





Z tym modem ty możesz robić na swojej stronce freeleech, Free Leech oznacza zliczanie tylko uploadu na wybranych torrentach

Kontrola Anonimowości

Utwórz nowyplik anonymous.php

<?php

require "include/bittorrent.php";

dbconn(true);

loggedinorreturn();

if (get_user_class() >= UC_MODERATOR) {

stdhead("");

begin_main_frame();

// ===================================

$unco = number_format(get_row_count("users", "WHERE class<'4' AND anonymous='yes'"));

begin_frame("Anonimowcy poniżej Lulka ($unco)", true);

begin_table();

?>

<form method="post" action="/takeanonymous.php">

<tr><td class="colhead">ID</td><td class="colhead" align="left">Username</td><td class="colhead">Wylacz Anonimowosc</td></tr>

<?

$res=mysql_query("SELECT id,username, class FROM users WHERE class < '4' AND anonymous='yes' ORDER BY id") or print(mysql_error());

// ------------------

while ($arr = @mysql_fetch_assoc($res)) {

echo "<tr><td>" . $arr[id] . "</td><td align=\"left\"><b><a href=userdetails.php?id=" . $arr[id] . " > " . $arr[username] . "</a></b></td><td><input type=\"checkbox\" name=\"delusr[]\" value=\"" . $arr[id] . "\" /></td></tr>";

}

?>

<tr><td colspan="5" align="right"><input type="submit" value="Dalej!" /></td></tr>

</form>

<?

// ------------------

end_table();

end_frame();

$unco2 = number_format(get_row_count("users", "WHERE anonymous='yes'"));

begin_frame("Anonimowcy ($unco2)", true);

begin_table();

?>

<form method="post" action="/takeanonymous.php">

<tr><td class="colhead">ID</td><td class="colhead" align="left">Username</td><td class="colhead">Wylacz Anonimowosc</td></tr>

<?

$res=mysql_query("SELECT id,username, class FROM users WHERE class < '11' AND anonymous='yes' ORDER BY id") or print(mysql_error());

// ------------------

while ($arr = @mysql_fetch_assoc($res)) {

echo "<tr><td>" . $arr[id] . "</td><td align=\"left\"><b><a href=userdetails.php?id=" . $arr[id] . " > " . $arr[username] . "</a></b></td><td><input type=\"checkbox\" name=\"delusr[]\" value=\"" . $arr[id] . "\" /></td></tr>";

}

?>

<tr><td colspan="5" align="right"><input type="submit" value="Dalej!" /></td></tr>

</form>

<?

// ------------------

end_table();

end_frame();

// ===================================

end_main_frame();

stdfoot();

}

else {

stderr("Sorry", "Access denied!");

}

?>

Utwórz następnie plik takeanonymous.php

<?

require_once("include/bittorrent.php");

function bark($msg) {

stdhead();

stdmsg("Job failed...", $msg);

stdfoot();

exit;

}

dbconn();

loggedinorreturn();

if (get_user_class() > UC_MODERATOR) {

if (empty($_POST["delusr"]))

bark("Don't leave any fields blank.");

$do="UPDATE users SET anonymous='no' WHERE id IN (" . implode(", ", $_POST[delusr]) . ")";

$res=mysql_query($do);

}

header("Refresh: 0; url=/anonymous.php");

?>

 

Masowe Rozdawanie Zaproszeń

Mod, który pozwala dać wszystkim użytkownikom po 1 lub innej, zdefiniowanej przez nas liczbie zaproszeń.

http://img136.imageshack.us/img136/8521/invite4zs.jpg

Utworz plik massinvite.php i daj do niego kod:

<?

require_once('include/bittorrent.php');

dbconn();

loggedinorreturn();

if (get_user_class() < UC_ADMINISTRATOR)

stderr('Error', 'Access denied.');

if ($_POST['doit'] == 'yes') {

mysql_query("UPDATE users SET invites = invites + 1");

header("Location: /staff.php");

}

stdhead('Masowe rozdawanie zaproszeń');

?>

<h2>Po jednym zaproszeniu dla wszystkich użytkowników?</h2>

<font size=1>Czy jestes pewny, że chcesz dać wszystkim jedno dotkowe zaproszenie? </font><br /><br />

<form action="massinvite.php" method="post">

<table border=1 cellspacing=0 cellpadding=5><tr><td class="rowhead">

<input type = "hidden" name = "doit" value = "yes" />

<input type="submit" value="Tak!" />

</td></tr></table>

</form>

<? stdfoot(); ?>




Releasy z nForce.nl

Mod ten pokazuje, jaki są ostatnio wydane release na stronie nforce.nl. Korzysta on z plików xml



1.Utwórz plik nforce.php i dodaj do niego kod:

Kod:
<?php



ob_start("ob_gzhandler");



require_once("include/bittorrent.php");



dbconn(true);

stdhead();



include './lastRSS.php';



// create lastRSS object

$rss = new lastRSS; 



// setup transparent cache

$rss->cache_dir = './newsCache'; 

$rss->cache_time = 3600; // one hour

?>



<h2>Ostatnie release na nforce.nl</h2>

<table width=100% border="1" cellspacing="0" cellpadding="10" class="stats" background=images/mainbox_bg.jpg><tr><td align=center>

<table cellspacing="0" cellpadding="5" border="0" class=main border=1>

<tr>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release DVD</strong></td>

</tr>

</table>

<font size="1">

<?

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_18.xml')) {

foreach($rs['items'] as $item) {

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

}

}

else {

print ('Error: NForce not reachable...');

}

?>

</td>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release SVCD</strong></td>

</tr>

</table>

<font size="1">

<?

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_15.xml')) {

foreach($rs['items'] as $item) {

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

}

}

else {

print ('Error: NForce not reachable...');

}

?>



</td>

</tr>

<tr>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release w kategorii Tv-Rip</strong></td>

</tr>

</table>

<font size="1">

<?

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_19.xml')) {

foreach($rs['items'] as $item) {

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

}

}

else {

print ('Error: NForce not reachable...');

}

?>



</td>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release XXX</strong></td>

</tr>

</table>

<font size="1">

<?

$max = 0;

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_17.xml')) {

foreach($rs['items'] as $item) {

if ($max >= 10) { break; }

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

$max++;

}

}

else {

print ('Error: NForce not reachable...');

}

?>

</td>

</tr>

  <tr>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong> PS2</strong></td>

</tr>

</table>

<font size="1">

<?

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_9.xml')) {

foreach($rs['items'] as $item) {

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

}

}

else {

print ('Error: NForce not reachable...');

}

?>

</td>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release na konsolę xBox</strong></td>

</tr>

</table>

<font size="1">

<?

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_11.xml')) {

foreach($rs['items'] as $item) {

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

}

}

else {

print ('Error: NForce not reachable...');

}

?>



</td>

</tr>

<tr>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release w kategori PC/ISo</strong></td>

</tr>

</table>

<font size="1">

<?

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_2.xml')) {

foreach($rs['items'] as $item) {

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

}

}

else {

print ('Error: NForce not reachable...');

}

?>



</td>

<td width="50%" valign="top">

<table cellspacing="0" cellpadding="0" border="0" width="100%">

<tr>

<td class="upper"><strong>Ostatnie release w kategori Programy/PC ISO</strong></td>

</tr>

</table>

<font size="1">

<?

$max = 0;

if ($rs = $rss->get('http://www.nforce.nl/rss/rss_6.xml')) {

foreach($rs['items'] as $item) {

if ($max >= 10) { break; }

echo "<a href=\"$item[link]\">".$item['title']."</a><br>\n";

$max++;

}

}

else {

print ('Error: NForce not reachable...');

}

?>

</td>

</tr>

</table>

</td></tr></table>



<?

stdfoot();



?>

2.Utwórz plik lastRSS.php i dodaj do niego kod:

Kod:

<?php

/*

 ======================================================================

 lastRSS 0.9.1

 

 Simple yet powerfull PHP class to parse RSS files.

 

 by Vojtech Semecky, webmaster @ webdot . cz

 

 Latest version, features, manual and examples:

 http://lastrss.webdot.cz/



 ----------------------------------------------------------------------

 LICENSE



 This program is free software; you can redistribute it and/or

 modify it under the terms of the GNU General Public License (GPL)

 as published by the Free Software Foundation; either version 2

 of the License, or (at your option) any later version.



 This program is distributed in the hope that it will be useful,

 but WITHOUT ANY WARRANTY; without even the implied warranty of

 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

 GNU General Public License for more details.



 To read the license please visit http://www.gnu.org/copyleft/gpl.html

 ======================================================================

*/



/**

* lastRSS

* Simple yet powerfull PHP class to parse RSS files.

*/

class lastRSS {

// -------------------------------------------------------------------

// Public properties

// -------------------------------------------------------------------

var $default_cp = 'UTF-8';

var $CDATA = 'nochange';

var $cp = '';

var $items_limit = 0;

var $stripHTML = False;

var $date_format = '';



// -------------------------------------------------------------------

// Private variables

// -------------------------------------------------------------------

var $channeltags = array ('title', 'link', 'description', 'language', 'copyright', 'managingEditor', 

'webMaster', 'lastBuildDate', 'rating', 'docs');

var $itemtags = array('title', 'link', 'description', 'author', 'category', 'comments', 

'enclosure', 'guid', 'pubDate', 'source');

var $imagetags = array('title', 'url', 'link', 'width', 'height');

var $textinputtags = array('title', 'description', 'name', 'link');



// -------------------------------------------------------------------

// Parse RSS file and returns associative array.

// -------------------------------------------------------------------

function Get ($rss_url) {

// If CACHE ENABLED

if ($this->cache_dir != '') {

$cache_file = $this->cache_dir . '/rsscache_' . md5($rss_url);

$timedif = @(time() - filemtime($cache_file));

if ($timedif < $this->cache_time) {

// cached file is fresh enough, return cached array

$result = unserialize(join('', file($cache_file)));

// set 'cached' to 1 only if cached file is correct

if ($result) $result['cached'] = 1;

} else {

// cached file is too old, create new

$result = $this->Parse($rss_url);

$serialized = serialize($result);

if ($f = @fopen($cache_file, 'w')) {

fwrite ($f, $serialized, strlen($serialized));

fclose($f);

}

if ($result) $result['cached'] = 0;

}

}

// If CACHE DISABLED >> load and parse the file directly

else {

$result = $this->Parse($rss_url);

if ($result) $result['cached'] = 0;

}

// return result

return $result;

}



// -------------------------------------------------------------------

// Modification of preg_match(); return trimed field with index 1

// from 'classic' preg_match() array output

// -------------------------------------------------------------------

function my_preg_match ($pattern, $subject) {

// start regullar expression

preg_match($pattern, $subject, $out);



// if there is some result... process it and return it

if(isset($out[1])) {

// Process CDATA (if present)

if ($this->CDATA == 'content') { // Get CDATA content (without CDATA tag)

$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));

} elseif ($this->CDATA == 'strip') { // Strip CDATA

$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));

}



// If code page is set convert character encoding to required

if ($this->cp != '')

//$out[1] = $this->MyConvertEncoding($this->rsscp, $this->cp, $out[1]);

$out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);

// Return result

return trim($out[1]);

} else {

// if there is NO result, return empty string

return '';

}



}



// -------------------------------------------------------------------

// Replace HTML entities &something; by real characters

// -------------------------------------------------------------------

function unhtmlentities ($string) {

// Get HTML entities table

$trans_tbl = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES);

// Flip keys<==>values

$trans_tbl = array_flip ($trans_tbl);

// Add support for &apos; entity (missing in HTML_ENTITIES)

$trans_tbl += array('&apos;' => "'");

// Replace entities by values

return strtr ($string, $trans_tbl);

}



// -------------------------------------------------------------------

// Parse() is private method used by Get() to load and parse RSS file.

// Don't use Parse() in your scripts - use Get($rss_file) instead.

// -------------------------------------------------------------------

function Parse ($rss_url) {

// Open and load RSS file

if ($f = @fopen($rss_url, 'r')) {

$rss_content = '';

while (!feof($f)) {

$rss_content .= fgets($f, 4096);

}

fclose($f);



// Parse document encoding

$result['encoding'] = $this->my_preg_match("'encoding=[\'\"](.*?)[\'\"]'si", $rss_content);

// if document codepage is specified, use it

if ($result['encoding'] != '')

{ $this->rsscp = $result['encoding']; } // This is used in my_preg_match()

// otherwise use the default codepage

else

{ $this->rsscp = $this->default_cp; } // This is used in my_preg_match()



// Parse CHANNEL info

preg_match("'<channel.*?>(.*?)</channel>'si", $rss_content, $out_channel);

foreach($this->channeltags as $channeltag)

{

$temp = $this->my_preg_match("'<$channeltag.*?>(.*?)</$channeltag>'si", $out_channel[1]);

if ($temp != '') $result[$channeltag] = $temp; // Set only if not empty

}

// If date_format is specified and lastBuildDate is valid

if ($this->date_format != '' && ($timestamp = strtotime($result['lastBuildDate'])) !==-1) {

// convert lastBuildDate to specified date format

$result['lastBuildDate'] = date($this->date_format, $timestamp);

}



// Parse TEXTINPUT info

preg_match("'<textinput(|[^>]*[^/])>(.*?)</textinput>'si", $rss_content, $out_textinfo);

// This a little strange regexp means:

// Look for tag <textinput> with or without any attributes, but skip truncated version <textinput />

(it's not beggining tag)

if (isset($out_textinfo[2])) {

foreach($this->textinputtags as $textinputtag) {

$temp = $this->my_preg_match("'<$textinputtag.*?>(.*?)</$textinputtag>'si", $out_textinfo[2]);

if ($temp != '') $result['textinput_'.$textinputtag] = $temp; // Set only if not empty

}

}

// Parse IMAGE info

preg_match("'<image.*?>(.*?)</image>'si", $rss_content, $out_imageinfo);

if (isset($out_imageinfo[1])) {

foreach($this->imagetags as $imagetag) {

$temp = $this->my_preg_match("'<$imagetag.*?>(.*?)</$imagetag>'si", $out_imageinfo[1]);

if ($temp != '') $result['image_'.$imagetag] = $temp; // Set only if not empty

}

}

// Parse ITEMS

preg_match_all("'<item(| .*?)>(.*?)</item>'si", $rss_content, $items);

$rss_items = $items[2];

$i = 0;

$result['items'] = array(); // create array even if there are no items

foreach($rss_items as $rss_item) {

// If number of items is lower then limit: Parse one item

if ($i < $this->items_limit || $this->items_limit == 0) {

foreach($this->itemtags as $itemtag) {

$temp = $this->my_preg_match("'<$itemtag.*?>(.*?)</$itemtag>'si", $rss_item);

if ($temp != '') $result['items'][$i][$itemtag] = $temp; // Set only if not empty

}

// Strip HTML tags and other bullshit from DESCRIPTION

if ($this->stripHTML && $result['items'][$i]['description'])

$result['items'][$i]['description'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['description'])));

// Strip HTML tags and other bullshit from TITLE

if ($this->stripHTML && $result['items'][$i]['title'])

$result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));

// If date_format is specified and pubDate is valid

if ($this->date_format != '' && ($timestamp = strtotime($result['items'][$i]['pubDate'])) !==-1) {

// convert pubDate to specified date format

$result['items'][$i]['pubDate'] = date($this->date_format, $timestamp);

}

// Item counter

$i++;

}

}



$result['items_count'] = $i;

return $result;

}

else // Error in opening return False

{

return False;

}

}

}



?>

 

3.Screen:



a

Tłumaczenie: Kuba1530

Mod napisany przez Wilba

Statystyki na forum

Poniższa modyfikacja dodaje statystyki na forum TBDEV.NET

1. Znajdź w pliku forums.php

print("</table>\n");

print("<p align=center><a href=?action=search><b>Search</b></a> | <a href=?action=viewunread><b>View unread</b></a> | <a href=?catchup><b>Catch up</b></a></p>");

Dodaj po tym:

print("<tr><td class=colhead>Statystki forum</td></tr>\n");

$registered = number_format(get_row_count("users", "WHERE enabled = 'yes'"));

$a = @mysql_fetch_assoc(@mysql_query("SELECT id,username FROM users WHERE status='confirmed' ORDER BY id DESC LIMIT 1")) or die(mysql_error());

if ($CURUSER)

$latestuser = "<a href=userdetails.php?id=" . $a["id"] . ">" . $a["username"] . "</a>";

else

$latestuser = $a['username'];

$totalonline = number_format(get_row_count("users", "WHERE UNIX_TIMESTAMP(" . get_dt_num() . ") - UNIX_TIMESTAMP(last_access) < 1200"));

$topiccount = mysql_query("select sum(topiccount) as topiccount from forums");

$row1 = mysql_fetch_array($topiccount);

$topiccount = $row1[topiccount];

$postcount = mysql_query("select sum(postcount) as postcount from forums");

$row2 = mysql_fetch_array($postcount);

$postcount = $row2[postcount];

print("<tr><td>

&raquo;&nbsp;Nasi użytkownicy napisali " . $postcount . " postów w " . $topiccount . " tematach,<BR>

&raquo;&nbsp;Mamy" . $registered . " zarejestrowanych użytkowników,<BR>

&raquo;&nbsp;Naszym ostatnim zarejestrowanym użytkownikiem jest " . $latestuser . ", <BR>

&raquo;&nbsp;" . $totalonline . " -Tylu użytkowników jest online.</td></tr>\n");

print("</table>");

Efekt:

tbdevnet

Wyłapywanie Cheaterów

Mod wypisuje na forum, nicki osób, które wyuploadowały xxx gb/min np:)

Pliki potrzebe do zmodyfikowania skryptu:

announce.php

forums.php

global.php

1.Otwórz plik global.php i znajdź

Znajdź:

function get_ratio_color($ratio)

{

if ($ratio < 0.1) return "#ff0000";

if ($ratio < 0.2) return "#ee0000";

if ($ratio < 0.3) return "#dd0000";

if ($ratio < 0.4) return "#cc0000";

if ($ratio < 0.5) return "#bb0000";

if ($ratio < 0.6) return "#aa0000";

if ($ratio < 0.7) return "#990000";

if ($ratio < 0.8) return "#880000";

if ($ratio < 0.9) return "#770000";

if ($ratio < 1) return "#660000";

return "#000000";

}

Dodaj przed tym:

function auto_post($subject = "Error - Subject Missing",$body = "Error - No Body") // Function to use the special system message forum

{

$forumid = 'XX'; // Remember to change this if the forum is recreated for some reason.

$res = mysql_query("SELECT id FROM topics WHERE forumid = ".$forumid" AND subject = ".$subject) or sqlerr(__FILE__, __LINE__);

if(mysql_num_rows($res)==1) { // Topic already exists in the system forum.

$arr = mysql_fetch_array($res);

$topicid = $arr['id'];

}

else { // Create new topic.

mysql_query( "INSERT INTO topics (userid, forumid, subject) VALUES(0, $forumid, $subject)") or sqlerr(__FILE__, __LINE__);

$topicid = @mysql_insert_id();

}

$added = "'" . get_date_time() . "'";

mysql_query( "INSERT INTO posts (topicid, userid, added, body) " .

"VALUES($topicid, 0, $added, $body)") or sqlerr(__FILE__, __LINE__);

$res = mysql_query("SELECT id FROM posts WHERE topicid=$topicid ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);

$arr = mysql_fetch_row($res) or die("No post found");

$postid = $arr[0];

mysql_query("UPDATE topics SET lastpost=$postid WHERE id=$topicid") or sqlerr(__FILE__, __LINE__);

}

Oczywscie zamiast XX w linicje

$forumid = 'XX'

Wpisz swoj ID forum

2.Otwórz plik forums.php

a) Znajdź:

if ($postername == "")

{

$by = "unknown[$posterid]";

$avatar = "";

}

Zamień na:

if ($postername == "")

{

if( $posterid == 0 )

$by = "System";

else

$by = "unknown[$posterid]";

$avatar = "";

}

b) Znajdź:

if (mysql_num_rows($res) == 1)

{

$arr = mysql_fetch_assoc($res);

$lpusername = "$arr[username]";

}

else

$lpusername = "unknown[$topic_userid]";

Zamień na:

if (mysql_num_rows($res) == 1)

{

$arr = mysql_fetch_assoc($res);

$lpusername = "$arr[username]";

}

else if( $lpuserid == 0 )

$lpusername = "System";

else

$lpusername = "unknown[$lpuserid]";

c) Znajdź:

if (mysql_num_rows($res) == 1)

{

$arr = mysql_fetch_assoc($res);

$lpauthor = "$arr[username]";

}

else

$lpauthor = "unknown[$topic_userid]";

Zamień na:

if (mysql_num_rows($res) == 1)

{

$arr = mysql_fetch_assoc($res);

$lpauthor = "$arr[username]";

}

else if( $topic_userid == 0 )

$lpauthor = "System";

else

$lpauthor = "unknown[$topic_userid]";

Zamknij i zapisz plik forums.php

3. Otwórz plik announce.php i dokonaj modyfikacji:

Znajdź:

mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'"

. ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "") . " WHERE $selfwhere");

Zamień na:

mysql_query("UPDATE peers SET uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = NOW(), seeder = '$seeder'"

. ($seeder == "yes" && $self["seeder"] != $seeder ? ", finishedat = " . time() : "")

. ", ip = " . sqlesc($ip) . " WHERE $selfwhere")

Znajdź:

if (mysql_affected_rows() && $self["seeder"] != $seeder)

{

Dodaj PO TYM

// Initial sanity check xMB/s for 1 second

if( $upthis > 2097152 ){

// Work out time difference

$rrr = @mysql_query( "SELECT UNIX_TIMESTAMP(last_action) AS ts FROM peers WHERE $selfwhere" );

$aaa = @mysql_fetch_assoc( $rrr );

$starttime = $self['ts'];

$endtime = $aaa['ts'];

$diff = $endtime - $starttime;

// Normalise to prevent divide by zero.

$rate = $upthis / ( $diff + 1 );

// Currently 2MB/s. Increase to 5MB/s once finished testing.

if( $rate > 2097152 ){

$rrr = @mysql_query( "SELECT username,class FROM users WHERE id=$userid" );

$aaa = @mysql_fetch_assoc( $rrr );

$username = $aaa['username'];

$class = $aaa['class'];

if( $class < 6 ){

$rrr = @mysql_query( "SELECT name FROM torrents WHERE id=$torrentid" );

$aaa = @mysql_fetch_assoc( $rrr );

$torrentname = $aaa['name'];

$subject = sqlesc( "Upload - $username" );

$rate = mksize( $rate );

$client = $self['agent'];

$body = sqlesc(

"

"" target="_blank">".$username"
just uploaded at $rate/s. (".

mksize( $upthis )" in $diff seconds.)\n".

"On Torrent

$torrentid"" target="_blank">".$torrentname"
\n".

"Using $client from $ip\n\n".

"This members last actual recorded total uploaded was " . mksize( $last_up ) );

auto_post( $subject , $body );

}

}

}

Znajdź:

$upthis = max(0, $uploaded - $self["uploaded"]);

$downthis = max(0, $downloaded - $self["downloaded"]);

if ($upthis > 0 || $downthis > 0)

mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error 3");

}/

Zamien na:

$upthis = max(0, $uploaded - $self["uploaded"]);

$downthis = max(0, $downloaded - $self["downloaded"]);

if ($upthis > 0 || $downthis > 0)

mysql_query("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error 3");

}

Znajdź:

$fields = "seeder, peer_id, ip, port, uploaded, downloaded, userid";

Zamień na:

$fields = "seeder, peer_id, agent, ip, port, uploaded, downloaded, userid, UNIX_TIMESTAMP(last_action) AS ts";

Zamknij plik announce.php

Spolszczenie TBDEV.NET

SPOLSZCZENIE TRACKERA
Gdy już zainstalujemy Tracker zauważymy ze jest on w wersji Angielskiej, aby przystosować go do kożystania dla polskich userów należy podmienić odpowiednie pliki.

1. Pobieramy "Polskie Pliki"

Pobierz plikPobierz:
Polskie pliki

2. Wypakowywujemy pliki

3. Łaczymy się np za pomocą Total Comandera z naszym serwerem i przesyłamy zmodyfikowane pliki polskie podmieniając ich stare angielskie wersje.


Źródło: własne

Style dla TBDEV.NET

INSTALACJA NOWEGO STYLU

1. Nowy styl możemy zainstalować przy pomocy phpMyAdmin wywołując odpowiednią komendę:



INSERT INTO stylesheets VALUES (2,'styles/Styl.css','Styl text') ;

Przy czym:

Style.css - jest to nazwa stylu, pliku z rozszerzeniem .css

Style text - nazwa twojego stylu

2. Pliki danego Stylu należy wrzucić do katalogu styles znajdującego się na serwerze


Pobierz plikPobierz:

Styl niebieski
Pobierz plikPobierz:

Styl fioletowy
Pobierz plikPobierz:

Styl czarny

TorrentTreader czyli własny tracker torrentowy w prostej postaci...

Proces instalacji tego prostego a jakże fajnego trackera przebiega tak jak to przedstawiłem poniżej, nie posiada on zbyt zaawansowanych funkcji, ale zaleta moze być fakt iż niewymaga bazy mysql. Posiada podział na kategorie torrentów, możliwość uploadownia przez userów i dodawania newsów przez ftp.

INSTALACJA
1. Pobieramy archiwum spakowane rarem z działu download na stronie torrent.crib.pl/files/torrent
2. Wypakowywujemy do dowolnego folderu
3. Wysyłamy wszystkie pliki z katalogu na serwer
4. Ustawiamy atrybut np. za pomocą Total Comandera Plik>Zmień atrybut na folderze torrents na 777 ( standartowo jest 755) -> inaczej atrybut to tzw. chmod
5. Edytujemy plik .config Podając swoje dane.
6. Po edycji pliku config.php i przesłaniu go na serwer ( podmienieniu ) w zasadzie nasza strona powinna działać możemy zedytować newsy na stronie w tym celu musimy wprowadzić txt odpowiedni wedle schematu w pliku news.php
7. Standartowo tracker będzie nam działał w języku angielskim możemy go przetłumaczyć edytujać plik językowy LANG w katalogu languages jest to plik o nazwie englisz.lang
8. W powyższym pliku mozemy również wprowadzić treść działu FAQ
9. Styl i wygląd strony trackera mozemy edytowac poprzez podmianę (zalecane) plików graficznych w folderze images/