[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
now fix bug
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)
The plan once fully tested and working is to use dependency injection this should improve performance like this
you can always just call the pdo class as well but i dont like how it looks
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
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
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


