コード例 #1
0
ファイル: index.php プロジェクト: Qbuer/pt-wechat
header('Content-type:text/html;charset=utf-8');
const ALREADY_BINDED = '你已经绑定过了';
const HELP = '支持的命令: 状态 , 查询@关键字 , 最新 , 热门';
$user_ptid = -1;
$operation = 'NULL';
$text = '';
$keyword = '';
$user_openid = '';
$con = new conn();
$weObj = new Wechat($wechat_options);
$weObj->valid();
$msg = $weObj->getRev()->getRevData();
//获取用户发送的消息
$user_openid = $weObj->getRev()->getRevFrom();
//获取用户openid
$user_openid = $con->mres($user_openid);
$msg = trim($msg['Content']);
switch ($msg) {
    case '绑定':
        $operation = BIND;
        break;
    case '状态':
        $operation = STATUS;
        break;
    case '热门':
        $operation = HOT;
        break;
    case '最新':
        $operation = NEWLY;
        break;
    default:
コード例 #2
0
ファイル: download.php プロジェクト: Qbuer/pt-wechat
<?php

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' => '已经下载过了!'));
コード例 #3
0
ファイル: download.html.php プロジェクト: Qbuer/pt-wechat
<?php
	require('./class/conn.class.php');
	require_once('./config.php');
	include('./include/function.php');
	$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;
	$url = "download.php?openid=$user_openid&torrent=$torrent";
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv = "Content-Type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>下载</title>
	<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
	<script type="text/javascript" src = 'http://res.wx.qq.com/open/js/jweixin-1.1.0.js' ></script>
	<link rel="stylesheet" type="text/css" href="./css/style.css">
</head>
<body>
	<span id = 'openid' style = 'display:none'><?php echo $_GET['openid']; ?></span>
	<div class = 'container'>
		<div class = "panel panel-success">
			<div class = 'panel-heading'>
				<h3 class = 'panel-title'>远程下载</h3>
			</div>
				<div class="alert alert-info" role="alert" id = 'download-success' style ='display:none'>下载成功</div>
			</div>
		</div>
コード例 #4
0
ファイル: torrentlist.php プロジェクト: Qbuer/pt-wechat
<?php

require_once './class/conn.class.php';
require_once './config.php';
include './include/function.php';
$con = new conn();
$keyword = NULL;
$other = NULL;
if (isset($_GET['openid']) && $_GET['openid'] != '') {
    $user_openid = $con->mres($_GET['openid']);
} else {
    exit;
}
if (@isset($_GET['keyword'])) {
    $keyword = $con->mres($_GET['keyword']);
} else {
    if (@isset($_GET['other'])) {
        $keyword = NULL;
        $other = $_GET['other'];
        if ($other != 'hot') {
            die;
        }
    }
}
if (bind_check()) {
    if ($keyword) {
        $sql = "SELECT * FROM `torrents` WHERE (`name` LIKE '%{$keyword}%' OR `small_descr` LIKE '%{$keyword}%') AND `seeders` != 0 limit 20";
        $result = $con->query($sql);
    } else {
        if ($other == 'hot') {
            $sql = "SELECT * FROM `torrents` WHERE `picktype` = 'hot' ";