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
Get ip and browser details
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2020-08-16 15:10:38
this is a little class i use so put it in a block if useful to any one i use this instead of getip() and a few other things

create ipconnected_block.php
<?php
if (!$site_config["MEMBERSONLY"] || $CURUSER) {
       begin_block(T_("Ip Details"));

       $info = new IPconnected();

       $osName = $info->operatingSystem();
       $osVersion = $info->osVersion();
       $browserName = $info->browser()['browser'];
       $browserVersion = $info->browserVersion();
       $ip = $info->ip();

       echo '<font color=orange><b>Op Sys&nbsp;</b></font>'.$osName;
       echo '<br><font color=orange><b>Version&nbsp;</b></font>'.$osVersion;
       echo '<br><font color=orange><b>Browser&nbsp;</b></font>'.$browserName;
       echo '<br><font color=orange><b>Version&nbsp;</b></font>'.$browserVersion;
       echo '<br><font color=orange><b>Ip&nbsp;</b></font>'.$ip;
       end_block();
}


create IPconnected.php (you will need to include this in functions.php)
<?php
class IPconnected
{
   /**
    * Get user agent.
    */
   private static function agent()
   {
       return $_SERVER['HTTP_USER_AGENT'];
   }

   /**
    * Get OperatingSystem name.
    */
   public function operatingSystem()
   {
       $UserAgent = self::agent();
       if (preg_match_all('/windows/i', $UserAgent)) {
           $PlatForm = 'Windows';
       } elseif (preg_match_all('/linux/i', $UserAgent)) {
           $PlatForm = 'Linux';
       } elseif (preg_match('/macintosh|mac os x/i', $UserAgent)) {
           $PlatForm = 'Macintosh';
       } elseif (preg_match_all('/Android/i', $UserAgent)) {
           $PlatForm = 'Android';
       } elseif (preg_match_all('/iPhone/i', $UserAgent)) {
           $PlatForm = 'IOS';
       } elseif (preg_match_all('/ubuntu/i', $UserAgent)) {
           $PlatForm = 'Ubuntu';
       } else {
           $PlatForm = 'unknown';
       }

       return $PlatForm;
   }

   /**
    * Get Browser Name.
    */
   public function browser()
   {
       $UserAgent = self::agent();
       if (preg_match_all('/Edge/i', $UserAgent)) {
           $Browser = 'Microsoft Edge';
           $B_Agent = 'Edge';
       } elseif (preg_match_all('/MSIE/i', $UserAgent)) {
           $Browser = 'Mozilla Firefox';
           $B_Agent = 'Firefox';
       } elseif (preg_match_all('/OPR/i', $UserAgent)) {
           $Browser = 'Opera';
           $B_Agent = 'Opera';
       } elseif (preg_match_all('/Opera/i', $UserAgent)) {
           $Browser = 'Opera';
           $B_Agent = 'Opera';
       } elseif (preg_match_all('/Chrome/i', $UserAgent)) {
           $Browser = 'Google Chrome';
           $B_Agent = 'Chrome';
       } elseif (preg_match_all('/Safari/i', $UserAgent)) {
           $Browser = 'Apple Safari';
           $B_Agent = 'Safari';
       } elseif (preg_match_all('/firefox/i', $UserAgent)) {
           $Browser = 'Mozilla Firefox';
           $B_Agent = 'Firefox';
       } else {
           $Browser = null;
           $B_Agent = null;
       }

       return [
           'browser' => $Browser,
           'agent' => $B_Agent,
       ];
   }

   /**
    * Get Os version.
    */
   public function oSVersion()
   {
       $UserAgent = self::agent();
       if (preg_match_all('/windows nt 10/i', $UserAgent)) {
           $OsVersion = 'Windows 10';
       } elseif (preg_match_all('/windows nt 6.3/i', $UserAgent)) {
           $OsVersion = 'Windows 8.1';
       } elseif (preg_match_all('/windows nt 6.2/i', $UserAgent)) {
           $OsVersion = 'Windows 8';
       } elseif (preg_match_all('/windows nt 6.1/i', $UserAgent)) {
           $OsVersion = 'Windows 7';
       } elseif (preg_match_all('/windows nt 6.0/i', $UserAgent)) {
           $OsVersion = 'Windows Vista';
       } elseif (preg_match_all('/windows nt 5.1/i', $UserAgent)) {
           $OsVersion = 'Windows Xp';
       } elseif (preg_match_all('/windows xp/i', $UserAgent)) {
           $OsVersion = 'Windows Xp';
       } elseif (preg_match_all('/windows me/i', $UserAgent)) {
           $OsVersion = 'Windows Me';
       } elseif (preg_match_all('/win98/i', $UserAgent)) {
           $OsVersion = 'Windows 98';
       } elseif (preg_match_all('/win95/i', $UserAgent)) {
           $OsVersion = 'Windows 95';
       } elseif (preg_match_all('/Windows Phone +[0-9]/i', $UserAgent, $match)) {
           $OsVersion = $match;
       } elseif (preg_match_all('/Android +[0-9]/i', $UserAgent, $match)) {
           $OsVersion = $match;
       } elseif (preg_match_all('/Linux +x[0-9]+/i', $UserAgent, $match)) {
           $OsVersion = $match;
       }

       return $OsVersion;
   }

   /**
    * Get Browser version.
    */
   public function browserVersion()
   {
       $UserAgent = self::agent();
       $B_Agent = self::Browser()['agent'];
       if ($B_Agent !== null) {
           $known = ['Version', $B_Agent, 'other'];
           $pattern = '#(?<browser>' . implode('|', $known) .
               ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
           if (!preg_match_all($pattern, $UserAgent, $matches)) {
           }
           $i = count($matches['browser']);
           if ($i != 1) {
               if (strripos($UserAgent, 'Version') < strripos($UserAgent, $B_Agent)) {
                   $Version = $matches['version'][0];
               } else {
                   $Version = $matches['version'][0];
               }
           } else {
               $Version = $matches['version'][0];
           }
       }

       return $Version;
   }

   /**
    * Get The user ip.
    */
   public function ip()
   {
       if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
           $ip_add = $_SERVER['HTTP_CLIENT_IP'];
       } elseif (!empty($_SERVER['        HTTP_X_FORWADED_FOR'])) {
           $ip_add = $_SERVER['HTTP_X_FORWADED_FOR'];
       } else {
           $ip_add = $_SERVER['REMOTE_ADDR'];
       }

       return $ip_add;
   }
}
Untitled.png
Untitled.png
2020-08-16 16:01:38
thank you ! M8 ?

For the addition in link of the file in[color=rgb(243, 121, 52)] backend / functions.php[/color] search:
require_once(BACKEND."/languages.php");


Add after:
require_once(BACKEND."/IPconnected.php");


and finally add the file named IP connected.php in the backend folder
2020-08-16 17:15:12
For help i give a little example of how i use

in sql

ALTER TABLE users ADD opsystem char(13) default NULL;


for v3 i think logincookie

SQL_Query_exec("UPDATE users SET last_login = '".get_date_time()."' WHERE id = $id");


to something like

$info = new IPconnected();
$osName = $info->operatingSystem();
SQL_Query_exec("UPDATE users SET last_login = '".get_date_time()." AND  opsystem=".$osName." ' WHERE id = $id");


now you can use this in account, details, login block etc

echo $CURUSER['opsystem'];
2020-08-16 17:24:55
seems like a better version of what I did years ago. Nice stuff
Capture.PNG
Capture.PNG

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-08-16 17:29:50
Do you have a link mate, just wonder if it had a database table would be able to log browser activity easy then
2020-08-16 18:12:44
yes, there was a DB connection. If you look at my old modded version, its in there. I dont know it offhand, just open up my old sql and get the query from there. if this helps, heres a link to it https://sourceforge.net/projects/tt-2-08-micro-edition/
Capture.PNG
Capture.PNG

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-08-16 18:27:25
I have already converted my modded copy to php7. I use it for a my testing.  I could sanitize it and post up a copy. but I have lots of odd tabs that I did for testing, so I would have to clean it up a bit
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-08-16 18:33:53
[USER=311]@MicroMonkey[/USER] if you get chance post it up m8, i'm sure people would like it
2020-08-16 18:39:19
Im sure I can do that. There will be tons of extra files in it, some stuff was experimental, some actually works. some stuff was old things, but nothing interferes with anything, it was a testing platform
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-08-16 18:41:52
sounds cool
2020-08-16 18:42:34
My modded version is actually a bit newer than the mysqli version that I shared on GIT. I guess I could spend some time and make my version the standard. Just gimme some time. its not simple lol
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-08-16 18:45:56
no rush m8
2020-08-16 18:46:03
My copy is geared towards movies and TV shows. STorrents does switch games, so that layout wouldn't be ideal for what I did. He did an amazing job, so does m-jay, but I made mine the way I want, but I do borrow from all of you guys, because thats how things get done lol
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-08-16 19:12:04
Cheers m8 will  look through, images will be useful too  (y)
2020-08-16 19:19:19
enjoy. Sharing is caring :)
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
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