示例#1
0
文件: index.php 项目: ircoco/setin.cn
<!DOCTYPE html>
<?php 
define('PAGE_SIZE', 10);
require_once '../inc/mysql.inc.php';
require_once '../inc/joke.inc.php';
$page_num = isset($_GET['page']) ? strip_tags(mysql_escape_string($_GET['page'])) : 1;
$tag = isset($_GET['s']) ? strip_tags(mysql_escape_string($_GET['s'])) : '';
if ($page_num <= 0) {
    $page_num = 1;
}
$Jokedao = new Joke();
$joke_online_cnt = $Jokedao->count_online($tag);
//print_r($joke_online_cnt);
$page_total = floor(($joke_online_cnt - 1) / PAGE_SIZE) + 1;
//总页数
$jokes = $Jokedao->query_page(PAGE_SIZE, $page_num, $tag);
Mysql::close();
?>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <meta name="renderer" content="webkit" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <meta http-equiv="Cache-Control" content="no-transform " /> 
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="Bookmark" href="/res/joke/favicon.ico" />
        <link rel="shortcut icon" href="/res/joke/favicon.ico" />
		<title><?php 
if (!empty($tag)) {
    echo '与“' . $tag . '”相关的笑话 | ';
示例#2
0
 $state = UserState::getUserState($yixin->msg['FromUserName']);
 if ($keyword == 'Hello2BizUser') {
     $reply = $yixin->makeText(cons::$WELCOME_STR);
 } elseif ($keyword == 'q' || $keyword == 'Q') {
     UserState::setUserState($yixin->msg['FromUserName'], '0', '');
     $reply = $yixin->makeText(cons::$WELCOME_STR);
 } else {
     // 主界面
     if ($state['state'] == '0') {
         $reply = chooseFunctionNum($keyword, $yixin);
     } elseif ($state['state'] == '1') {
         $mryw = new Mryw($keyword);
         $rst = $mryw->get();
         $reply = $yixin->makeNews($rst);
     } elseif ($state['state'] == '2') {
         $joke = new Joke($keyword);
         $rst = $joke->getJoke();
         $reply = $yixin->makeNews($rst);
     } elseif ($state['state'] == '3') {
         $beautiful = new Beautiful($keyword);
         $rst = $beautiful->getBeautifulPic();
         $reply = $yixin->makeNews($rst);
     } elseif ($state['state'] == '4') {
         $robot = new Robot($keyword);
         $rst = $robot->getReply();
         if (is_array($rst)) {
             $reply = $yixin->makeNews($rst);
         } else {
             $reply = $yixin->makeText($rst);
         }
     } elseif ($state['state'] == '5') {
示例#3
0
<?php

require_once '../inc/mysql.inc.php';
require_once '../inc/joke.inc.php';
$content = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
	   <url>
			<loc>http://joke.setin.cn</loc>
			<lastmod>' . date('c') . '</lastmod>
			<changefreq>daily</changefreq>
			<priority>1</priority>
		</url>
';
$Joke_dao = new Joke();
$total_num = $Joke_dao->count_online("");
$jokes = $Joke_dao->select_4_sitemap();
foreach ($jokes as $item) {
    $content .= create_item($item);
}
$content .= '</urlset>';
echo $content;
Mysql::closeConn();
function create_item($data)
{
    $item = "<url>\n";
    $item .= "<loc>http://joke.setin.cn/" . $data['j_id'] . ".html</loc>\n";
    $item .= "<priority>" . 0.9 . "</priority>\n";
    $item .= "<lastmod>" . date("c", strtotime($data['j_time'])) . "</lastmod>\n";
    $item .= "<changefreq>" . 'daily' . "</changefreq>\n";
    $item .= "</url>\n";
    return $item;
示例#4
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$j_id = $_POST['j_id'];
$j_time = $_POST['j_time'];
require_once 'joke.inc.php';
$joke = new Joke();
$joke->update_j_time($j_id, $j_time);
echo 'test';
示例#5
0
<!DOCTYPE html>
<?php 
require_once '../inc/mysql.inc.php';
require_once '../inc/joke.inc.php';
require_once '../inc/utils.inc.php';
$num = isset($_GET['num']) ? strip_tags(mysql_escape_string($_GET['num'])) : 1;
$Jokedao = new Joke();
$Joke = $Jokedao->find_by_id($num);
if ($Joke == null) {
    echo "<script>location.href='http://joke,setin.cn/';</script>";
    exit;
}
$nextid = $Jokedao->searchNextArticleID($num);
$preid = $Jokedao->searchPreArticleID($num);
Mysql::close();
$title = substr_ext($Joke['j_content'], 0, 30);
$title = preg_replace("/\\s/", "", $title);
$descrip = substr_ext($Joke['j_content'], 0, 100);
$descrip = preg_replace("/\\s/", "", $descrip);
?>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <meta name="renderer" content="webkit" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <meta http-equiv="Cache-Control" content="no-transform " /> 
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta name="keywords" content="笑话,文字笑话,笑话大全,笑话数据库,全网最全面的笑话数据库,<?php 
echo $Joke['j_tag'];
?>
示例#6
0
<?php

require_once '../inc/mysql.inc.php';
require_once '../inc/joke.inc.php';
$joke_dao = new Joke();
$joke_cnt = $joke_dao->count_all();
$num = rand(1, $joke_cnt);
$joke = $joke_dao->find_by_id($num);
$joke['j_pic'] = 'http://pomelo-setin.stor.sinaapp.com/' . rand(1, 4751) . '.jpg';
echo json_encode($joke);
Mysql::close();
示例#7
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$j_id = $_GET['j_id'];
$j_tag = $_POST['j_tag'];
//传入参数j_id和j_tag,如果j_tag为空,则返回content的值,否则更新tag到数据库中。
require_once 'joke.inc.php';
$joke = new Joke();
if (empty($j_tag)) {
    $content = $joke->find_by_id($j_id);
    echo $content['j_content'];
} else {
    $joke->update_j_tag($j_id, $j_tag);
}
echo 'test';