示例#1
0
     if (is_array($data)) {
         if ($data['musicurl']) {
             exit(W::response($xml, $data, 'music'));
         }
         exit(W::response($xml, $data, 'news'));
     } else {
         exit(W::response($xml, $data));
     }
 } else {
     if (rand(1, 10) == 6) {
         switch (rand(1, 18)) {
             case 1:
                 exit(W::response($xml, "聊了这么久小u给你讲个笑话吧:\n" . jokes()));
                 break;
             case 2:
                 $news = baiduNews();
                 $data = array(array('title' => '关心国家大事,了解天下奇谈,小u给你播报新闻啦!'));
                 for ($i = 0; $i < 5; $i++) {
                     array_push($data, array('title' => $news[title][$i] . "\n" . '------------------------------------------', 'note' => $news[resrc][$i], 'link' => $news[url][$i]));
                 }
                 exit(W::response($xml, $data, 'news'));
                 break;
             case 3:
                 exit(W::response($xml, "四六级没考过吧孩子,还是乖乖跟我学英语,嗯哼:\n" . en_sentenceAPI() . "\n哎哟,你还可以发英语单词考我哦,没有我不知道的,嘻嘻/:B-)"));
                 break;
             case 4:
                 exit(W::response($xml, "妹子爆个照吧,小u想看看嘛,看了会说话嘛/:8*"));
                 break;
             case 5:
                 $res = $mysql->getData("SELECT * FROM moments ORDER BY ID DESC LIMIT 5");
                 $data = array(array('title' => '动态', 'cover' => $web . '/img/meizi/2.jpg'));
示例#2
0
<?php

header("content-Type: text/html; charset=utf-8");
function baiduNews()
{
    $word = '最新';
    $num = 5;
    $baidunews_api_url = 'http://news.baidu.com/ns?tn=newsfcu&from=news&cl=2&ct=0&rn=' . $num . '&word=' . $word;
    $result = file_get_contents($baidunews_api_url);
    $reg = '#<a[\\s]+href="(?<url>[^\\s>]+)"[^>]*target="_blank">(?<title>[^>]+)</a>&nbsp;<span>(?<resrc>[^>]+)</span>#i';
    preg_match_all($reg, $result, $matches);
    $matches[resrc] = str_replace('&nbsp;', ' ', $matches[resrc]);
    for ($i = 0; $i < 5; $i++) {
        $matches[title][$i] = iconv('gbk', 'utf-8', $matches[title][$i]);
        $matches[resrc][$i] = iconv('gbk', 'utf-8', $matches[resrc][$i]);
    }
    return $matches;
}
print_r(baiduNews());
//url,title,resrc
示例#3
0
文件: index.php 项目: xuwt/weChat_php
$xiaoU = array(array('title' => 'Uri', 'cover' => $web . '/img/xiaou.jpg', 'link' => $mp . '?__biz=MzA3MjAzMTgyMA==&appmsgid=10000058&itemidx=1&sign=93bf84e650d4df87196988b342b65644&uin=MTg0MTcyODUwMQ%3D%3D&key=1f75b224f2ddfcb63ee0ec9833578cef7b1a67f0a5b8764f174219e1dea6ff39600f23b296cd7601a031fb617c173721&devicetype=android-17&version=25000104&lang=zh_CN'), array('title' => '功能介绍', 'cover' => $web . '/img/function.png', 'link' => $mp . '?__biz=MzA3MjAzMTgyMA==&appmsgid=10000058&itemidx=2&sign=aa817cfb12b9117cb518d4ab268d28b9&uin=MTg0MTcyODUwMQ%3D%3D&key=a45a7c15a542fe6fc8cb6988104ee36150747c2ada475afb2ac31bce5694e6c3926bef8e4a56de8e63d7ca0e91c68a1f&devicetype=android-17&version=25000104&lang=zh_CN'), array('title' => '任务进度', 'cover' => $web . '/img/taskprocess.png', 'link' => $mp . '?__biz=MzA3MjAzMTgyMA==&appmsgid=10000058&itemidx=3&sign=5edb8953ca274271a239626c434df4a2&uin=MTg0MTcyODUwMQ%3D%3D&key=1f75b224f2ddfcb6c670a05130da7f8843902f3277a89843ae023cec9a770260f883566234a1185fec8257197f241425&devicetype=android-17&version=25000104&lang=zh_CN'), array('title' => '联系我们', 'cover' => $web . '/img/contactme.png', 'link' => $mp . '?__biz=MzA3MjAzMTgyMA==&appmsgid=10000058&itemidx=4&sign=a7d37be0a672e5c2085330799836992b&uin=MTg0MTcyODUwMQ%3D%3D&key=1f75b224f2ddfcb62c58bc42a307d4f512acd5bfc822af05b55a2f55325983e93e612b5c098985be9b9909a57e7eab5e&devicetype=android-17&version=25000104&lang=zh_CN'));
$biaoqing = array('/::)', '/::~', '/::B', '/::|', '/:8-)', '/::<', '/::$', '/::X', '/::Z', '/::\'(', '/::-|', '/::@', '/::P', '/::D', '/::O', '/::(', '/::+', '/:--b', '/::Q', '/::T', '/:,@P', '/:,@-D', '/::d', '/:,@o', '/::g', '/:|-)', '/::!', '/::L', '/::>', '/::,@', '/:,@f', '/::-S', '/:?', '/:,@x', '/:,@@', '/::8', '/:,@!', '/:!!!', '/:xx', '/:bye', '/:wipe', '/:dig', '/:handclap', '/:&-(', '/:B-)', '/:<@', '/:@>', '/::-O', '/:>-|', '/:P-(', '/::\'|', '/:X-)', '/::*', '/:@x', '/:8*');
$pythonWelcome = 'Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.';
$mysqlWelcome = "Welcome to the MySQL monitor.  Commands end with ; or \\g.\nServer version: 5.0.45-community-nt MySQL Community Edition (GPL)\nType 'help;' or '\\h' for help. Type '\\c' to clear the buffer.";
$sqliWelcome = "sqli beta1.0\nWelcome to the sqli platform for you to leran SQL injection.We wish you enjoin this and have fun.\n\nsend 'login' to start.";
$welcome = array($pythonWelcome, $mysqlWelcome, $sqliWelcome);
$help = '这是目前小u有的功能:' . "\n" . '-----------------' . "\n" . '[小u]' . "\n" . ':查看小u的基本信息,以及功能介绍和近期更新' . "\n" . '-----------------' . "\n" . '[帮助]' . "\n" . ':查看使用帮助' . "\n" . '-----------------' . "\n" . '[查水表]' . "\n" . ':查询寝室的水电费(华科)' . "\n" . '-----------------' . "\n" . '[每日一句]' . "\n" . ':每天更新一句英语,中英对照' . "\n" . '-----------------' . "\n" . '[点歌]' . "\n" . ':小u每天会为大家推荐好的歌曲,希望大家喜欢。如果想给某人点歌的话,可以直接跟我说哦' . "\n" . '-----------------' . "\n" . '[笑话]' . "\n" . ':郁闷时看看笑话吧,小u这里有好多笑话等着你呢' . "\n" . '-----------------' . "\n" . '[新闻]' . "\n" . ':没事的时候大家多看看新闻吧,小u不懈的为你奉送中' . "\n" . '-----------------' . "\n" . '[彩票]' . "\n" . ':每天的彩票信息一目了然' . "\n" . '-----------------' . "\n" . '翻译' . "\n" . ':发送"#+你要翻译的内容",即可收到详细结果,例如:#doofus' . "\n" . '-----------------' . "\n" . '天气+找小u' . "\n" . ':点击下面的“+”,发送你的的位置信息,即可收到本地的天气预报,并且看到你和小u的距离哟。' . "\n" . '-----------------' . "\n" . 'bing搜索' . "\n" . ':发送"%+你要搜索的内容",即可收到详细结果,例如:%dweeb' . "\n" . '-----------------' . "\n" . '维基百科' . "\n" . ':发送"&+你要搜索的内容",小u会根据你的输入自动判断查询中文维基或是英文,(*^__^*) 嘻嘻。例如:&spaz' . "\n" . '-----------------' . "\n" . '二维码' . "\n" . ':发送"*+你要生成的内容",小u会返回生成的二维码。例如:*嘟嘟噜' . "\n" . '-----------------';
$help .= "\n" . '豆瓣' . "\n" . '1.书' . "\n" . ' bs:关键字 搜索相关的书籍' . "\n" . ' b:书名 查看详细内容' . "\n" . '2.音乐' . "\n" . ' ms:关键字 搜索相关的音乐' . "\n" . ' m:音乐名 查看详细内容' . "\n" . '3.电影' . "\n" . ' vs:关键字 搜索相关的电影' . "\n" . ' v:电影名 查看详细内容' . "\n" . '-----------------';
$help .= "\n" . '动态' . "\n" . ':发送":+你要分享的文字"即可,大家可以回复[动态]查看,都可以看到哦。例如 :这是我发的第一个说说' . "\n" . '-----------------';
$help .= "\n" . '美女识别' . "\n" . ':上传图片,看看小u的眼力吧' . "\n" . '-----------------' . "\n" . '周公解梦' . "\n" . ':发送"梦到xxx",小u来预测吉凶,例如"梦到小u"' . "\n" . '-----------------' . "\n" . '手机号码查询' . "\n" . ':直接发送手机号' . "\n" . '-----------------';
$help .= "\n" . '#[xx]内的内容xx是指你发送给小u的';
$waterbiao = '查询电费请点击这里:' . "\n" . '<a href="http://42.120.22.130/dianfei.php">查电费</a>。' . "\n" . '低余电费自动提醒功能请点击这里:' . "\n" . '<a href="http://42.120.22.130:8822/">邮件提醒</a>';
$terminal = array('>python' => 1, '>mysql' => 2, '>sqli' => 3);
$keywords = array('小u' => $xiaoU, '点歌' => array('title' => '你给的甜', 'description' => '何艺纱', 'musicurl' => 'http://data7.5sing.com/T1aMbeBXbT1R47IVrK.mp3', 'HQmusicurl' => 'http://data7.5sing.com/T1aMbeBXbT1R47IVrK.mp3'), '每日一句' => en_sentenceAPI(), '笑话' => jokes(), '新闻' => baiduNews(), '动态' => moment(), 'bilibili' => bilibili(), 'stack' => stackoverflow(), '小幽' => '在!', '彩票' => lottery(), '帮助' => $help, '查水表' => $waterbiao);
$rss_arr = array('0x50sec' => array('title' => 'Web安全手册,专注Web安全', 'cover' => $web . '/img/0x50sec.png'), '91ri' => array('title' => '网络安全攻防研究室', 'cover' => $web . '/img/91ri.gif'), 'freebuf' => array('title' => 'Freebuf', 'cover' => $web . '/img/freebuf.jpg'), 'matrix67' => array('cover' => $web . '/img/matrix67.png'), '读书' => array('title' => '读书排行榜', 'cover' => $web . '/img/meizi/' . mt_rand(0, 9) . '.jpg'), '松鼠' => array('title' => '科学松鼠会', 'cover' => $web . '/img/songshu.gif'), '爱范' => array('title' => '爱范儿 · Beats of Bits', 'cover' => $web . '/img/ifanr.gif'), '人人影视' => array('title' => '人人影视', 'cover' => $web . '/img/yyets.png'), '设计达人' => array('title' => '设计达人-爱设计,爱分享。', 'cover' => $web . '/img/meizi/' . mt_rand(0, 9) . '.jpg'), '运维' => array('title' => '好的架构减少运维,好的运维反哺架构', 'cover' => $web . '/img/meizi/' . mt_rand(0, 9) . '.jpg'), '乌云' => array('title' => 'wooyun.org 最新提交漏洞', 'cover' => $web . '/img/wooyun.png'));
$reg_arr = array('/^(梦到)(.+)/i' => 'dream', '/^(#)(.+)/i' => 'translate', '#(/:)#i' => 'biaoqingbiaoqing', '#^(simi:)(.+)#i' => 'changeSimsimiKey', '#^(md5:)(.+)#i' => 'md5', '/^(\\*)(.+)/i' => 'qrcode', '/^(%)(.+)/i' => 'bingSearch', '/^(&)(.+)/i' => 'wiki', '/^(vs:)(.+)/i' => 'doubanMovie1', '/^(v:)(.+)/i' => 'doubanMovie2', '/^(bs:)(.+)/i' => 'doubanBook1', '/^(b:)(.+)/i' => 'doubanBook2', '/^(ms:)(.+)/i' => 'doubanMusic1', '/^(m:)(.+)/i' => 'doubanMusic2', '/^(:)(.+)/i' => 'moments1', '/^(昵称:)(.+)/i' => 'moments2');
########################################################
//Define function
/*---------------------------------------------------*/
function changeStatu($openid, $num)
{
    $mysql = new SaeMysql();
    $result = $mysql->getData("SELECT * FROM python WHERE FromUserName='******'");
    if (!$result[0]) {
        $mysql->runSql("INSERT INTO python(FromUserName,state) VALUES ('{$openid}',{$num})");
    } else {
        $mysql->runSql("UPDATE python SET state={$num} WHERE FromUserName='******'");
    }
}