示例#1
0
    $link = $_POST['link'];
    $pic_url = $_POST['pic_url'];
    $content = $_POST["content"];
    $mark = $_POST['mark'];
    $week = isset($_POST["week"]) ? $_POST["week"] : '';
    $ad_start_time = isset($_POST["ad_start_time"]) ? strtotime(trim($_POST["ad_start_time"])) : time();
    $ad_end_time = isset($_POST["ad_end_time"]) ? strtotime(trim($_POST["ad_end_time"])) : time();
    $out_title = isset($_POST["out_title"]) ? $_POST["out_title"] : '';
    $out_link = isset($_POST["out_link"]) ? $_POST["out_link"] : '';
    $out_pic_url = isset($_POST["out_pic_url"]) ? $_POST["out_pic_url"] : '';
    $status = isset($_POST["status"]) ? $_POST["status"] : '';
    if ($title == "" || $alias == "" || $name == "") {
        $updateMessage = "请把信息填写完整!!";
    } else {
        $sql = 'SELECT * FROM `ad` WHERE (`name`="' . $name . '" OR `alias`="' . $alias . '") AND `id`<>"' . $id . '"';
        $rs = $pdo->query($sql);
        $row = $rs->fetchAll();
        $count = count($row);
        if ($count == 0) {
            $row = array('title' => $title, 'alias' => $alias, 'name' => $name, 'content' => $content, 'link' => $link, 'pic_url' => $pic_url, 'mark' => $mark, 'week' => $week, 'ad_start_time' => $ad_start_time, 'ad_end_time' => $ad_end_time, 'out_title' => $out_title, 'out_link' => $out_link, 'out_pic_url' => $out_pic_url, 'status' => $status);
            $result = AdModel::model()->update(array('id' => $id), $row);
            if ($result > 0) {
                $updateMessage = "修改成功";
            } else {
                $updateMessage = "修改失败";
            }
        } else {
            $updateMessage = '标题或者别名重复!';
        }
    }
}
示例#2
0
    $mark = isset($_POST["mark"]) ? $_POST["mark"] : '';
    $link = isset($_POST["link"]) ? $_POST["link"] : '';
    $pic_url = isset($_POST["pic_url"]) ? $_POST["pic_url"] : '';
    $content = isset($_POST["content"]) ? $_POST["content"] : '';
    $week = isset($_POST["week"]) ? $_POST["week"] : '';
    $ad_start_time = isset($_POST["ad_start_time"]) ? strtotime(trim($_POST["ad_start_time"])) : time();
    $ad_end_time = isset($_POST["ad_end_time"]) ? strtotime(trim($_POST["ad_end_time"])) : time();
    $out_title = isset($_POST["out_title"]) ? $_POST["out_title"] : '';
    $out_link = isset($_POST["out_link"]) ? $_POST["out_link"] : '';
    $out_pic_url = isset($_POST["out_pic_url"]) ? $_POST["out_pic_url"] : '';
    $status = isset($_POST["status"]) ? $_POST["status"] : '';
    if ($title == "" || $alias == "") {
        $createMessage = "请把信息填写完整!!";
    } else {
        $sql = 'SELECT * FROM `ad` WHERE `alias`="' . $alias . '" AND `id`<>"' . $id . '"';
        $rs = $pdo->query($sql);
        $row = $rs->fetchAll();
        //取得所有记录
        $count = count($row);
        if ($count == 0) {
            $lastetId = AdModel::model()->create($_POST);
            if ($lastetId != FALSE) {
                $createMessage = "添加成功";
            } else {
                $createMessage = "添加失败";
            }
        } else {
            $createMessage = '【名称】或者【标题】或者【系统别名】重复!';
        }
    }
}
示例#3
0
$count = count($pdo->query($sql)->fetchAll());
$totalPage = ceil($count / $pageSize);
$init = 1;
$page_len = 9;
//页码个数
$max_p = $totalPage;
$pages = $totalPage;
//判断当前页码
if (empty($_GET['page']) || $_GET['page'] < 0) {
    $page = 1;
} else {
    $page = $_GET['page'];
}
$offset = $pageSize * ($page - 1);
$sql = $sql . " LIMIT {$offset},{$pageSize}";
$itemArr = AdModel::model()->findAllBySql($sql);
$page_len = $page_len % 2 ? $page_len : $pagelen + 1;
//页码个数
$pageoffset = ($page_len - 1) / 2;
//页码个数左右偏移量
$key = '<div class="page">';
$key .= "<span>{$page}/{$pages}</span> ";
//第几页,共几页
if ($page != 1) {
    $key .= "<a href=\"ad_manage.php?page=1\">首页</a> ";
    //第一页
    $key .= "<a href=\"ad_manage.php?page=" . ($page - 1) . "\">上一页</a>";
    //上一页
} else {
    $key .= "首页 ";
    //第一页