Hirdetés

Új hozzászólás Aktív témák

  • gyugyo79

    addikt

    válasz allein #41026 üzenetére

    Én meg ezt írtam ha van valakinek kedve foglalkozni vele igazából ráhagytam ebben az álapotban
    a lényeg már lekérdezhető https:-en át és authentikátor kezelése is benne van félig (nincs tárolva) :

    <html>

    <head>

    <title>Download Station Monitor</title>
    <meta http-equiv=Content-Type content="text/html; charset=UTF-8">



    </head>

    <body bgcolor="#FFF">


    <h1 align="center">Download Station Tracker Monitor Beta</h1>

    <?php

    ///////////////////////////////////////////////////////////
    $address=''; // IP
    $port=''; // PORT
    $user=''; // DS USER
    $pass=''; // DS PASSWORD
    $auth_='kell'; // authentikator kell - nem kell
    //////////////////////////////////////////////////////////

    $auth_c=$_POST["auth_code"];


    if ($auth_c=='' && $auth_=='kell' ){


    echo "
    <center>
    <form action=\"index.php\" method=\"post\" align=\"center\">
    Authentikátor kód: <input type=\"text\" name=\"auth_code\">
    <input type=\"submit\">
    </form>
    </center>";
    }else{

    //SSL kezelese
    $arrContextOptions=array(
    "ssl"=>array(
    "verify_peer"=>false,
    "verify_peer_name"=>false,
    ),
    );

    //$htmladat = file_get_contents($url, false, stream_context_create($arrContextOptions)); /// minta

    // $u1='https://'.$address.':'.$port.'/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query&query=SYNO.API.Auth,SYNO.DownloadStation.Task';
    // $getinfo=file_get_contents($u1, false, stream_context_create($arrContextOptions));
    // Ellenorzese
    // echo 'getinfo:'.$getinfo.'<br>';

    $u2='https://'.$address.':'.$port.'/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account='.$user.'&passwd='.$pass.'&otp_code='.$auth_c.'&session=DownloadStation&format=cookie';
    $login=file_get_contents($u2, false, stream_context_create($arrContextOptions));
    $decodedlogin=json_decode($login,true);
    // Ellenorzese
    //echo 'login:'.$login.'<br>';

    $sid=$decodedlogin['data'][sid];

    // Ellenorzese
    // echo 'sid:'.$sid.'<br>';

    if ( $sid==''){
    echo 'Login error ->';
    echo 'login:'.$login.'<br>';
    }else{

    $u3='https://'.$address.':'.$port.'/webapi/DownloadStation/task.cgi?api=SYNO.DownloadStation.Task&version=1&method=list&_sid='.$sid.'';
    $request=file_get_contents($u3, false, stream_context_create($arrContextOptions)); //
    $decodedrequest=json_decode($request,true);
    //$totaldownloads=$decodedrequest['data']['total']; //teljes letoltes


    echo '<table style="width:90%" align=center border="1">';
    echo "<tr>";
    echo '<th align="center">Torrent</th>';

    echo '<th align="center">Tracker Status</th> ';

    echo '<th align="center">Torrent Status</th> ';
    echo '<th align="center">Torrent ID</th>';
    echo '<th align="center">Hozzá Adta</th> ';
    echo "</tr>";

    foreach ($decodedrequest['data']['tasks'] as $adat) {

    $id=$adat['id'];

    echo "<tr>";
    //$u4='https://'.$address.':'.$port.'/webapi/DownloadStation/task.cgi?api=SYNO.DownloadStation.Task&version=1&method=getinfo&id='.$id.'&additional=detail,transfer,tracker&_sid='.$sid.'';
    $u4='https://'.$address.':'.$port.'/webapi/DownloadStation/task.cgi?api=SYNO.DownloadStation.Task&version=1&method=getinfo&id='.$id.'&additional=tracker&_sid='.$sid.'';

    $detail=file_get_contents($u4, false, stream_context_create($arrContextOptions));
    $decodeddetail=json_decode($detail,true);

    foreach($decodeddetail['data']['tasks'] as $adat2){

    $username=$adat2['username'];
    $title=$adat2['title'];
    //$id_=$adat2['id'];
    $status=$adat2['status'];
    $tracker_statusz=$decodeddetail['data']['tasks']['0']['additional']['tracker']['0']['status'];

    echo '<td>'.$title.'</td>';


    if($tracker_statusz=="Success") echo '<td bgcolor="green" align=center>kapcsolodva</td>';
    if($tracker_statusz=="unregistered torrent") echo '<td bgcolor="red" align=center>unregistered torrent</td>';
    //
    if($status=="downloading") echo '<td bgcolor="green" align=center>downloading</td>';
    if($status=="seeding") echo '<td bgcolor="green" align=center>seeding</td>';
    if($status=="waiting") echo '<td bgcolor="green" align=center>waiting</td>';
    if($status=="paused") echo '<td bgcolor="yelow" align=center>paused</td>';
    if($status=="finishing") echo '<td bgcolor="green" align=center>finishing</td>';
    if($status=="finished") echo '<td bgcolor="yelow" align=center>finished</td>';
    if($status=="hash_checking") echo '<td bgcolor="yelow" align=center>hash_checking</td>';
    if($status=="filehosting_waiting") echo '<td bgcolor="yelow" align=center>filehosting_waiting</td>';
    if($status=="extracting") echo '<td bgcolor="yelow" align=center>extracting</td>';
    if($status=="error") echo '<td bgcolor="red" align=center>error</td>';
    //
    echo '<td align=center>'.$id.'</td>';
    echo '<td align=center>'.$username.'</td>' ;

    }

    echo "</tr>";

    }



    echo "</table></br></br><center>--------------- Kész ----------------</center>";

    } // login else

    }//auth else

    ?>



    </br></br>
    </body>


    <footer>

    <br><br>
    </footer>


    </html>

    [ Szerkesztve ]

Új hozzászólás Aktív témák