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
Nothing found.

Go to Profile

i just need to add a router now so i can move all the root files to a app folder and run everything through index.php. Ive got it fully working but im going to leave it is for now unless someone has a simple way.

Ive moved everything except the root and this is the structure and the config side

config. php this is a a array thats global (we dont call global though)

$GLOBALS['config'] = array(
   'mysql' => array(
'mysql_host' => 'localhost', //leave this as localhost if you are unsure
'mysql_user' => "name", //Username to connect
'mysql_pass' => "pass", //Password to connect
'mysql_db' => "name",  //Database name
'ttversion' => '3.0',                            //DONT CHANGE THIS!

// Main Site Settings
'SITENAME' => 'TorrentTrader',                //Site Name
'SITEEMAIL' => 'change@myemailsux.com',        //Emails will be sent from this address


called anywhere with Config.Class.php (its a static)
class Config
{
   public static function get($path = null)
   {
       if ($path) {
           $config = $GLOBALS['config'];
           $path = explode('/', $path);
           foreach ($path as $bit) {
               if (isset($config[$bit])) {
                   $config = $config[$bit];
               }
           }
           return $config;
       }
       return $false;
   }
}


And then the init.php
define("BACKEND", dirname(__FILE__));
$BACKEND = BACKEND;

include("/ttcore/helpers/exceptionhelper.php");
// Register custom exception handler
set_exception_handler("handleUncaughtException");

require_once("/config/config.php");
require_once("/ttcore/database/dbclass.php"); //Get MYSQL Connection Info
require_once("/ttcore/libraries/Config.Class.php");  //Get Site Settings and Vars ($site_config)
require_once("/ttcore/libraries/cache.php"); // Caching
require_once("/ttcore/libraries/mail.php"); // Mail functions


config called like
$this->cachedir = Config::get('mysql/cache_dir');


And ive attached how my test site is running currently just need to move all root files like memberlist.php but now everythings working i might leave that for time been
did a quick test with a static class but had a issue with dirs been called although i could put them in a file for defined paths, i think ill go with a init.php with a array then a config class that calls it
im about to share my finished base so any help is welcome :D
I'll have a look do you have a fix m8
Been thinking of replacing config as well and putting it in a class what do you think this means mysql.php can be removed

So config.php now
$site_config = array();
$site_config['ttversion'] = '3.0'

Used like
$site_config['ttversion']


Would be a static class to remove global var
class config {
static ttversion = '3.0'

Used like
config::ttversion


Then settings and database details and the database itself can be called on a init.php/autoloader or in the future in a tt_framework class
Tt_framework::init which would include
Files, defined paths and autoload all classes
— 2020-02-13 08:25:14 in
At the end of weekend I'll be ready for my pdo final release which I'll share on there when your ready.
Finally got all the bugs out just need to tidy and format the code.
Is the site public you can always use captacha for bots then you can make it easier for search engines
I'll test :D I'll add the mod to my test site
which other files do you use for scrape, scraper and maybe a class in backend, never allowed external torrents but ill give this a test (y)
this is a current work in progress for megascrape so you know what files people have https://www.torrenttrader.xyz/index.php?threads/scrape-udp-trackers.9795/
theres a sql function in there (mysql_fetch_array) for v3 needs to be sqli
color thanks — 2020-02-09 16:07:24 in v3 Support
try with this
    //START THANKS\\\\

$thanksl = explode(",", $row['thanks']);
if class_user($CURUSER["username"] == class_user($row["username"]) {
$leftthanks = true;
$leftthanks2 = true;
} else {
foreach ($thanksl as $u) {
$thanks .= ($i > 0) ? ", $u" : $u;
if ($u == class_user($CURUSER["username"]) {
$leftthanks2 = true;
$leftthanks = true;
}
$i++;
}
}

if (!$leftthanks2) {
$button='<br/><input type="button" value="Dire merci" id="refresh">';
} else {
$button='';
}
echo '<tr><td align="left"><b>Thanks by : </b></td><td><div id="thankput"></div>'.$button.'
<script type="text/javascript" src="'.$site_config["SITEURL"].'/js/thanks.js"></script>

<script type="text/javascript">
var $s = jQuery.noConflict();

$s("#thankput").load("thanks.php?id='.$id.'");
$s(function() {
$s("#refresh").click(function() {
$s("#thankput").empty().html(\'<center><img src="'.$site_config["SITEURL"].'/images/ajax-loader.gif"></center>\');

$s("#thankput").load("thanks.php?id='.$id.'&to=give&torrent='.$id.'")
return false;
})
})
</script></td></tr><br/>';

////END THANKS\\\\\
ive done basic on v3 to make it easier, you can just add to see if its working
At the minute i have 2 js in accountdetails/torrentdetails i will move these to js file later for header and have many functions
showaccount(), showadmin() & showtorrents() so one js takes care of all sections I'm going to do admincp as well  i dont have v3 to compare at m8nute

i update github with just these files for guidance all sections are noted with // start id & // end id etc.  i removed some of the frames i still need to protect buttons like edit users / edit torrents
https://github.com/M-jay84/Torrent-Trader-2020-PDO/commit/64a0bfa5e30105bb8b66d9de45e9cfd4fff18a4f

in theme.css
/* -- jquery hide --*/
.hide{
   display:none;
}

.block{
   width: 100px;
   height:50px;
   background-color:#cccccc;
   text-align:center;
   line-height:50px;
}


under first beginframe in accountdetails/torrentdetails
?>
<script type="text/javascript">
function show(elementId) {
document.getElementById("id1").style.display="none";
document.getElementById("id2").style.display="none";
document.getElementById("id3").style.display="none";
document.getElementById("id4").style.display="none";
document.getElementById("id5").style.display="none";
document.getElementById("id6").style.display="none";
document.getElementById("id7").style.display="none";
document.getElementById(elementId).style.display="block";
}
</script>

<button type="button" onclick="show('id1');">DETAILS</button>
<button type="button" onclick="show('id2');">RATING</button>
<button type="button" onclick="show('id3');">IMAGES</button>
<button type="button" onclick="show('id4');">FILES</button>
<button type="button" onclick="show('id5');">PEERLIST</button>
<button type="button" onclick="show('id6');">NFO</button>
<button type="button" onclick="show('id7');">COMMENTS</button>
<?php


Wrap any section (remember to change id)
// start id7
echo "<div id=id7  style=display:none>";

// the code for first div id1 set to
//  style=display:block

echo "</div>";
//end id7
The theme is pretty big, some of the bootstrap could be done with css but I'll keep playing with it I really like the design but it needs some work, I've added it to test site botanicar
unfortunately it can not be added to config due to jquery and the div ids, heres the basic account-details - some css and this will look nice, im bad at styling though lol  :unsure:  buttons or navbar ?

Thank you spirtblue, I got the idea off a old updated torrents-details.php i got from botanicar.
I will do account-details this weekend and share for anyone who wishes to use (y)
ill update my github this weekend ive done most of the prepared statements and started removing the sqlesc function (pdo already escapes) just playing with styling at the minute.
I tried adding the new dbclass but blocks caused a issue so ill stick to the static one for now until i move functions to classes DB::instance() can always be added to constructor so functions move away from procedural
here is a example of my torrents-detail.php at the minute its all coded on one page but for oop would it be better to have these broken down into details.php, comments.php, nfo.php etc or does anyone have suggestion on how to do it with classes and views ?

[color=rgb(250, 197, 28)]example[/color]
<button type="button" onclick="show('id1');">DETAILS</button>
<button type="button" onclick="show('id6');">NFO</button>
<button type="button" onclick="show('id7');">COMMENTS</button>

echo "<div id=id1  style=display:block>"; // start id1
[color=rgb(250, 197, 28)]mainstuff[/color]
echo "</div>";    

echo "<div id=id6  style=display:none>";
[color=rgb(250, 197, 28)]nfo[/color]
echo "</div>";

echo "<div id=id7  style=display:none>";
[color=rgb(250, 197, 28)]comments[/color]
echo "</div>";


Update Smilies — 2020-02-02 17:42:24 in v3 Mods Completed
Updated the smilies on mine so thought i would share if anyone wants them (smilies from here thanks to DarkMaster)

In /backend/bbcode.php add above </table>
      <tr>
         <td width="26"><a href="javascript:SmileIT(':gigg','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/giggle.png" border="0" alt=':|' title=':|' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':rofl','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/roflamo.png" border="0" alt='O:-D' title='0:-D' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':slep','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/sleep.png" border="0" alt=':-@' title=':-@' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':thum','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/thumbsup.png" border="0" alt=':o)' title=':o)' /></a></td>
     </tr>
     <tr>
         <td width="26"><a href="javascript:SmileIT(':0_0','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/zpo.png" border="0" alt=':|' title=':|' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':poop','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/poop.png" border="0" alt='O:-D' title='0:-D' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':spechles','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/speechless.png" border="0" alt=':-@' title=':-@' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':unsure','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/unsure.png" border="0" alt=':o)' title=':o)' /></a></td>
     </tr>
     <tr>
         <td width="26"><a href="javascript:SmileIT(':mad','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/mad.png" border="0" alt=':|' title=':|' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':roll','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/rolleyes.png" border="0" alt='O:-D' title='0:-D' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':sick','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/sick.png" border="0" alt=':-@' title=':-@' /></a></td>
     </tr>
           <tr>
         <td width="26"><a href="javascript:SmileIT(':crylol','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/crylaugh.png" border="0" alt=':|' title=':|' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':confos','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/confound.png" border="0" alt='O:-D' title='0:-D' /></a></td>
         <td width="26"><a href="javascript:SmileIT(':fire','<?php echo $form; ?>','<?php echo $name; ?>')"><img src="images/smilies/fire.png" border="0" alt=':-@' title=':-@' /></a></td>
     </tr>


In backend/smilies.php add after "brb.png",
   ":gigg" => "giggle.png",
  ":rofl"  => "roflmao.png",
  ":slep"    => "sleep.png",
  ":thum"   => "thumbsup.png",
  ":0_0" => "zpo.png",
  ":poop"  => "poop.png",
  ":spechles"    => "speechless.png",
  ":unsure"   => "unsure.png",
  ":mad"  => "mad.png",
  ":roll"    => "rolleyes.png",
  ":sick"   => "sick.png",
  ":crylol"  => "crylaugh.png",
  ":confos"    => "confound.png",
  ":fire"   => "fire.png",


Add smilies to folder images/smilies

[ATTACH type="full" alt="5355"]5355[/ATTACH]
Thank you [USER=20382]@STorrents2020[/USER]   i dont suppose you would mind messaging me with your forum.php & the forum admin section not the full admincp. I have two last bugs with viewforum and staff panel minclassread if you use prepared statements might point me in right direction.
[USER=20311]@shadows[/USER]    i had a look at using that pdo class in one of the first posts im going to change to that at the weekend should be straight forward just wanted to mess with dependency injection  heres example you can upload to your site its just the check.php (line 261)
As we move to classes the functions connection parameter will be in class constructor
Nice code m8 , Do all your files have the db details or have you defined them like constants
At first I thought the functions might be from a new database class but there oop so it should work no problem
Nice work on the prepared statements as well  (y)
Did some more prepared statements this morning but got bored :sleep:, on the plus side I think I got all the errors that I know of and finished the admincp [color=rgb(250, 197, 28)]I've update github.[/color]
It's just the admin sql log this is because pdo prepares then executes or throws exception theres nothing in between
the reason i was leaning towards sessions was you can then add a roles class & permission class based on a session group id which i have also played around with lol but one step at a time ill get those statements finished this weekend theres only about 300 left lol
ive played around with the login the cookies caused a bit off a headache if i remember correctly i had something roughly like this

$ip = new ip
$cookie = new cookie   // this should be session really
$curuser = new curuser

function login($ip, $cookie, $curuser){
$ip = get ip ();
$ip = iptype ();
something like your code
$cookie = set();
$curuser(id);

but my concern was thinking something was broken when actually it was the conversion which is why i reverted back to just the core, i have a habit of not finishing projects off so wanted to get this fully done i might put off doing the rest of the admincp and concentrate on the prepared statements the admin panel does not interact with anything else the rest seems to be more or less working 100% its just the apostrophe issue with query's i mentioned in first post
look at the scrape.php that has a normal pdo connection like you suggest not in a class though  but it was so hard with the spaghetti code a static was quick but we can make that class, check.php is independent as well but i injected the dbclass to make it easier
and then mass edit all db::run any function that uses db will need class declaring or injecting into parameters
for the user class if you look at the user login function thats where global curuser is defined so its just putting that query in place of find in the example you posted
ps i fixed torrent search and torrents now just the admincp but i think ive got most of that updating github now with them two files
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