Example #1
0
<?php

/*
 *	DreamArticle Version3.0
 *	Copyright 2007-2008, iDreamSoft
 *	http://www.idreamsoft.cn
 *	By:coolmoo<*****@*****.**>
*/
require_once "global.php";
require_once "include/template.fun.php";
$do = $_GET['do'];
if (!$do) {
    $DreamCMS->message();
} elseif ($do == 'post') {
    if ($_POST['action'] == 'save') {
        checkverifycode(trim($_POST['chk']), $DreamCMS->language('error:seccode'), message);
        $user = array();
        $user["name"] = htmlspecialchars($_POST['name']);
        $user["m"] = intval($_POST['m']);
        $user["email"] = htmlspecialchars($_POST['mail']);
        $user["homepage"] = $_POST['homepage'] == 'http://' ? '' : htmlspecialchars($_POST['homepage']);
        $secret = $_POST['secret'];
        $messagetext = htmlspecialchars($_POST['messagetext']);
        //!eregi("^([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([a-z]{2,6})$",$user["email"])&&alert($DreamCMS->language('error:email'));
        !preg_match("/^([_\\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\\.([a-z]{2,6})\$/i", $user["email"]) && alert($DreamCMS->language('error:email'));
        //zhaoyanmin php5.3以上版本  eregi在php5.3以上版本改成preg_match
        !$messagetext && alert($DreamCMS->language('message:empty'));
        $userdate = serialize($user);
        !$secret && ($secret = 'off');
        $DreamCMS->db->query("INSERT INTO `#DC@__message`(`user`,`text`,`reply`,`secret`,`addtime`,`ip`)VALUES ('{$userdate}','{$messagetext}','','{$secret}','" . time() . "','" . getip() . "')");
        alert($DreamCMS->language('message:finish'), 'url:1');
Example #2
0
 *	Copyright 2007-2008, iDreamSoft
 *	http://www.idreamsoft.cn
 *	By:coolmoo<*****@*****.**>
*/
require_once "global.php";
require_once DCPATH . "include/template.fun.php";
$do = $_GET['do'];
if (empty($do)) {
    require_once DCPATH . "include/fckeditor.php";
    $editor = new FCKeditor('content');
    $editor->ToolbarSet = 'Guest';
    $DreamCMS->assign('editorHtml', $editor->CreateHtml());
    $DreamCMS->assign('cataOption', select_catalog(0, 0, 1, 1));
    echo $DreamCMS->DCPrint("DCSYSTEM", "post");
} elseif ($do == "post") {
    checkverifycode(trim($_POST['verifycode']), $DreamCMS->language('post:verifycode'), "post");
    $title = htmlspecialchars($_POST['title']);
    $cid = intval($_POST['catalog']);
    $source = htmlspecialchars($_POST['source']);
    $author = htmlspecialchars($_POST['author']);
    $description = htmlspecialchars($_POST['description']);
    $keywords = htmlspecialchars($_POST['keywords']);
    $tags = htmlspecialchars($_POST['tag']);
    $body = $_POST['content'];
    empty($title) && alert($DreamCMS->language('post:checktitlempty'));
    empty($cid) && alert($DreamCMS->language('post:checkcid'));
    empty($body) && alert($DreamCMS->language('post:checkbody'));
    isset($_POST['keywordToTag']) && ($tags = str_replace(',', ' ', $keywords));
    empty($description) && ($description = csubstr(HtmToText($body), $DreamCMS->config['descLen']));
    $_pic = uploadfile("pic", $title);
    $pic = $_pic['FilePath'];
Example #3
0
isset($_GET['page']) && ($page = (int) $_GET['page']);
$do = $_GET['do'];
$operation = !empty($_GET['operation']) && is_string($_GET['operation']) ? trim($_GET['operation']) : '';
$frames = isset($_GET['frames']) ? $_GET['frames'] : $_POST['frames'];
$action = $_POST['action'];
if ($do == 'logout') {
    //注销
    unset($_SESSION['admincode']);
    set_cookie("admincode", '', time() - 31536000);
    set_cookie("adminid", '', time() - 31536000);
    set_cookie("administrator", '', time() - 31536000);
    set_cookie("adminpassword", '', time() - 31536000);
    redirect('注销成功, 请稍后......', "admincp.php");
}
if ($action == "login") {
    checkverifycode(trim($_POST['verifycode']), '验证码错误!', "admin");
    $username = trim($_POST['username']);
    $password = md5(trim($_POST['password']));
    strlen($username) > 20 && alert('字段长度才20,你想输入多长?');
    if ($uid = checkadmin($username, $password)) {
        set_cookie('adminid', $uid, $cookietime);
        set_cookie('administrator', $username, $cookietime);
        set_cookie('adminpassword', $password, $cookietime);
        $DreamCMS->db->query("UPDATE `#DC@__members` SET `lastip`='" . getip() . "',`lastlogintime`='" . time() . "',`logintimes`=logintimes+1 WHERE `uid`='{$uid}'");
        redirect('登陆成功, 请稍候......', "admincp.php");
    } else {
        redirect('登陆失败!', "admincp.php");
    }
}
$administrator = get_cookie("administrator");
$adminpassword = get_cookie("adminpassword");