mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
Tracker URl
This commit is contained in:
+8
-1
@@ -111,7 +111,7 @@ $seeder = ($left == 0) ? "yes" : "no";
|
||||
|
||||
// check passkey
|
||||
if (!$az = $Cache->get_value('user_passkey_'.$passkey.'_content')){
|
||||
$res = sql_query("SELECT id, username, downloadpos, enabled, uploaded, downloaded, class, parked, clientselect, showclienterror, passkey, donor, donoruntil, seedbonus FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||
$res = sql_query("SELECT id, username, downloadpos, enabled, uploaded, downloaded, class, parked, clientselect, showclienterror, passkey, donor, donoruntil, seedbonus, tracker_url_id FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||
$az = mysql_fetch_array($res);
|
||||
do_log("[check passkey], currentUser: " . nexus_json_encode($az));
|
||||
$Cache->cache_value('user_passkey_'.$passkey.'_content', $az, 3600);
|
||||
@@ -133,6 +133,13 @@ $CURUSER = $GLOBALS["CURUSER"] = $az;
|
||||
$isDonor = is_donor($az);
|
||||
$az['__is_donor'] = $isDonor;
|
||||
$log = "user: $userid, isDonor: $isDonor, seeder: $seeder, ip: $ip, ipv4: $ipv4, ipv6: $ipv6";
|
||||
//check tracker url
|
||||
$trackerUrl = \App\Models\TrackerUrl::getById($az['tracker_url_id']);
|
||||
$currentUrl = getSchemeAndHttpHost();
|
||||
if (!str_contains($trackerUrl, $currentUrl)) {
|
||||
do_log("announce check tracker url, trackerUrl: $trackerUrl does not contains: $currentUrl");
|
||||
warn("you should announce to: $trackerUrl");
|
||||
}
|
||||
|
||||
//3. CHECK IF CLIENT IS ALLOWED
|
||||
//$clicheck_res = check_client($peer_id,$agent,$client_familyid);
|
||||
|
||||
+4
-4
@@ -84,9 +84,9 @@ if ($CURUSER['downloadpos']=="no") {
|
||||
denyDownload();
|
||||
}
|
||||
|
||||
$trackerSchemaAndHost = get_tracker_schema_and_host();
|
||||
$ssl_torrent = $trackerSchemaAndHost['ssl_torrent'];
|
||||
$base_announce_url = $trackerSchemaAndHost['base_announce_url'];
|
||||
//$trackerSchemaAndHost = get_tracker_schema_and_host();
|
||||
//$ssl_torrent = $trackerSchemaAndHost['ssl_torrent'];
|
||||
//$base_announce_url = $trackerSchemaAndHost['base_announce_url'];
|
||||
|
||||
$res = sql_query("SELECT torrents.name, torrents.filename, torrents.save_as, torrents.size, torrents.owner, torrents.banned, torrents.approval_status, torrents.price, categories.mode as search_box_id FROM torrents left join categories on torrents.category = categories.id WHERE torrents.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
|
||||
$row = mysql_fetch_assoc($res);
|
||||
@@ -140,7 +140,7 @@ if (strlen($CURUSER['passkey']) != 32) {
|
||||
sql_query("UPDATE users SET passkey=".sqlesc($CURUSER['passkey'])." WHERE id=".sqlesc($CURUSER['id']));
|
||||
}
|
||||
$dict = \Rhilip\Bencode\Bencode::load($fn);
|
||||
$dict['announce'] = $ssl_torrent . $base_announce_url . "?passkey=" . $CURUSER['passkey'];
|
||||
$dict['announce'] = \App\Models\TrackerUrl::getById($CURUSER['tracker_url_id']) . "?passkey=" . $CURUSER['passkey'];
|
||||
$dict['comment'] = getSchemeAndHttpHost(true) . "/details.php?id=" . $id;
|
||||
do_log(sprintf("[ANNOUNCE_URL], user: %s, torrent: %s, url: %s", $CURUSER['id'] ?? '', $id, $dict['announce']));
|
||||
/**
|
||||
|
||||
+2
-2
@@ -369,7 +369,7 @@ elseif ($action == 'securitysettings') //security settings
|
||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."' name='securitysettings_form'><input type='hidden' name='action' value='savesettings_security'>");
|
||||
tr($lang_settings['row_enable_ssl'],"<input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securelogin'" . ($SECURITY["securelogin"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
|
||||
tr($lang_settings['row_enable_ssl_tracker'],"<input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "yes" ? " checked" : "") . " value='yes'> ".$lang_settings['text_yes']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "no" ? " checked" : "") . " value='no'> ".$lang_settings['text_no']. " <input type='radio' name='securetracker'" . ($SECURITY["securetracker"] == "op" ? " checked" : "") . " value='op'> ".$lang_settings['text_optional']."<br />".$lang_settings['text_ssl_note'], 1);
|
||||
tr($lang_settings['row_https_announce_url'],"<input type='text' style=\"width: 300px\" name=https_announce_url value='".($SECURITY["https_announce_url"] ? $SECURITY["https_announce_url"] : "")."'> ".$lang_settings['text_https_announce_url_note'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
|
||||
// tr($lang_settings['row_https_announce_url'],"<input type='text' style=\"width: 300px\" name=https_announce_url value='".($SECURITY["https_announce_url"] ? $SECURITY["https_announce_url"] : "")."'> ".$lang_settings['text_https_announce_url_note'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
|
||||
yesorno($lang_settings['row_enable_image_verification'], 'iv', $SECURITY["iv"], $lang_settings['text_image_verification_note']);
|
||||
yesorno($lang_settings['row_allow_email_change'], 'changeemail', $SECURITY["changeemail"], $lang_settings['text_email_change_note']);
|
||||
tr($lang_settings['row_cheater_detection_level'],"<select name='cheaterdet'><option value=0 " . ($SECURITY["cheaterdet"] == 0 ? " selected" : "") . "> ".$lang_settings['select_none']." </option><option value=1 " . ($SECURITY["cheaterdet"] == 1 ? " selected" : "") . "> ".$lang_settings['select_conservative']." </option><option value=2 " . ($SECURITY["cheaterdet"] == 2 ? " selected" : "") . "> ".$lang_settings['select_normal']." </option><option value=3 " . ($SECURITY["cheaterdet"] == 3 ? " selected" : "") . "> ".$lang_settings['select_strict']." </option><option value=4 " . ($SECURITY["cheaterdet"] == 4 ? " selected" : "") . "> ".$lang_settings['select_paranoid']." </option></select> ".$lang_settings['text_cheater_detection_level_note']."<br />".$lang_settings['text_never_suspect'].classlist('nodetect',$AUTHORITY['staffmem'],$SECURITY['nodetect']).$lang_settings['text_or_above'].get_user_class_name(UC_UPLOADER,false,true,true).".", 1);
|
||||
@@ -507,7 +507,7 @@ elseif ($action == 'basicsettings') // basic settings
|
||||
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_basic'>");
|
||||
tr($lang_settings['row_site_name'],"<input type='text' style=\"width: 300px\" name=SITENAME value='".($config["SITENAME"] ? $config["SITENAME"]: "Nexus")."'> ".$lang_settings['text_site_name_note'], 1);
|
||||
tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($config["BASEURL"] ? $config["BASEURL"] : $_SERVER["HTTP_HOST"])."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1);
|
||||
tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI)."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI, 1);
|
||||
// tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI)."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"].DEFAULT_TRACKER_URI, 1);
|
||||
// tr($lang_settings['row_mysql_host'],"<input type='text' style=\"width: 300px\" name=mysql_host value='".($config["mysql_host"] ? $config["mysql_host"] : "localhost")."'> ".$lang_settings['text_mysql_host_note'], 1);
|
||||
// tr($lang_settings['row_mysql_user'],"<input type='text' style=\"width: 300px\" name=mysql_user value='".($config["mysql_user"] ? $config["mysql_user"] : "root")."'> ".$lang_settings['text_mysql_user_note'], 1);
|
||||
// tr($lang_settings['row_mysql_password'],"<input type='password' style=\"width: 300px\" name=mysql_pass value=''> ".$lang_settings['text_mysql_password_note'], 1);
|
||||
|
||||
+18
-7
@@ -129,6 +129,7 @@ if ($action){
|
||||
// $updateset[] = "tzoffset = " . sqlesc($tzoffset);
|
||||
|
||||
$updateset[] = "info = " . sqlesc($info);
|
||||
$updateset[] = "tracker_url_id = " . sqlesc($_POST["tracker_url_id"]);
|
||||
|
||||
//notifs
|
||||
if (!empty($_POST['notifs'])) {
|
||||
@@ -145,10 +146,12 @@ if ($action){
|
||||
}
|
||||
$query = "UPDATE users SET " . implode(",", $updateset) . " WHERE id = ".sqlesc($CURUSER["id"]);
|
||||
$result = sql_query($query);
|
||||
if (!$result)
|
||||
sqlerr(__FILE__,__LINE__);
|
||||
else
|
||||
header("Location: usercp.php?action=personal&type=saved");
|
||||
if (!$result) {
|
||||
sqlerr(__FILE__,__LINE__);
|
||||
} else {
|
||||
clear_user_cache($CURUSER["id"], $CURUSER['passkey']);
|
||||
header("Location: usercp.php?action=personal&type=saved");
|
||||
}
|
||||
}
|
||||
stdhead($lang_usercp['head_control_panel'].$lang_usercp['head_personal_settings'],true);
|
||||
|
||||
@@ -156,11 +159,18 @@ if ($action){
|
||||
$ct_r = sql_query("SELECT id,name FROM countries ORDER BY name") or die;
|
||||
while ($ct_a = mysql_fetch_array($ct_r))
|
||||
$countries .= "<option value=".htmlspecialchars($ct_a['id'])."" . (htmlspecialchars($CURUSER["country"]) == htmlspecialchars($ct_a['id']) ? " selected" : "") . ">".htmlspecialchars($ct_a['name'])."</option>\n";
|
||||
$isplist = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
|
||||
$trackerUrls = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
$trackerUrlList = \App\Models\TrackerUrl::listAll();
|
||||
foreach ($trackerUrlList as $item) {
|
||||
$trackerUrls .= "<option value=".htmlspecialchars($item->id)."" . (htmlspecialchars($CURUSER["tracker_url_id"]) == htmlspecialchars($item->id) ? " selected" : "") . ">".htmlspecialchars($item->url)."</option>\n";
|
||||
}
|
||||
$isplist = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
$isp_r = sql_query("SELECT id,name FROM isp ORDER BY id ASC") or die;
|
||||
while ($isp_a = mysql_fetch_array($isp_r))
|
||||
$isplist .= "<option value=".htmlspecialchars($isp_a['id'])."" . (htmlspecialchars($CURUSER["isp"]) == htmlspecialchars($isp_a['id']) ? " selected" : "") . ">".htmlspecialchars($isp_a['name'])."</option>\n";
|
||||
$downloadspeed = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
|
||||
$downloadspeed = "<option value=0>---- ".$lang_usercp['select_none_selected']." ----</option>\n";
|
||||
$ds_a = sql_query("SELECT id,name FROM downloadspeed ORDER BY id") or die;
|
||||
while ($ds_b = mysql_fetch_array($ds_a))
|
||||
$downloadspeed .= "<option value=".htmlspecialchars($ds_b['id'])."" . (htmlspecialchars($CURUSER["download"]) == htmlspecialchars($ds_b['id']) ? " selected" : "") . ">".htmlspecialchars($ds_b['name'])."</option>\n";
|
||||
@@ -199,7 +209,8 @@ if ($action){
|
||||
tr_small($lang_usercp['row_gender'],
|
||||
"<input type=radio name=gender" . ($CURUSER["gender"] == "N/A" ? " checked" : "") . " value=N/A>".$lang_usercp['radio_not_available']."
|
||||
<input type=radio name=gender" . ($CURUSER["gender"] == "Male" ? " checked" : "") . " value=Male>".$lang_usercp['radio_male']."<input type=radio name=gender" . ($CURUSER["gender"] == "Female" ? " checked" : "") . " value=Female>".$lang_usercp['radio_female'],1);
|
||||
tr_small($lang_usercp['row_country'], "<select name=country>\n$countries\n</select>",1);
|
||||
tr_small($lang_usercp['row_tracker_url'], "<select name=tracker_url_id>\n$trackerUrls\n</select>" . "<br /><font class=small size=1>".$lang_usercp['row_tracker_url_help']."</font>",1);
|
||||
tr_small($lang_usercp['row_country'], "<select name=country>\n$countries\n</select>",1);
|
||||
//School select
|
||||
if ($showschool == 'yes'){
|
||||
$schools = "<option value=35>---- ".$lang_usercp['select_none_selected']." ----</option>n";
|
||||
|
||||
Reference in New Issue
Block a user