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

theres a few alternatives in pdo for num_rows like rowcount, coloumncount, fetchcoloumn etc reading into this if i can get torrents and torrent-search working its just the admincp left
but i agree we need to stay away from looping through the database
Im not too concerned with the errors i can pick this up pretty easy its just performance but DI should help once im finished
I had a few classes with autoload like that but wanted to be certain everythings working 100% its all set to build on now though
removing all globals is a goal as well like cache this doesnt need to be global just use $cache = new TTcache and place in init and in any function
[color=rgb(250, 197, 28)]Please Do NOT Use On Live Site This Is A Work In Progress[/color]

This is a project ive been working on for the last 3 months converting TT to PDO. [color=rgb(250, 197, 28)]I am hoping for testers i have a live site which members may signup to to help look for bugs[/color].

Its like [color=rgb(250, 197, 28)]97%[/color] done, there maybe some bugs so please report them if you try.

There are two reasons for the bugs.

1) Apostrophes  - These are easily fixed its mainly query's there need changing to prepared statements
                            you can search all files in notepad+ for =? to see examples, this will allow the sqlesc function to be removed prepared statements are already escaped
                            Heres one in the backend function.php on line 182 i fixed - all are straight forward its just finding time now
old line
SQL_Query_exec("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip).", page=".sqlesc($where)." WHERE id=" . $row["id"]);

now fix bug
$stmt = DB::run("UPDATE users SET last_access=?,ip=?,page=? WHERE id=?", [get_date_time(),$ip,$where,$id]);


2) PDO::rowCount -   This replaces the old sqli_num_rows this pdo function is not as universal as the sql function some work and some need to be looked at closer
                                 If where counting rows its probably better to pay attention to be kind to the database

* Due to the length of the admincp file i split it into smaller files and placed them in a admin folder to make it easier for myself (i was sick of continuously having to go through it all lol)
* I have added a bootstrap frame but left the original  theme im planning on removing most of the theme images (ive made a start)
* I added a exception handler with the abilitiy to get a stack back trace this will make it easier for debugging (any exception will show general error page and log error to exception_error.txt this file needs to be watched for size)
* The only thing ive changed from v3 is the updated password the plan is to get the core fully working before adding any thing im just looking at improvements
* ive thrown a quick quide together you can search yoursite/pdointro.php ill do a more detailed one when i find the time
* The old server block does work but throw errors so i replaced that with a simple one this means i could remove the 2 serverload file in backend as well this will be improved

Now for the geeky stuff
Currently i use a public static function so the database can be called anywhere by anything like (this is just for show)
function deleteaccount($userid)
{
   DB::run("DELETE FROM users WHERE id = $userid");
}

The plan once fully tested and working is to use dependency injection this should improve performance like this
function deleteaccount($pdo, $userid)
{
   $pdo->run("DELETE FROM users WHERE id = $userid");
}

you can always just call the pdo class as well but i dont like how it looks
function deleteaccount(, $userid)
{
   $pdo = new pdo
   $pdo->run("DELETE FROM users WHERE id = $userid");
}


Long term im looking to make oop so maybe to remove $CURUSER and replace with a class so the pdo connect would be in the curuser class like below
With true oop we would use something like init.php with autoload and the connecion would be added in any class constructor
class CURUSER {
   protected $db;
   protected $data;
   public function __construct(PDO $db)
   {
       $this->pdo = $db;
   }


Heres the github https://github.com/M-jay84/Torrent-Trader-2020-PDO

I uploaded v3 as well so you can see the changes https://github.com/M-jay84/Torrent-Trader-2020-PDO/compare/v3-original...master?expand=1

Members are welcome to test and report any bugs or post your exception file or post the contents please beawre this is a work in progress and i still need to go through the admin part more which i hope to do this weekend
Any help here or on the github is welcome ive got loads on the go at the minute but want to get the core done first before i start implementing oop
— 2020-01-19 23:22:55 in
not as of yet, still a thing i'm thinking about
demote/promote auto — 2020-01-16 18:16:05 in v3 Support
I had auto promote on my old modded one, did you do force cleanup in admincp
Class one was leeches
[URL unfurl="true"]https://github.com/M-jay84/TTv3/blob/master/upload/backend/functions/cleanup.php[/url]
table torrent index — 2019-12-05 12:02:50 in v3 Support
This is with my edit, but spirtblue is correct each column is problem
table torrent index — 2019-12-04 20:34:16 in v3 Support
i had this issue with bootstrap, try this in theme.css replace .ttable_headinner

.ttable_headinner {
   border-collapse: collapse;
   border: 1px solid #777;
   table-layout: fixed;
   width: 100%;
}


You may need to refresh cache
help vps theme — 2019-12-02 16:16:42 in v3 Support
It looks like a path is wrong, not https so more information might help
1) what is site_tour.php (maybe home page) is that the problem or all pages with it been a issue with header
2) have you made changes to htaccess to redirect users
3) what does removing that script name  code do?, have you made big changes to footer, if not replacing with default header to check would maybe help pinpoint  the issue it's hard to know what edits members have made that could effect things if you still have default theme you can switch to check
4) have you tried server_filename, document root or  maybe something like
If (preg_match('/site_tour.php/i',$_SERVER['PHP_SELF']))
help vps theme — 2019-12-01 08:50:09 in v3 Support
If you have made a header it might be a case it's not formatted correctly
Look at theme files on server is all code  just on one line or does it look correct
That could cause the error and code at top
NFO fix [TTv3] — 2019-11-24 19:44:14 in v3 Mods Completed
It would need a fresh install, on the modded one all the functions have been separated so the paths are different, if you keep the modded you just need to look out for paths by require or include but I'll remove the modded one because I no longer use it
I'm sure this and most other mods were added
its maybe best to add this to config so it can be turned on & off,

Wrap function
// DEBUG Error Report
if ($site_config['SETDEBUG']){
const TT_ERRORS_FILE = 'errors/unknown-errors.txt';
require_once(BACKEND."/errors-helper.php");
set_error_handler('tt_error_handler');
}


in config
$site_config['SETDEBUG'] = true;
Taken from github
Heres a tool for logging errors, in testing i used to use this to assist
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);


This can make it look bad TT has loads of errors caused by undefined vars, indexs etc and the above code should never be used on a live site anyway.

So here is a way to log these to a file on live site, if members use this please can you share any fixed errors

in backend/functions find
require_once(BACKEND."/languages.php");


add below
// DEBUG Error Report
const TT_ERRORS_FILE = 'errors/unknown-errors.txt';
require_once(BACKEND."/errors-helper.php");
set_error_handler('tt_error_handler');


Add error folder to root & make unknown error txt to cmod 777
Add error helper to backend folder
Bootstrap Theme - Starter — 2019-11-24 08:09:53 in v3 Support
[color=rgb(250, 197, 28)]Please Read before using this is not finished, this replaces the default v3 theme with a bootstrap theme[/color]
 
This will overwrite the default theme so you may want to backup first if you made any edits

Thought i would share my starting point for bootstrap, to make life easy we use the default theme so everything works and we have css.
Ideally the images would be replace with bootstrap images but this means changing various root php files and to make it true bootstrap we would use containers and update the login page, the tables etc so editing the root php files
So only the header & footer are the main changes this gives us a bootstrap theme and ill keep going back to it when im bored lol, this will allow others to mess with it and try bootstrap
This is bootstrap 4.3 you can look through header, its fully responsive but there might be a few errors from the old css, so any things please let me know but some things will be theme related and some will be root php file related

Looking for others to test

Bug
Its a 3 column layout you can NOT disable left & right blocks, it breaks the layout
This also breaks it
$site_config["LEFTNAV"] = $site_config["MIDDLENAV"] = $site_config["RIGHTNAV"] = false;


What i did is wrap the block file code with curuser to hide from guest
<?php
if ($CURUSER) {
   // example_block.php code
}
?>







Do you have snatchlist mod and your snatched table like this
[URL unfurl="true"]https://www.torrenttrader.xyz/index.php?threads/anti-hit-run-ttv3.9830/[/url]
Post your torrent-upload.php and a pic of qbit like the one above and I'll take a look
Are you deleting the torrent on qbit ?
Once you create and upload a torrent, download the torrent from your site then delete it in qbit before running the downloaded file, sometimes the tracker is not re added with the passkey, let's rule that out first

what does qbit look like
Looking at the config picture it looks like capital s is missing
$site_config[SITEURL]/announce.php?passkey=%s
On qbit at the bottom if you click on the torrent is the pass key on the tracker
I use modded on my live site but I will be switching to pdo this weekend for the last few tests.
Updating from any torrenttrader version to a new one is the same and pretty straightforward its just a matter of recording any changes to the database and the next one I post will have a update script
You can remove the edits on torrent-upload.php and keep the mod or remove all if you wish, heres the mod
[URL unfurl="true"]https://www.torrenttrader.xyz/index.php?threads/vip-only-torrents-ttv3.9882/#post-67361[/url]

In the next release all mods will be able to be turned on and off  in config.php and most will be in a  seperete folder so wont be part of the main code
It looks like php display errors is turn on since updating to php7 only the queries have been updated kindly by micromonkey turn error displays off on server or ini file and that will fix that.
But please beware I no longer use my modded version so support will be limited it will soon be replaced by my new pdo/oop version by the end off the month with prepared statements.

@[color=rgb(65, 168, 95)]serph[/color]
With your converted 2.08 have you got error display on - a few files on my pdo version need looking at, like the forum for a few undefined vars and indexes
thank you for pointing that out ive changed to admincp in the post, i have a few control panels
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728