TorrentFlux.com Hey, OppTupacShakur, you have 11 messages, 0 are new.
05-07-2007, 12:38:24
Home Help Search Profile Logout donate chat
News:


+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.1 Hacks
| | |-+  Get Cookies Via php Proxy
« previous next »
Pages: [1] Go Down Reply Notify of replies Send this topic Print
Author Topic: Get Cookies Via php Proxy  (Read 1331 times)
Anglachel
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 35



View Profile Personal Message (Offline)
« on: 06-06-2006, 23:44:09 » Reply with quote

quick way to simplify the act of getting cookies... kinda tossed to gather and lots of room for improvement by actually modifying the php proxy, but I was trying to be as non-destructive as possible.

First step get phpProxy from http://sourceforge.net/projects/poxy/
Extract the files rename index.php to something like proxy.php and put in your torrent flux directory.

in your profile.php find the lind that says

Code:
<input type="Submit" value="<?php echo ( !empty( $cid ) ) ? _UPDATE : "Add"; ?>">
Add this line below it:
Code:
<A href="?op=GrabCookies">Get Cookies From Proxy</A>

then find
Code:
function addCookie( $newCookie )
and replace with:
Code:
function addCookie( $newCookie, $continue )

in that same function directly above
Code:
header( "location: profile.php?op=showCookies" );
add the line:
Code:
if(!$continue)

Below
Code:
    case "showCookies":
    case "editCookies":
        showCookies();
    break;
Add:
Code:
    case "GrabCookies":
        GrabCookies();
    break;


Then at the bottum (or where ever you'd like out side of any of the other functions) add:
Code:
Function GrabCookies(){
    foreach(array_keys($_COOKIE) as $value){
        if(strstr($value, "COOKIE")){
            $cookie = explode(";",$value);
            $temphost = $cookie[2];
            $tempvalue = $cookie[1];
            $tempcookie[$temphost] = $tempcookie[$temphost].$tempvalue."=".$_COOKIE[$value].";";
        }
    }
    $last = count($a);
    $i = 0;
    foreach(array_keys($tempcookie) as $value){
        $i++;
        $newCookie["host"] = str_replace("_", ".", $value);
        $newCookie["data"] = substr($tempcookie[$value], 0, -1);
        addCookie( $newCookie, ($i==$last));
    }
}

put in a link to proxy.php some where on your page (I recomend using the links section but that is up to you.) go there browse to your favorite private trackers and login.  return to your profile page and slect manage cookies and then click the "Get Cookies From Proxy" link.

This will pull down all of the cookies you picked up while browsing through the proxy into your torrent flux profile. 




Currently it will grab all the cookies Each time you click the link, I have no intention of trying to change this at the moment, so long as you can delete the duplicates with a click of the mouse.

The php proxy program stores a cookie on your computer for it self that contains the cookies from the other sites, if more then one torrent flux user uses the same browser on the same computer it is possible (likely) that there will be issues with people getting each others cookies.

As I said above there is lots of room for improvement here, this is just something I hacked to gather quickely to aviod having to copy cookies from my private trackers over by hand.

Any issues or improvements let me know.
Report to moderator   Logged
hijack
Newbie
*
Offline Offline

Posts: 2



View Profile Personal Message (Offline)
« Reply #1 on: 02-04-2007, 01:30:58 » Reply with quote

Great Thanks
« Last Edit: 02-04-2007, 01:52:12 by hijack » Report to moderator   Logged
leebates1986
Newbie
*
Offline Offline

Posts: 2



View Profile Email Personal Message (Offline)
« Reply #2 on: 02-28-2007, 02:14:28 » Reply with quote

i've done all the above but this bit i dont understand  Huh?


put in a link to proxy.php some where on your page (I recomend using the links section but that is up to you.) go there browse to your favorite private trackers and login.  return to your profile page and slect manage cookies and then click the "Get Cookies From Proxy" link.

Report to moderator   Logged
Anglachel
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 35



View Profile Personal Message (Offline)
« Reply #3 on: 03-04-2007, 12:40:26 » Reply with quote

i've done all the above but this bit i dont understand  Huh?


put in a link to proxy.php some where on your page (I recomend using the links section but that is up to you.) go there browse to your favorite private trackers and login.  return to your profile page and slect manage cookies and then click the "Get Cookies From Proxy" link.


means just what it says...

if your site is http://mytorrentflux.com/  then navigate to http://mytorrentflux.com/proxy.php (or put a link in your links section of torrent flux)

On there it will ask you for a web address, put in the tracker you want to get the cookies for (i.e. http://www.demoniod.com/) and then log in.

then go back to http://mytorrentflux.com/ navigate to your profile page (where you'd normally add cookies) and click "Get Cookies From Proxy"
Report to moderator   Logged
tripkipke
Newbie
*
Offline Offline

Posts: 1



View Profile Email Personal Message (Offline)
« Reply #4 on: 04-11-2007, 06:38:30 » Reply with quote

***EDIT***

Never mind, I still had 2.1 beta installed and just upgraded to 2.3, will try again now Smiley

_______________________________________________________________________

Hi,

I just installed this and I seem to be having some minor issues.

I can surf by using phproxy but when I use the "Get cookies from proxy" link in the cookie manager i get this:

Code:
Warning: array_keys() [function.array-keys]: The first argument should be an array in /usr/share/torrentflux/www/profile.php on line 539

Warning: Invalid argument supplied for foreach() in /usr/share/torrentflux/www/profile.php on line 539

Line 539 is in the GrabCookies Function:
foreach(array_keys($tempcookie) as $value){
Snippit of the code below.

Code:
Function GrabCookies(){
    foreach(array_keys($_COOKIE) as $value){
        if(strstr($value, "COOKIE")){
            $cookie = explode(";",$value);
            $temphost = $cookie[2];
            $tempvalue = $cookie[1];
            $tempcookie[$temphost] = $tempcookie[$temphost].$tempvalue."=".$_COOKIE[$value].";";
        }
    }
    $last = count($a);
    $i = 0;
    foreach(array_keys($tempcookie) as $value){
        $i++;
        $newCookie["host"] = str_replace("_", ".", $value);
        $newCookie["data"] = substr($tempcookie[$value], 0, -1);
        addCookie( $newCookie, ($i==$last));
    }
}

Can somone tell me what i did wrong?

**EDIT**
When I click on the add button I get simular errors. (The cookie is added when I go back to the cookie manager but i still get the error)

Code:
Warning: Missing argument 2 for addCookie(), called in /usr/share/torrentflux/www/profile.php on line 504 and defined in /usr/share/torrentflux/www/profile.php on line 429

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/torrentflux/www/profile.php:429) in /usr/share/torrentflux/www/profile.php on line 438

Line 429 starts with:
Code:
function addCookie( $newCookie, $continue )
{
    if( !empty( $newCookie ) )
    {
        global $cfg;
        AddCookieInfo( $newCookie );
        AuditAction( $cfg["constants"]["admin"], "New Cookie: " . $newCookie["host"] . " | " . $newCookie["data"]$
    }
        if(!$continue)
        header( "location: profile.php?op=showCookies" );

}

and Line 504 is the 4th line of

Code:
case "addCookie":
        $newCookie["host"] = getRequestVar('host');
        $newCookie["data"] = getRequestVar('data');
        addCookie( $newCookie );
    break;

Regards,
Tripkipke
« Last Edit: 04-11-2007, 07:48:14 by tripkipke » Report to moderator   Logged
Pages: [1] Go Up Reply Notify of replies Send this topic Print 
« previous next »
Jump to:  


Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP