Exemplo n.º 1
0
require './class/conn.class.php';
require_once './config.php';
include './include/function.php';
require_once '../classes/class_cache.php';
$Cache = new CACHE();
$con = new conn();
if (isset($_GET['openid']) && $_GET['openid'] != '') {
    $user_openid = $con->mres($_GET['openid']);
} else {
    exit;
}
if (isset($_GET['torrent'])) {
    $torrent = $con->mres($_GET['torrent']) * 1;
} else {
    exit;
}
if (bind_check()) {
    $sql = "SELECT * FROM `bookmarks` WHERE `torrentid` = {$torrent} AND `userid` = {$user_ptid}";
    $res = $con->query($sql);
    if (empty($res)) {
        $sql = "INSERT INTO bookmarks (torrentid, userid) VALUES ( {$torrent} , {$user_ptid} )";
        if ($con->query($sql)) {
            echo json_encode(array('status' => 'success'));
            $Cache->delete_value('user_' . $user_ptid . '_bookmark_array');
        } else {
            echo json_encode(array('status' => 'fail', 'errmsg' => '远程下载失败'));
        }
    } else {
        echo json_encode(array('status' => 'fail', 'errmsg' => '已经下载过了!'));
    }
}
Exemplo n.º 2
0
Arquivo: 56.php Projeto: morilo/ptpimg
<?php

require "cache.php";
require "misc.class.php";
$Cache = new CACHE();
if (($lasthpm = $Cache->get_value('ptpimg_hpm_last')) === false) {
    $lasthpm = $Cache->get_value('ptpimg_hpm');
    $Cache->cache_value('ptpimg_hpm_last', $lasthpm, 60);
    $Cache->delete_value('ptpimg_hpm');
}
if (($hpm = $Cache->get_value('ptpimg_hpm')) === false) {
    $hpm = 1;
    $Cache->cache_value('ptpimg_hpm', $hpm, 0);
} else {
    $Cache->increment('ptpimg_hpm');
}
echo "Average hits in the last minute: {$lasthpm}";
echo "<br /><br />";
echo $Cache->get_value('ptpimg_hpm_last');
echo "<br />";
echo $Cache->get_value('ptpimg_hpm');
Exemplo n.º 3
0
                $isdouble = ($fl['modifier'] == 2 || $fl['modifier'] == 3) && $fl['expires'] > TIME_NOW;
            }
        }
        $crazyhour = crazyhour_announce();
        if (!($crazyhour || $user['free_switch'] != 0 || $isfree || $torrent['free'] != 0 || $SitePot['value_i'] >= 10000 || $torrent['vip'] != 0 || $torrent['freeslot'] != 0)) {
            $updq[0] = "downloaded = downloaded + {$downthis}";
        }
        if ($crazyhour) {
            // crazyhour
            $updq[1] = "uploaded = uploaded + ({$upthis}*3)";
        } else {
            $updq[1] = "uploaded = uploaded + " . ($torrent['doubleslot'] != 0 || $isdouble ? $upthis * 2 : $upthis);
        }
        $udq = implode(',', $updq);
        mysql_query("UPDATE users SET {$udq} WHERE id=" . $user['id']) or err('Tracker error 3');
        $mc1->delete_value('MyUser_' . $user['id']);
        $mc1->delete_value('user' . $user['id']);
    }
    //=== abnormal upload detection
    if ($user['highspeed'] == 'no' && $upthis > 103872) {
        //=== Work out difference
        $diff = TIME_NOW - $self['ts'];
        $rate = $upthis / ($diff + 1);
        $last_up = $user['uploaded'];
        //=== about 1 MB/s
        if ($rate > 103872) {
            auto_enter_cheater($user['id'], $rate, $upthis, $diff, $torrentid, $agent, $ip, $last_up);
        }
    }
    //=== end abnormal upload detection
}