Advertisement
Guest User

Untitled

a guest
Mar 12th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.     // Tracks the number of Firefox tabs.  For curiosity purposes.
  3.  
  4.     do
  5.     {
  6.         // I run Firefox Portable, so you'll have to find 'recovery.js' on your system and replace accordingly.
  7.         $data = @json_decode(@file_get_contents("/FirefoxPortable/Data/profile/sessionstore-backups/recovery.js"), true);
  8.  
  9.         if ($data === false)  sleep(1);
  10.     } while ($data === false);
  11.  
  12.     $numwindows = count($data["windows"]);
  13.     $numtabs = 0;
  14.     for ($x = 0; $x < count($data["windows"]); $x++)
  15.     {
  16.         $numtabs += count($data["windows"][$x]["tabs"]);
  17.     }
  18.  
  19.     // In case you want to track it across time (e.g. run daily).
  20.     $fp = fopen("/path/to/youruser/tab_tracker.csv", "ab");
  21.     fputcsv($fp, array(date("Y-m-d"), $numtabs, $numwindows));
  22.     fclose($fp);
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement