王老狗博客电话15858213085

烟台网站优化_烟台seo_烟台网络推广_烟台网站建设_王老狗博客电话15858213085

上一篇: 自媒体:申请成功的有sohu,新浪,网易,腾讯,头条,一点号, 下一篇:微信采集:意法服饰城文章采集有散文吧微头条,另外爱微帮微信啦微众圈需要提交才收录

<?php
/**
 * DouPHP
 * --------------------------------------------------------------------------------------------------
 * 版权所有 2013-2014 漳州豆壳网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.douco.com
 * --------------------------------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在遵守授权协议前提下对程序代码进行修改和使用;不允许对程序代码以任何形式任何目的的再发布。
 * 授权协议:http://www.douco.com/license.html
 * --------------------------------------------------------------------------------------------------
 * Author: DouCo
 * Release Date: 2014-06-05
 */
define('IN_DOUCO', true);
define('NO_CHECK', true);

require (dirname(__FILE__) . '/include/init.php');

// rec操作项的初始化
$rec = $check->is_rec($_REQUEST['rec']) ? $_REQUEST['rec'] : 'default';

// 赋值给模板
$smarty->assign('rec', $rec);

/**
 * +----------------------------------------------------------
 * 登录页
 * +----------------------------------------------------------
 */
if ($rec == 'default') {
    $smarty->display('login.htm');
}

/**
 * +----------------------------------------------------------
 * 登录验证
 * +----------------------------------------------------------
 */
elseif ($rec == 'login') {
    if ($check->is_captcha(trim($_POST['vcode'])) && $_CFG['captcha']) {
        $_POST['vcode'] = strtoupper(trim($_POST['vcode']));
    }
   
    if (!$_POST['user_name']) {
        $dou->dou_msg($_LANG['login_input_wrong'], 'login.php', 'out');
    } elseif (md5($_POST['vcode'] . DOU_SHELL) != $_SESSION['captcha'] && $_CFG['captcha']) {
        $dou->dou_msg($_LANG['login_vcode_wrong'], 'login.php', 'out');
    }
   
    $_POST['user_name'] = $check->is_username(trim($_POST['user_name'])) ? trim($_POST['user_name']) : '';
    $_POST['password'] = $check->is_password(trim($_POST['password'])) ? trim($_POST['password']) : '';
   
    $query = $dou->select($dou->table(admin), '*', "user_name = '$_POST[user_name]'");
    $user = $dou->fetch_array($query);
   
    if (!is_array($user)) {
        $dou->create_admin_log($_LANG['login_action'] . ': ' . $_POST['user_name'] . " ( " . $_LANG['login_user_name_wrong'] . " ) ");
        $dou->dou_msg($_LANG['login_input_wrong'], 'login.php', 'out');
    } elseif (md5($_POST['password']) != $user['password']) {
        if ($_POST['password']) {
            $dou->create_admin_log($_LANG['login_action'] . ': ' . $_POST['user_name'] . " ( " . $_LANG['login_password_wrong'] . " ) ");
        }
        $dou->dou_msg($_LANG['login_input_wrong'], 'login.php', 'out');
    }
   
    $_SESSION[DOU_ID]['user_id'] = $user['user_id'];
    $_SESSION[DOU_ID]['shell'] = md5($user['user_name'] . $user['password'] . DOU_SHELL);
    $_SESSION[DOU_ID]['ontime'] = time();
   
    $last_login = time();
    $last_ip = $dou->get_ip();
    $sql = "update " . $dou->table('admin') . " SET last_login = '$last_login', last_ip = '$last_ip' WHERE user_id = " . $user['user_id'];
    $dou->query($sql);
   
    $dou->create_admin_log($_LANG['login_action'] . ': ' . $_LANG['login_success']);
   
    header("Location: " . ROOT_URL . ADMIN_PATH . "/index.php\n");
    exit();
}

/**
 * +----------------------------------------------------------
 * 退出登录
 * +----------------------------------------------------------
 */
elseif ($rec == 'logout') {
    unset($_SESSION[DOU_ID]);
    header("Location: " . ROOT_URL . ADMIN_PATH . "/login.php\n");
}
?>

 

---------

一下是包含文件init.php的代码

<?php
/**
 * DouPHP
 * --------------------------------------------------------------------------------------------------
 * 版权所有 2013-2014 漳州豆壳网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.douco.com
 * --------------------------------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在遵守授权协议前提下对程序代码进行修改和使用;不允许对程序代码以任何形式任何目的的再发布。
 * 授权协议:http://www.douco.com/license.html
 * --------------------------------------------------------------------------------------------------
 * Author: DouCo
 * Release Date: 2014-06-05
 */
if (!defined('IN_DOUCO')) {
    die('Hacking attempt');
}

// error_reporting
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));

// 关闭 set_magic_quotes_runtime
@ set_magic_quotes_runtime(0);

// 调整时区
if (PHP_VERSION >= '5.1') {
    date_default_timezone_set('PRC');
}

// 取得当前站点所在的根目录
$root_url = dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) . "/";
define('ROOT_PATH', str_replace('include/init.php', '', str_replace('\\', '/', __FILE__)));
define('ROOT_URL', !defined('ROUTE') ? $root_url : str_replace('include/', '', $root_url));

if (!file_exists(ROOT_PATH . "data/install.lock")) {
    header("Location: " . ROOT_URL . "install/index.php\n");
    exit();
}

require (ROOT_PATH . 'data/config.php');
require (ROOT_PATH . 'include/smarty/Smarty.class.php');
require (ROOT_PATH . 'include/mysql.class.php');
require (ROOT_PATH . 'include/common.class.php');
require (ROOT_PATH . 'include/action.class.php');
require (ROOT_PATH . 'include/check.class.php');
require (ROOT_PATH . 'include/firewall.class.php');

// 实例化类
$dou = new Action($dbhost, $dbuser, $dbpass, $dbname, $prefix, DOU_CHARSET);
$check = new Check();
$firewall = new Firewall();

// 定义系统标示
define('DOU_SHELL', $dou->get_one("SELECT value FROM " . $dou->table('config') . " WHERE name = 'hash_code'"));
define('DOU_ID', 'dou_' . substr(md5(DOU_SHELL . 'dou'), 0, 5));

// 读取站点信息
$_CFG = $dou->get_config();

if (!defined('EXIT_INIT')) {
    // 设置页面缓存和编码
    header('Cache-control: private');
    header('Content-type: text/html; charset=' . DOU_CHARSET);
   
    // 载入语言文件
    require (ROOT_PATH . 'languages/' . $_CFG['language'] . '/common.lang.php');
    $_LANG['copyright'] = preg_replace('/d%/Ums', $_CFG['site_name'], $_LANG['copyright']);
   
    // 判断是否关闭站点
    if ($_CFG['site_closed']) {
        // 设置页面编码
        header('Content-type: text/html; charset=' . DOU_CHARSET);
       
        echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><div style=\"margin: 200px; text-align: center; font-size: 14px\"><p>" .
                 $_LANG['site_closed'] . "</p><p></p></div>";
        exit();
    }
   
    // 判断是否是移动设备
    if ($dou->is_mobile()) {
        $content_url = str_replace(ROOT_URL, '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
        header("Location: " . ROOT_URL . M_PATH . '/' . $content_url);
    }
   
    // 豆壳防火墙
    $firewall->dou_firewall();
   
    // 初始化数据
    $theme = $_CFG['site_theme'];
    if ($_CFG['qq']) {
        $_CFG['qq'] = $dou->dou_qq($_CFG['qq']);
    }
    $_CFG['guestbook_link'] = $dou->rewrite_url('guestbook');
    $_CFG['root_url'] = ROOT_URL;
   
    // SMARTY配置
    $smarty = new smarty();
    $smarty->config_dir = ROOT_PATH . 'include/smarty/Config_File.class.php'; // 目录变量
    $smarty->template_dir = ROOT_PATH . 'theme/' . $theme; // 模板存放目录
    $smarty->compile_dir = ROOT_PATH . 'cache'; // 编译目录
    $smarty->left_delimiter = '{'; // 左定界符
    $smarty->right_delimiter = '}'; // 右定界符
                                   
    // 如果编译和缓存目录不存在则建立
    if (!file_exists($smarty->compile_dir))
        mkdir($smarty->compile_dir, 0777);
       
        // 通用信息调用
    $smarty->assign("lang", $_LANG);
    $smarty->assign("site", $_CFG);
   
    // Smarty 过滤器
    function remove_html_comments($source, & $smarty) {
        global $theme;
        $theme_path = ROOT_URL . 'theme';
        $source = preg_replace('/images\//Ums', "theme/$theme/images/", $source);
        $source = preg_replace('/\.*\/theme\//Ums', 'theme/', $source);
        $source = preg_replace('/link href\=\"style\.css/Ums', "link href=\"theme/$theme/style.css", $source);
        $source = preg_replace('/theme\//Ums', "$theme_path/", $source);
        $source = preg_replace('/^<meta\shttp-equiv=["|\']Content-Type["|\']\scontent=["|\']text\/html;\scharset=(?:.*?)["|\'][^>]*?>\r?\n?/i', '', $source);
        return $source = preg_replace('/<!--.*{(.*)}.*-->/U', '{$1}', $source);
    }
    $smarty->register_prefilter('remove_html_comments');
}

// 开启缓冲区
ob_start();
?>

点击这里获取该日志的TrackBack引用地址

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于本文

您正在阅读的是:代码:豆壳后台登录页源代码
kevin482 发表于:2016-10-13 15:57:35
分类:IT信息技术
关键词:代码  

博客作者

王老狗博客电话15858213085

最近发表

最新评论及回复

最近留言

控制面板

Search

网站分类

文章归档

图标汇集

点击这里给我发消息

鲁ICP备09047409号-3