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
Connected, yes or no!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / M-BiTsy / M-BiTsy Support

2020-07-10 20:23:04
Ok, I have got the following code in the old site, which shows a connected member how many torrents seeding and how many leeching plus the info if connectable or not.
Connectable meaning if all his running torrents match peers in the peers table.

The current code is as follows, but I do believe this with current standard can be simplified.

//////connectable yes or know////////
   
   if ($CURUSER["view_torrents"]=="yes") {
       $res2 = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" . $CURUSER["id"] . " AND seeder='yes'") or print(mysql_error());
       $row = mysql_fetch_row($res2);

       $activeseed = $row[0];

       $res2 = mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" . $CURUSER["id"] . " AND seeder='no'") or print(mysql_error());

           $row = mysql_fetch_row($res2);

           $activeleech = $row[0];

       $res3 = mysql_query("SELECT connectable FROM peers WHERE userid=" . sqlesc($CURUSER["id"]) . " LIMIT 1") or print(mysql_error());

           if($row = mysql_fetch_row($res3)){

       $connect = $row[0];

           if($connect == "yes"){

       $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"#00FF00\">YES</font></b>";

       }else{

       $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"FFCCFF\">NO</font></b>";

       }

       }else{

       $connectable ="<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"99CCFF\">Check Settings</font></b>";

       }              
}

print("&nbsp;(<font color=#C0C0C0><i>Seeding:</i></font> <a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/seeding.php?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");

print("<font color=#C0C0C0><i>Leeching:</i> </font><a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/leeching.php?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");

print("<font color=#C0C0C0><i>Connected:</i></font> ".$connectable.")");

//////connectable yes or know end of mod////////  
               


I am attaching my current topnavbar.php for reference
topnavbar.rar
Download

If It Ain't Dutch, It Ain't Much!!
2020-07-10 21:36:57
That can be about 6-7 lines if I’m correct, and that query work can be LEFT JOINED in one line, binding all of it together with AS and such.

What are you looking for, mysqli or PDO?
2020-07-11 06:28:10
"STorrents2020, post: 68806, member: 20382":

That can be about 6-7 lines if I’m correct, and that query work can be LEFT JOINED in one line, binding all of it together with AS and such.

What are you looking for, mysqli or PDO?

Pdo
If It Ain't Dutch, It Ain't Much!!
2020-07-11 06:44:09
I do everything by binded prepared statements, just my pref. I’ll do it over in morning
2020-07-11 06:44:39
that can be halved in pdo  (y) whats on leeching/seeding.php
2020-08-02 14:00:37
Here you go mate, managed to slim it slightly i just place on home to test

//////connectable yes or know////////
if ($CURUSER["view_torrents"]=="yes") {
   $activeseed = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'yes'");
   $activeleech = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'no'");
   $stmt = DB::run("SELECT connectable FROM peers WHERE userid=" . $CURUSER["id"] . " LIMIT 1");
   $connect = $stmt->fetchColumn();
   if($connect == 'yes') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"#00FF00\">YES</font></b>";
   } elseif($connect == 'no') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"FFCCFF\">NO</font></b>";
   } else {
       $connectable ="<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"99CCFF\">Check Settings</font></b>";
  }    
}

print("&nbsp;(<font color=#C0C0C0><i>Seeding:</i></font> <a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/seeding.php?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Leeching:</i> </font><a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/leeching.php?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Connected:</i></font> ".$connectable.")");
//////connectable yes or know end of mod////////


Whats this ?   - $site_config["SITEURL"]. "/leeching.php?id=" . $CURUSER["id"] and the seeding.php one might be useful  :D

will be moving a lot of things around got 3 controllers left before i add all classes keep a note of any edits
if you use this will you post, if you post your recent theme ill check against mine
2020-08-02 17:04:37
"m-jay, post: 68902, member: 20288":

Here you go mate, managed to slim it slightly i just place on home to test

//////connectable yes or know////////
if ($CURUSER["view_torrents"]=="yes") {
   $activeseed = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'yes'");
   $activeleech = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'no'");
   $stmt = DB::run("SELECT connectable FROM peers WHERE userid=" . $CURUSER["id"] . " LIMIT 1");
   $connect = $stmt->fetchColumn();
   if($connect == 'yes') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"#00FF00\">YES</font></b>";
   } elseif($connect == 'no') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"FFCCFF\">NO</font></b>";
   } else {
       $connectable ="<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"99CCFF\">Check Settings</font></b>";
  }  
}

print("&nbsp;(<font color=#C0C0C0><i>Seeding:</i></font> <a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/seeding.php?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Leeching:</i> </font><a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/leeching.php?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Connected:</i></font> ".$connectable.")");
//////connectable yes or know end of mod////////


Whats this ?   - $site_config["SITEURL"]. "/leeching.php?id=" . $CURUSER["id"] and the seeding.php one might be useful  :D

will be moving a lot of things around got 3 controllers left before i add all classes keep a note of any edits
if you use this will you post, if you post your recent theme ill check against mine


[ATTACH type="full"]5666[/ATTACH]

Here are the seeding and leeching files.
Connectable Options.zip
Download
1596388039621.png
1596388039621.png

If It Ain't Dutch, It Ain't Much!!
2020-08-02 20:45:18
had a issue with the torrent table looks like a mod (torrent team), had to remove that but apart from that seems to be working  :D

just add peers controller then update code below

//////connectable yes or know////////
if ($CURUSER["view_torrents"]=="yes") {
   $activeseed = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'yes'");
   $activeleech = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'no'");
   $stmt = DB::run("SELECT connectable FROM peers WHERE userid=" . $CURUSER["id"] . " LIMIT 1");
   $connect = $stmt->fetchColumn();
   if($connect == 'yes') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"#00FF00\">YES</font></b>";
   } elseif($connect == 'no') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"FFCCFF\">NO</font></b>";
   } else {
       $connectable ="<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"99CCFF\">Check Settings</font></b>";
  }  
}

print("&nbsp;(<font color=#C0C0C0><i>Seeding:</i></font> <a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/seeding1?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Leeching:</i> </font><a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/leeching?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Connected:</i></font> ".$connectable.")");
//////connectable yes or know end of mod////////
Untitled.png
Untitled.png
Peers.zip
Download
2020-08-02 20:55:05
I like that ratio field, something I forgot
2020-08-04 17:51:55
"m-jay, post: 68910, member: 20288":

had a issue with the torrent table looks like a mod (torrent team), had to remove that but apart from that seems to be working  :D

just add peers controller then update code below

//////connectable yes or know////////
if ($CURUSER["view_torrents"]=="yes") {
   $activeseed = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'yes'");
   $activeleech = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'no'");
   $stmt = DB::run("SELECT connectable FROM peers WHERE userid=" . $CURUSER["id"] . " LIMIT 1");
   $connect = $stmt->fetchColumn();
   if($connect == 'yes') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"#00FF00\">YES</font></b>";
   } elseif($connect == 'no') {
   $connectable = "<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"FFCCFF\">NO</font></b>";
   } else {
       $connectable ="<b><font face=\"Verdana\" style=\"font-size: 10px\" color=\"99CCFF\">Check Settings</font></b>";
  }
}

print("&nbsp;(<font color=#C0C0C0><i>Seeding:</i></font> <a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/seeding1?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Leeching:</i> </font><a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/leeching?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\"><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");
print("<font color=#C0C0C0><i>Connected:</i></font> ".$connectable.")");
//////connectable yes or know end of mod////////



Implemented and working without error.
Did clean up the fonts a bit and it now looks like this on my site >>
                    //////connectable yes or know////////
                   if ($CURUSER["view_torrents"]=="yes") {
                       $activeseed = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'yes'");
                       $activeleech = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'no'");
                       $stmt = DB::run("SELECT connectable FROM peers WHERE userid=" . $CURUSER["id"] . " LIMIT 1");
                       $connect = $stmt->fetchColumn();
                       if($connect == 'yes') {
                       $connectable = "<b><font color=\"#00FF00\">YES</font></b>";
                       } elseif($connect == 'no') {
                       $connectable = "<b><font color=\"FFCCFF\">NO</font></b>";
                       } else {
                           $connectable ="<b><font color=\"99CCFF\">Check Settings</font></b>";
                      }
                   }

                   print("&nbsp;(&nbsp;Seeding:&nbsp;<a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/seeding1?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\" title='You are Seeding'><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");
                   print("Leeching:&nbsp;<a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/leeching?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\" title='You are Leeching'><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");
                   print("Connected:&nbsp;".$connectable."&nbsp;)");
                   //////connectable yes or know end of mod////////


Will look at the correct bootstrap classes to use at later moment.
If It Ain't Dutch, It Ain't Much!!
2020-08-04 22:21:38
great work on the navbar ?(y) ive added to base, because ive moved a lot around i re-did all the links so if you update everything is ready
i removed the social media & radio links but everything else is there if you send me links to missing mods contact/friend/request ill add them

just updated github if you wish to try newest one save old files first

to update sql
ALTER TABLE `shoutbox` ADD `staff` tinyint( 3 ) unsigned NOT NULL default '0';


in config.php
// FORUM POST ON INDEX
$site_config['FORUMONINDEX'] = true;


transfer and rewrite all files except config.php [color=rgb(247, 218, 100)](for live servers)[/color]
https://github.com/M-jay84/Torrent-Trader-MVC-PDO-OOP

install for xampp php 7.4 only  [color=rgb(247, 218, 100)](use attached folder)[/color]
place pdo folder so it looks like htdocs/pdo/public_html [color=rgb(247, 218, 100)](this is so links and rewrite is set)[/color]
edit db settings in config.php if you do not rename the pdo folder you do not need to set url just search localhost/pdo
pdo.zip
Download
2020-08-05 05:36:49
"Propaganda, post: 68931, member: 60":

Implemented and working without error.
Did clean up the fonts a bit and it now looks like this on my site >>
                    //////connectable yes or know////////
                   if ($CURUSER["view_torrents"]=="yes") {
                       $activeseed = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'yes'");
                       $activeleech = get_row_count("peers", "WHERE userid = '$CURUSER[id]' AND seeder = 'no'");
                       $stmt = DB::run("SELECT connectable FROM peers WHERE userid=" . $CURUSER["id"] . " LIMIT 1");
                       $connect = $stmt->fetchColumn();
                       if($connect == 'yes') {
                       $connectable = "<b><font color=\"#00FF00\">YES</font></b>";
                       } elseif($connect == 'no') {
                       $connectable = "<b><font color=\"FFCCFF\">NO</font></b>";
                       } else {
                           $connectable ="<b><font color=\"99CCFF\">Check Settings</font></b>";
                      }
                   }

                   print("&nbsp;(&nbsp;Seeding:&nbsp;<a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/seeding1?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\" title='You are Seeding'><font color='#EB7F27'><b>".$activeseed."</b></font></a>&nbsp;");
                   print("Leeching:&nbsp;<a href=\"javascript:popout(0)\"onclick=\"window.open('" .$site_config["SITEURL"]. "/peers/leeching?id=" . $CURUSER["id"] . "','Seeding','width=350,height=350,scrollbars=yes')\" title='You are Leeching'><font color='#EB7F27'><b>".$activeleech."</b></font></a>&nbsp;");
                   print("Connected:&nbsp;".$connectable."&nbsp;)");
                   //////connectable yes or know end of mod////////


Will look at the correct bootstrap classes to use at later moment.


No need for LIMIT 1 as the WHERE clause is already conditioning retrieval for 1 row. Without WHERE clause, you will pull up ALL rows, thus requiring limited result sets if desired.
Same for single quote, its a INT so it is of value as is (peers.userid).

I think, just my observation.. this needs a middle row check before conditions

if ($stmt->rowCount() > 0) {
...
}
2020-08-07 04:04:02
"m-jay, post: 68933, member: 20288":

great work on the navbar ?(y) ive added to base, because ive moved a lot around i re-did all the links so if you update everything is ready
i removed the social media & radio links but everything else is there if you send me links to missing mods contact/friend/request ill add them

just updated github if you wish to try newest one save old files first

to update sql
ALTER TABLE `shoutbox` ADD `staff` tinyint( 3 ) unsigned NOT NULL default '0';


in config.php
// FORUM POST ON INDEX
$site_config['FORUMONINDEX'] = true;


transfer and rewrite all files except config.php [color=rgb(247, 218, 100)](for live servers)[/color]
https://github.com/M-jay84/Torrent-Trader-MVC-PDO-OOP

install for xampp php 7.4 only  [color=rgb(247, 218, 100)](use attached folder)[/color]
place pdo folder so it looks like htdocs/pdo/public_html [color=rgb(247, 218, 100)](this is so links and rewrite is set)[/color]
edit db settings in config.php if you do not rename the pdo folder you do not need to set url just search localhost/pdo


After making backups, I have deleted all my files. Next copied over the new ones from GIT.
Adjusted my config. Made sure the shoutbox sql was there. and next tried to run the site.

Login page appears ok, but after login get
This page isn’t working right now
ERR_TOO_MANY_REDIRECTS
If It Ain't Dutch, It Ain't Much!!
2020-08-07 04:23:25
On xamp or test sever if the test server
Try download from github again if you downloaded other day
On new try before you start make sure
Exceptionerror.php file is empty then check
again after fresh install

It should collect any errors
2020-08-07 04:26:31
Try change stylesheet in database user table to 1 (default) as well
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: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728