php安全开发05博客系统套用模板主题修改登录和后台样式

下载地址

https://www.codejie.net/5681.html

在这里插入图片描述
直接把这里的全部文件复制到admin目录下
在这里插入图片描述
访问www.moon.com/admin/index.html
在这里插入图片描述
将login.html的模板替换到admin/login.php

<?php
include_once 'init.php';
if($_POST['sub']) {
    $password = filterstr(md5($_POST['password']));
    $username = filterstr($_POST['username']);
    //echo $username;

    $result = $conn->query("select * from users where username = '$username'and password ='$password'");
    if($result->num_rows>0){
        $row = $result->fetch_assoc();
        //echo $row['username'];

        if($row['password'] == $password){
            echo "登录成功";
            $_SESSION['username'] = $row['username'];
            header('location:main.php');
            $conn->close();
        }else{
            echo "<script>alert('账户或密码错误')</script>";

        }
    }else{
        echo "<script>alert('账户或密码错误')</script>";
    }

}

?>

<!doctype html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>『博客』后台管理</title>
    <link rel="stylesheet" type="text/css" href="css/admin_login.css"/>
</head>
<script>
    function check(form){
        var username = form.username.value;
        if(username.length ==0){
            alert('用户不能为空');
            form.username.focus();
            return false;
        }
        var password = form.password.value;
        if(password.length ==0){
            alert('密码不能为空');
            form.password.focus();
            return false;
        }
        return true;
    }
</script>
<body>
<div class="admin_login_wrap">
    <h1>后台管理</h1>
    <div class="adming_login_border">
        <div class="admin_input">
            <form method="post" onsubmit="return check(this)">
                <ul class="admin_items">
                    <li>
                        <label for="username">用户名:</label>
                        <input type="text" name="username" id="username" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <label for="password">密码:</label>
                        <input type="password" name="password" id="password" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <input type="submit" tabindex="3" value="提交" name="sub" class="btn btn-primary" />
                    </li>
                </ul>
            </form>
        </div>
    </div>
    <p class="admin_copyright"><a tabindex="5" href="#" target="_blank">返回首页</a> &copy; 2014 Powered by 更多模板:<a href="http://www.mycodes.net/" target="_blank">源码之家</a></p>
</div>
</body>
</html>

<!--<html>
<head>
    <title>管理员登录</title>
    <style>
        .login{
            width: 400px;
            margin: 0px auto;
        }
    </style>
    <script>
        function check(form){
            var username = form.username.value;
            if(username.length ==0){
                alert('用户不能为空');
                form.username.focus();
                return false;
            }
            var password = form.password.value;
            if(password.length ==0){
                alert('密码不能为空');
                form.password.focus();
                return false;
            }
            return true;
        }
    </script>
</head>
<body>
<div class="login">
    <form method="post" onsubmit="return check(this)">
        <table>
            <tr><td><label for="username">用户</label></td><td><input type="text" name="username" id="username"></td></tr>
            <tr><td><label for="password">密码</label></td><td><input type="password" name="password" id="password"></td></tr>
            <tr><td colspan="2"><input type="submit" value="登录" name="sub"></td></tr>

        </table>
    </form>
</div>
</body>
</html>


访问/admin/login.php

在这里插入图片描述

后台模板修改将/admin/index.html的内容替换到admin/main.php
/admin/main.php

/*
<?php
include_once 'init.php';
if($_SESSION['username']){
    echo $_SESSION['username'];
}else{
    echo "验证失败";
}
?>
*/
<!doctype html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>简单通用文章系统后台管理模板</title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<div class="topbar-wrap white">
    <div class="topbar-inner clearfix">
        <div class="topbar-logo-wrap clearfix">
            <h1 class="topbar-logo none"><a href="index.html" class="navbar-brand">后台管理</a></h1>
            <ul class="navbar-list clearfix">
                <li><a class="on" href="index.html">首页</a></li>
                <li><a href="#" target="_blank">网站首页</a></li>
            </ul>
        </div>
        <div class="top-info-wrap">
            <ul class="top-info-list clearfix">
                <li><a href="#">管理员</a></li>
                <li><a href="#">修改密码</a></li>
                <li><a href="#">退出</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="container clearfix">
    <div class="sidebar-wrap">
        <div class="sidebar-title">
            <h1>菜单</h1>
        </div>
        <div class="sidebar-content">
            <ul class="sidebar-list">
                <li>
                    <a href="#"><i class="icon-font">&#xe003;</i>常用操作</a>
                    <ul class="sub-menu">
                        <li><a href="design.html"><i class="icon-font">&#xe008;</i>作品管理</a></li>
                        <li><a href="design.html"><i class="icon-font">&#xe005;</i>博文管理</a></li>
                        <li><a href="design.html"><i class="icon-font">&#xe006;</i>分类管理</a></li>

                        <li><a href="design.html"><i class="icon-font">&#xe052;</i>友情链接</a></li>

                    </ul>
                </li>
                <li>
                    <a href="#"><i class="icon-font">&#xe018;</i>系统管理</a>
                    <ul class="sub-menu">
                        <li><a href="system.html"><i class="icon-font">&#xe017;</i>系统设置</a></li>

                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">
        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font">&#xe06b;</i><span>欢迎使用『豪情』博客程序,建博的首选工具。</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-title">
                <h1>快捷操作</h1>
            </div>
            <div class="result-content">
                <div class="short-wrap">
                    <a href="insert.html"><i class="icon-font">&#xe001;</i>新增作品</a>
                    <a href="insert.html"><i class="icon-font">&#xe005;</i>新增博文</a>
                    <a href="insert.html"><i class="icon-font">&#xe048;</i>新增作品分类</a>
                    <a href="insert.html"><i class="icon-font">&#xe041;</i>新增博客分类</a>
                    <a href="#"><i class="icon-font">&#xe01e;</i>作品评论</a>
                </div>
            </div>
        </div>
        <div class="result-wrap">
            <div class="result-title">
                <h1>系统基本信息</h1>
            </div>
            <div class="result-content">
                <ul class="sys-info-list">
                    <li>
                        <label class="res-lab">操作系统</label><span class="res-info">WINNT</span>
                    </li>
                    <li>
                        <label class="res-lab">运行环境</label><span class="res-info">Apache/2.2.21 (Win64) PHP/5.3.10</span>
                    </li>
                    <li>
                        <label class="res-lab">PHP运行方式</label><span class="res-info">apache2handler</span>
                    </li>
                    <li>
                        <label class="res-lab">静静设计-版本</label><span class="res-info">v-0.1</span>
                    </li>
                    <li>
                        <label class="res-lab">上传附件限制</label><span class="res-info">2M</span>
                    </li>
                    <li>
                        <label class="res-lab">北京时间</label><span class="res-info">201431821:08:24</span>
                    </li>
                    <li>
                        <label class="res-lab">服务器域名/IP</label><span class="res-info">localhost [ 127.0.0.1 ]</span>
                    </li>
                    <li>
                        <label class="res-lab">Host</label><span class="res-info">127.0.0.1</span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="result-wrap">
            <div class="result-title">
                <h1>使用帮助</h1>
            </div>
            <div class="result-content">
                <ul class="sys-info-list">
                    <li>
                        <label class="res-lab">更多模板:</label><span class="res-info"><a href="http://www.codejie.net/" target="_blank">源码街-免费源码下载</a></span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!--/main-->
</div>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值