|
#1
|
|||
|
|||
Passkey System
Hello!
Working TBDEV Passkey system would be being asked! With detailed description. Thank You! Sorry very small speak in English. Have a nice day :smile: |
#2
|
||||
|
||||
Passkey by Skorpios, Original passkey split from main topic
The files that must be modified are:
announce.php download.php modtask.php my.php takeprofedit.php userdetails.php First of all, create the field 'passkey' in the 'users' and 'peers' tables. Code:
ALTER TABLE users ADD passkey VARCHAR(32) NOT NULL; ALTER TABLE peers ADD passkey VARCHAR(32) NOT NULL; Now we need to set each users passkey and add it to the downloaded torrent. Both of these are done in download.php by replacing the lines: Code:
header("Content-Type: application/x-bittorrent"); readfile($fn); Code:
require_once "include/benc.php"; if (strlen($CURUSER['passkey']) != 32) { $CURUSER['passkey'] = md5($CURUSER['username'].get_date_time().$CURUSER['passhash']); mysql_query("UPDATE users SET passkey='$CURUSER[passkey]' WHERE id=$CURUSER[id]"); } $dict = bdec_file($fn, (1024*1024)); $dict['value']['announce']['value'] = "$BASEURL/announce.php?passkey=$CURUSER[passkey]"; $dict['value']['announce']['string'] = strlen($dict['value']['announce']['value']).":".$dict['value']['announce']['value']; $dict['value']['announce']['strlen'] = strlen($dict['value']['announce']['string']); header('Content-Disposition: attachment; filename="'.$torrent['filename'].'"'); header("Content-Type: application/x-bittorrent"); print(benc($dict)); To allow users to reset their passkey if they suspect it has been leaked, we modify my.php and takeprofedit.php. In my.php, wherever you want the passkey reset box to appear, add the line: Code:
tr("Reset passkey","<input type=checkbox name=resetpasskey value=1 /> <font class=small>Any active torrents must be downloaded again to continue leeching/seeding.</font>", 1); Code:
if ($_POST['resetpasskey']) $updateset[] = "passkey=''"; Code:
print("<tr><td class=rowhead>Passkey</td><td colspan=2 align=left><input name=resetkey value=1 type=checkbox> Reset passkey</td></tr>n"); Code:
if ($_POST['resetpasskey']) $updateset[] = "passkey=''"; Replace the section that starts and ends: Code:
$req = "info_hash:peer_id:!ip:port:uploaded:downloaded:left:!event"; foreach (explode(":", $req) as $x) . . . $downloaded = 0 + $downloaded; $uploaded = 0 + $uploaded; $left = 0 + $left; Code:
foreach (array("passkey","info_hash","peer_id","ip","event") as $x) $GLOBALS[$x] = "" . $_GET[$x]; foreach (array("port","downloaded","uploaded","left") as $x) $GLOBALS[$x] = 0 + $_GET[$x]; if (strpos($passkey, "?")) { $tmp = substr($passkey, strpos($passkey, "?")); $passkey = substr($passkey, 0, strpos($passkey, "?")); $tmpname = substr($tmp, 1, strpos($tmp, "=")-1); $tmpvalue = substr($tmp, strpos($tmp, "=")+1); $GLOBALS[$tmpname] = $tmpvalue; } foreach (array("passkey","info_hash","peer_id","port","downloaded","uploaded","left") as $x) if (!isset($x)) err("Missing key: $x"); foreach (array("info_hash","peer_id") as $x) if (strlen($GLOBALS[$x]) != 20) err("Invalid $x (" . strlen($GLOBALS[$x]) . " - " . urlencode($GLOBALS[$x]) . ")"); if (strlen($passkey) != 32) err("Invalid passkey (" . strlen($passkey) . " - $passkey)"); //if (empty($ip) || !preg_match('/^(d{1,3}.){3}d{1,3}$/s', $ip)) $ip = getip(); Next we need to verify the passkey is actually valid. After the lines: Code:
dbconn(false); hit_count(); Code:
$valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM users WHERE passkey=" . sqlesc($passkey))); if ($valid[0] != 1) err("Invalid passkey! Re-download the .torrent from $BASEURL"); Code:
//// Up/down stats //////////////////////////////////////////////////////////// if (!isset($self)) { $rz = mysql_query("SELECT id, uploaded, downloaded, class FROM users WHERE ip='$ip' AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2"); if ($MEMBERSONLY && mysql_num_rows($rz) == 0) err("Unrecognized host ($ip). Please go to $BASEURL to sign-up or login."); Code:
//// Up/down stats //////////////////////////////////////////////////////////// if (!isset($self)) { $valid = @mysql_fetch_row(@mysql_query("SELECT COUNT(*) FROM peers WHERE torrent=$torrentid AND passkey=" . sqlesc($passkey))); if ($valid[0] >= 1 && $seeder == 'no') err("Connection limit exceeded! You may only leech from one location at a time."); if ($valid[0] >= 3 && $seeder == 'yes') err("Connection limit exceeded!"); $rz = mysql_query("SELECT id, uploaded, downloaded, class FROM users WHERE passkey=".sqlesc($passkey)." AND enabled = 'yes' ORDER BY last_access DESC LIMIT 1") or err("Tracker error 2"); if ($MEMBERSONLY && mysql_num_rows($rz) == 0) err("Unknown passkey. Please redownload the torrent from $BASEURL."); The last change in the code already has some restrictions coded in. It will allow the torrent to be leeched from only one location at a time, as long as it is not currently being seeded elsewhere. This should prevent a torrent from being leeched by multiple users from the same account, for instance, if a passkey was leaked. On the other hand, some users like to seed from home and from work at the same time, in an attempt to improve their ratio. This code restricts users to seeding from a maximum of three locations simultaneously. For these checks to work, one final change is required, which is to insert the passkey into the peers table when the user connects. To do this, replace the line: Code:
$ret = mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", $port, $uploaded, $downloaded, $left, NOW(), NOW(), '$seeder', $userid, " . sqlesc($agent) . ", $uploaded, $downloaded)"); Code:
$ret = mysql_query("INSERT INTO peers (connectable, torrent, peer_id, ip, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, agent, uploadoffset, downloadoffset, passkey) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", $port, $uploaded, $downloaded, $left, NOW(), NOW(), '$seeder', $userid, " . sqlesc($agent) . ", $uploaded, $downloaded, " . sqlesc($passkey) . ")");
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#3
|
|||
|
|||
Installed this mod...but how can i make
When i go to upload.php to show my passkey : ex : Your announce url is : http://site/announce.php?passkey=blabla :| ? |
#4
|
|||
|
|||
Kinda late but hope this will be helpful to someone.
Put this code: Code:
<p>Your announce url is: <b><?php echo "$announce_urls[0]?passkey={$CURUSER['passkey']}"?></b></p> Code:
<b><?= $announce_urls[0] ?></b></p> in upload.php find: Code:
if (get_user_class() < UC_UPLOADER) { stdmsg("Sorry...", "You are not authorized to upload torrents. (See <a href=\"faq.php#up\">Uploading</a> in the FAQ.)"); stdfoot(); exit; } Code:
if (strlen($CURUSER['passkey']) != 32) { $CURUSER['passkey'] = md5($CURUSER['username'].get_date_time().$CURUSER['passhash']); mysql_query("UPDATE users SET passkey='$CURUSER[passkey]' WHERE id=$CURUSER[id]"); } Code:
<p>Your announce is: <b><?= $announce_urls[0] ?></b></p> Code:
<p>Your announce passkey is: <b><?= $announce_urls[0] ?>?passkey=<?= $CURUSER['passkey'] ?></b></p> |
Tags |
passkey , system |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Advanced HelpDesk With Ticket System | Bigjoos | Mods & Themes | 14 | 13th February 2016 18:59 |
tbdev final 2009 passkey help plz !;) | djblackout | Community Cafe | 15 | 23rd March 2010 03:53 |
passkey? | shaker | Yuna Scatari Edition (YSE) | 2 | 20th February 2010 14:48 |
Passkey | sammygo | Mods & Themes | 1 | 23rd July 2009 19:04 |
passkey | huly | Yuna Scatari Edition (YSE) | 2 | 10th July 2008 13:58 |