Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
vip access
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2021-10-16 11:12:23
Hello everyone, I'm looking to modify to prohibit access to the details.php of the torrent for the member class for some category id of torrents, thank you for your help  :help

I put this in torrent.details.php but it doesn't work:


///////////////////////////////////////////////////////////////////////////////////////////////
//////////////// PORN VIP
if(($CURUSER["class"]<3) && ($row['category']) == 22){
show_error_msg("Error","you can't see the description of this torrent, it is for vip members.",1);
}
///////////////////////////////////////////////////////////////////////////////////////////////
//////////////// END PORN VIP

///////////////////////////////////////////////////////////////////////////////////////////////
//////////////// PORN VIP
if(($CURUSER["class"]<3) && ($row['category']) == 28){
show_error_msg("Error","you can't see the description of this torrent, it is for vip members.",1);
}
///////////////////////////////////////////////////////////////////////////////////////////////
//////////////// END PORN VIP



$res = SQL_Query_exec("SELECT filename, vip FROM torrents WHERE id = $id");
$arr = mysqli_fetch_assoc($res);
$name = $arr['filename'];
$vip = $arr['vip'];

if ($vip == "yes" && $CURUSER["class"]<3 ){
   show_error_msg("Error","<font color='#ff0000'><b>::: Ce Torrent est pour les membres VIP !!! :::</b></font>",1);
}


2021-10-16 15:11:07
try this it will save you time writing for each cat id  :thumb

$mycats = array(22, 28);
if ($CURUSER['class'] <3 && in_array($row['category'], $mycats)) {
      autolink('index.php', 'Error For VIP');
}
Last edited by M-jay warn on 2021-10-16 18:01:39
2021-10-16 15:15:01
could also be in config.php  :unsure  

$site_config['vip_cats] = array(22, 28);


so it would look like
$mycats = $site_config['vip_cats'];
Last edited by M-jay warn on 2021-10-16 15:15:36
2021-10-16 15:16:36
thank you for your help. can you tell me where I should put this piece of code, thank you in advance  :thumb

$mycats = array(22, 28);
if ($CURUSER['class'] <3 && !in_array($mycats, $mycats)) {
     autolink('index.php', 'Error For VIP');
}
Last edited by niki on 2021-10-16 15:17:18
2021-10-16 15:47:26
thank you i just made the modification but when i put the piece of code in the config.php file i have a white page and the site is not accessible anymore and when i put the piece of code alone in the torrents details.php file all the torrents are for vip?
2021-10-16 15:48:32
Forgot to add categorie row
Updated post see of it works now
2021-10-16 16:01:29
it's the same problem

thank you i just made the modification but when i put the piece of code in the config.php file i have a white page and the site is not accessible anymore and when i put the piece of code alone in the torrents details.php under dbconn(); file all the torrents are for vip ?

:help
2021-10-16 17:18:08
shouldnt $row['category'] be $row['cat_parent'] ? If so, then your original code should work I think
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-10-16 17:19:18
2021-10-16 18:05:43
thanks i just did a test and it doesn't work all torrent categories are for vip members only, member class has no access to torrents  :unsure
2021-10-16 18:20:14
cat_parent is the name the id doesn't seem to be in the query return

got it

in the torrent details
find
$res = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id");
$row = mysqli_fetch_assoc($res);


replace with  = add category to front of $res
$res = SQL_Query_exec("SELECT  torrents.category, torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id");
$row = mysqli_fetch_assoc($res);


then under add
		$mycats = array(22, 28);
if ($CURUSER['class'] < 3 && in_array($row['category'], $mycats)) {
     autolink('index.php', 'Error For VIP');
}
Last edited by M-jay warn on 2021-10-16 18:26:57
2021-10-16 21:30:31
Now it works fine without any problem thanks a lot for the support M-jay and MicroMonkey   :thumb   :grin
2021-10-16 23:04:47
ah, dont thank me, thank m-jay. I was just taking a guess. m-jay knows his stuff. Happy to know its working tho
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-10-17 05:27:37
happy to help - puzzles are fun  :grin

im not sure how your mod works but i still think putting in config is best solution, you can also use in download.php

config.php
$site_config['vip_cats'] = array('22', '28');


then replace in torrentdetails now we added torrents.category, to query
$mycats = $site_config['vip_cats'];
if ($CURUSER['class'] < 3 && in_array($row['category'], $mycats)) {
    autolink('index.php', 'Error For VIP');
}


in download.php add  torrents.category, to query
$res = SQL_Query_exec("SELECT torrents.category, filename, banned, external, announce FROM torrents WHERE id =".intval($id));
$row = mysqli_fetch_assoc($res)


then below
$mycats = $site_config['vip_cats'];
if ($CURUSER['class'] < 3 && in_array($row['category'], $mycats)) {
    autolink('index.php', 'Error For VIP');
}
2021-10-17 08:37:03
hello and good sunday to you all, I just modified and added the code in conf.php and it works very well, we can add the categories in the conf.php file and it's much better like that and a big thank you to M-jay  :thumb   :bigsmile
2021-10-17 08:58:40
for the modification in download.php it also works well so we can add this modification in the category of v3.0 Mods Completed and again a big thanks to M-jay
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 4
  • Members: 0
  • Guests online: 4
  • Comments: 3
  • Messages: 1,728