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
User Posts

Go to Profile

a look at the imdb controller with new class fully automated and bootstrap dont mind the double details on panel thats there for design trying to get it as compact as possible
desktop and mobile view
making my way through all html, fine tuning controllers - here is a look at the friends controller in bootstrap, tablet and mobile view
— 2020-12-14 12:32:47 in
added for others - for v3 include the token class in backend/functions.php

then on account login form

<input type="hidden" name="token" value="<?php echo Token::generate(); ?>" />


then on account login above post request

       if (Token::check($_SESSION['token']) == false) {
           show_error_msg("Error", "Please try again.");
       }


class for v3

<?php
class Token
{
   public function __construct() { }
   private function __clone() { }

   public static function generate()
   {
       return $_Session["token"] = sha1(time());
   }

   public static function check($token)
   {
        // check the crsf token
       if ($token === $_Session["token"] ) {
           // then destroy it
            $_Session["token"] = null;
           return true;
       }
       return false;
   }
}

added note to first post  the code has changed a lot so github is far behind until next month ,
and a quick look at the admin side the admincp will preferably go everything will be split like the adduser section this will end up on profile controller inline

the controller methods (the query should be in the model)
    public function adduser()
   {
       if ($_SESSION["class"] < "7") {
           show_error_msg("Error", "Sorry you do not have the rights to view this page!", 1);
       }
       $data = [];
       $this->view('admin/adduser', $data);
   }

   public function addeduserok()
   {
       if ($_SERVER["REQUEST_METHOD"] == "POST") {
           if ($_POST["username"] == "" || $_POST["password"] == "" || $_POST["email"] == "") {
               show_error_msg("Error", "Missing form data.");
           }
           if ($_POST["password"] != $_POST["password2"]) {
               show_error_msg("Error", "Passwords mismatch.");
           }
           $username = $_POST["username"];
           $password = $_POST["password"];
           $email = $_POST["email"];
           $secret = mksecret();
           $passhash = md5($password);
           $secret = $secret;
           $count = get_row_count("users", "WHERE username=$username");
           if (!$count !=0) {
           show_error_msg("Error", "Unable to create the account. The user name is possibly already taken.");
           Redirect::to(URLROOT . "/admincp");
           die;
           }
           DB::run("INSERT INTO users (added, last_access, secret, username, password, status, email) VALUES (?,?,?,?,?,?,?)", [get_date_time(), get_date_time(), $secret, $username, $passhash, 'confirmed', $email]);
           Redirect::autolink(URLROOT . "/admincp", Lang::T("COMPLETE"));
       }
   }


the template (bootstrap)

<?php
Style::adminheader("Add User");
Admincp::adminnavmenu1();
Style::begin("Add User");
?>
   <center><b>Add user</b></center>
   <div class="form-group">
   <form method=get action=?>
   <input type=hidden name=action value=users>
   Search Users: <input type=text size=30 name=search>
   <input type=submit value='Search'>
   </form>
   <form method=post action='<?php echo URLROOT; ?>/admincp/addeduserok'>
   <div class="form-group">
       <label for="name">Username</label>
       <input id="name" type="text" class="form-control" name="username" minlength="3" maxlength="25" required autofocus>
   </div>
   <div class="form-group">
       <label for="name">Password</label>
       <input id="name" type="text" class="form-control" name="password" minlength="3" maxlength="25" required autofocus>
   </div>
   <div class="form-group">
       <label for="name">Re-type password</label>
       <input id="name" type="text" class="form-control" name="password2" minlength="3" maxlength="25" required autofocus>
   </div>
   <div class="form-group">
       <label for="name">E-mail</label>
       <input id="name" type="text" class="form-control" name="email" minlength="3" maxlength="25" required autofocus>
   </div>
   <div class="form-group">
   <div class="form-group no-margin">
       <button type="submit" class="btn btn-primary btn-block">Okay</button>
   </div>
   </form>
   </div>
   </div>
<?php
Style::end();
Style::adminfooter();



image is from mobile device
— 2020-12-14 08:04:43 in
Going through admincp at minute and also think i might add another hash this can be set in config.php

something like - lets let admin use there own

$config['myadminhash'] = 'hcudhcuerichiercherichei', // can be anything can be reset here anytime


then use the check if

$_SESSION['class'] > 5 || $_SESSION["control_panel"] != "yes" || $_SESSION['private' != $config['myadminhash']


here is another thing i already use for auth class (the old dbconn function)

if (strlen($_COOKIE["password"]) != 60 || !is_numeric($_COOKIE["id"]) || $_COOKIE["login_fingerprint"] != self::loginString()) {


if the ip and browser cookie dont match it must of been stolen

   private static function loginString()
   {
       $ip = Helper::getIP();
       $browser = Helper::browser();
       return hash("sha512", $ip, $browser);
   }
— 2020-12-12 22:40:44 in
destroying the session isnt overly important because it gets reset its a bit easier for me because all my submit forms have the own controller method (page) for old v3 submit code is on login.php etc but worth deleting session where possible
— 2020-12-12 22:33:30 in
you dont need to store the token session, save db a little bit because ideally it should refresh every page thats why we use session its instant just check your deleting the session after the check (or destroy() it)
— 2020-12-12 21:38:46 in
Be careful using array key exsist here it might return true if value  is null just a case of trail and error. Just keep it simple renaming functions to fit your code
— 2020-12-12 20:50:22 in
There is a header function in function stdhead or dbconn
Add this above
header("X-XSS-Protection: 1; mode=block");


Worth checking if you have this in your code theres a few header functions dont know them all some become redundant as browsers update
header("Content-Type
— 2020-12-12 17:39:27 in
This may help with some vulnerability's that i have for my pdo one my base is a lot different but gives you a good idea - how i set sessions is different
<?php

class Token
{
   public function __construct() { }

   private function __clone() { }

   public static function generate()
   {
       return Session::set("token", sha1(time()));
   }

   public static function check($token)
   {
       $tokenNome = "token";

       if (Session::get($tokenNome) && $token === Session::get($tokenNome)) {
           Session::destroy($tokenNome);
           return true;
       }
       return false;
   }

}


then at top of any input page
Token::generate();


then on top of html form
<input type="hidden" name="token" value="<?php echo isset($this->token) ? $this->token : $this->token; ?>" />


secondly on login create a session counter on failed login attempts which keeps adding 1 triesLogin()
cant write this for any other version so just the idea behind it
    function bruteForce()
   {
       return loginTries() > 5 ? true : false;
   }

   function triesLogin()
   {
       $logins = loginTries();

       // insert count to db
       if ($logins > 0) {
           $this->db->update('bruteforces', ["alltimes" => $logins + 1], "`ip` = ? AND `alldate` = ?", [getip(), NOW()]);
       } else {
           $this->db->insert('bruteforces', ["ip" => getip(), "alldate" => NOW()]);
       }
}
       loginTries()
       {
            $query = $this->db->select1("SELECT `alltimes` FROM `bruteforces` WHERE `ip` = ? AND `alldate` = ?", [getip(), NOW()]);
            return count($query) == 0 ? 0 : $query->alltimes;
        }

   


this would stop any one trying to force their way on the site by using db to ban the ip not perfect but is another line of defence, instead of letting a program run there would have to stop and change ip everytime


CREATE TABLE IF NOT EXISTS `bruteforces` (
 `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
 `ip` varchar(70) NOT NULL,
 `alltimes` int(10) UNSIGNED NOT NULL DEFAULT 1,
 `alldate` date NOT NULL DEFAULT '0000-00-00',
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Is this file in the cache folder might help locate the problem niki
activetransfers_block.cache

You can always try the query at top of index.php to test results are coming through I would of thought it would throw a error if not
$res = SQL_Query_exec("SELECT (SUM(peers.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(peers.started)) AS speed, peers.seeder, peers.id, peers.connectable, users.id, peers.started, torrents.id AS torrentid, torrents.name, torrents.size, peers.to_go FROM peers LEFT JOIN torrents ON torrents.id = peers.id LEFT JOIN users ON peers.id = users.id WHERE peers.id = $CURUSER[id] AND peers.seeder = 'no' GROUP BY peers.started DESC LIMIT 6");
       while ($row = mysqli_fetch_assoc($res)) {
           $rows = $row;
           if (array_key_exists('torrentid', $row)) {
               echo 'something happened';
           } else {
               echo T_("NO_ACTIVE_TRANSFERS");
           }
       }
heres a quick test i did on pdo that works fine on xampp but live server is not having non of it
controllers/Test.php
<?php
class Test extends Controller
{

   public function __construct()
   {
       $this->db = new Database;
   }

   public function index()
   {
       dbconn();
       try {
           $timeout = 12;
           $scraper = new Udptscraper($timeout);
           $ret = $scraper->scrape('udp://9.rarbg.to:2890/announce', '546d6aed41217195ed2c82e9c561b7badbd6b590');
           foreach ($ret as $array) {
               $keys = array_keys( $array);
               echo $array[ $keys[0] ].'&nbsp;seeders<br>';
               echo $array[ $keys[1] ].'&nbsp;completed<br>';
               echo $array[ $keys[2] ].'&nbsp;leechers<br>';
           }
       } catch (ScraperException $e) {
           echo ('Error: ' . $e->getMessage() . "<br />\n");
           echo ('Connection error: ' . ($e->isConnectionError() ? 'yes' : 'no') . "<br />\n");
       }
   }

}


had to use array keys for test setting value in foreach broke it for some strange reason
this is external so should work without edit, servers not having none of it, everything i try works on xampp
ive updated first post you can try copy the files to test, my copy is a lot more in front of the github
i have added debug to the class so it should show any errors
in the controller line 18 change id from 8 to any torrent id with imdb link in database
this shows everything so is very long page just search yousiteurl/testimdb
Poster from iMDB — 2020-11-30 08:25:01 in M-BiTsy Support
My new imdb class adds poster and trailer by embedding them so you dont need to add to server, re-written most of code and the next release will have this sometime in January
finished this ill type up in morning should be able to change language to any and it will do games, shows etc
Just style left but that will be different for each user things like health, seeders etc not sure where to put it all with bootstrap lol

Automatically adds trailer  ?
Error upload torrent — 2020-11-27 13:36:32 in M-BiTsy Support
Thanks for sharing [USER=20382]@STorrents2020[/USER]  I'll have a play with that at some point, got the input logic separated for upload just need to go through it
For the scraper from what I've seen there is only two possible options the current one and the scrapeer class. I've got the current one running perfect on 2 out of 3 servers so its just pinpointing the server issue
Might be worth asking the host if you can do a support ticket there and I'll contact my host and ask them as well something is preventing it from scraping externally - its defo not allow_url_fopen
Error upload torrent — 2020-11-26 18:34:53 in M-BiTsy Support
"Botanicar, post: 69627, member: 19833":

in torrent description I have [color=rgb(255, 0, 0)]=[/color] character


Maybe someone else can see if they have this problem on upload
Error upload torrent — 2020-11-26 16:37:39 in M-BiTsy Support
description $desc = $_POST[desc] is just a form  input it, i can not recreate error - that error implies the file has not been read correctly public is a class method for a syntac error the controller would not load at all
unexpected 'public' (T_PUBLIC) in file /home/tt-m-jay/public_html/controllers/Torrents.php on line 752

im on php  7.4.11
i am updating the controllers so will investigate further, my next release a lot changes (not theme though) so if you follow project please keep note of any changes to any files except themes/dir
Error upload torrent — 2020-11-25 20:54:02 in M-BiTsy Support
Make sure the error log txt files are empty find this line on controller/torrent
try {
               $ret = DB::run("INSERT INTO torrents (filename, owner, name, vip, descr, image1, image2, category, tube, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action, freeleech, imdb)
                   VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                   [$fname, $_SESSION['id'], $name, $vip, $descr, $inames[0], $inames[1], $catid, $tube, get_date_time(), $infohash, $torrentsize, $filecounts, $fname, $announce, $external, $nfo, $langid, $anon, get_date_time(), $free, $imdb]);
               } catch (PDOException $e) {
               rename("$torrent_dir/$fname", "$torrent_dir/duplicate.torrent"); // todo
               autolink(TTURL . '/index.php', 'Torrent already added. Duplicate Hash');
           }
           $id = DB::lastInsertId();


Replace with


               $ret = DB::run("INSERT INTO torrents (filename, owner, name, vip, descr, image1, image2, category, tube, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action, freeleech, imdb)
                   VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                   [$fname, $_SESSION['id'], $name, $vip, $descr, $inames[0], $inames[1], $catid, $tube, get_date_time(), $infohash, $torrentsize, $filecounts, $fname, $announce, $external, $nfo, $langid, $anon, get_date_time(), $free, $imdb]);
             
           $id = DB::lastInsertId();


Then check error log file, I am looking at ways to add back to database so these can be read in admin panel. Exceptions are a little more complicated
Template help — 2020-11-22 18:08:26 in M-BiTsy Support
If we put all these new querys in a class (a bit like a model) and make them static should be able to use on any version for testing when I get chance tomorrow llI open a new post just want to find some good examples first
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: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728