Example #1
0
function createThread($title, $description)
{
    require 'config.php';
    $showId = getShowId($_GET['showTitle']);
    $channelId = getChannelId($_GET['showTitle']);
    $sql = $connect->query("INSERT INTO `topics` values('', '{$title}', '{$username}', '{$now}', '{$description}', '{$channelId}', '{$showId}', '')");
}
        $count--;
    }
    //作业执行完毕,对结果进行入库
    if ($content) {
        $db = new MyDB();
        if ($key == 'total') {
            $valArr = explode("\t", $content);
            $sql = "update xxx set detailpv={$valArr['0']},detailuv={$valArr['1']} where analysisdate='{$yesterday}' and xxx=0 and xxx=0";
            //echo $sql . "\n";
            $res = $db->query($sql);
        } else {
            if ($key == 'category') {
                $lineArr = explode("\n", $content);
                foreach ($lineArr as $line) {
                    $valArr = explode("\t", $line);
                    $channelId = getChannelId($valArr[0]);
                    if (-1 != $channelId) {
                        $sql = "update xxx set detailpv={$valArr['1']},detailuv={$valArr['2']} where analysisdate='{$yesterday}' and xxx={$channelId} and xxx=0";
                        //echo $sql . "\n";
                        $res = $db->query($sql);
                    }
                }
            }
        }
        $db->close();
    }
}
$transport->close();
//返回频道对应的id号
function getChannelId($channel)
{
Example #3
0
function createThread($title)
{
    require 'config2.php';
    $showId = getShowId($_GET['showTitle']);
    $channelId = getChannelId($_GET['showTitle']);
    $title = strip_tags($title);
    $now = date('Y-m-d H:i:s');
    //$title = mysqli_real_escape_string($connect, $title);
    $username = $_SESSION['username'];
    //$sql = $connect->query("INSERT INTO `topics` values('', '$title', '$username', '$now', '', '$channelId', '$showId', '', '0')");
    //pdo
    $sql = "INSERT INTO `topics` values('', :title, :username, :now, '', :channelId, :showId, '', '0')";
    $stmt = $pdo->prepare($sql);
    $stmt->bindParam(":title", $title);
    //more flexible then bindValue;
    $stmt->bindParam(":username", $username);
    $stmt->bindParam(":now", $now);
    $stmt->bindParam(":channelId", $channelId);
    $stmt->bindParam(":showId", $showId);
    $stmt->execute();
}
Example #4
0
function createPost($message)
{
    require 'config2.php';
    $username = $_SESSION['username'];
    $dateTime = date('Y-m-d h:i:s');
    $topicId = $_GET['threadId'];
    $showId = getShowId(strip_tags($topicId));
    $channelId = getChannelId($showId);
    $message = strip_tags($message);
    //pdo
    $sql = "INSERT INTO `posts` VALUES('', :channelId, :topicId, :showId, :username, :message, :dateTime)";
    $stmt = $pdo->prepare($sql);
    $stmt->bindParam(":channelId", $channelId);
    //more flexible then bindValue;
    $stmt->bindParam(":topicId", $topicId);
    $stmt->bindParam(":username", $username);
    $stmt->bindParam(":dateTime", $dateTime);
    $stmt->bindParam(":message", $message);
    $stmt->bindParam(":showId", $showId);
    $stmt->execute();
}