<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
*{font-family:微软雅黑;margin:0;padding:0;}
.pagination{margin:0 auto;text-align:center;margin-top:10px;}
div{border:1px solid;}
.menu_top li{list-style:none;float:left;width:20%;font-size:20px;}
.hzhb li{list-style:none;float:left;font-size:15.4px;line-height:25px;}
.left_menu{width:90%;margin:0 auto;}
.left_menu li{list-style:none;}
.input{height:35px;width:70%;}
.submit{width:100px;height:40px;font-size:20px;background:#FFB90F;border:none;border-radius:5px;color:#fff;}
.select_jzc{width:100px;height:35px;}
table tr td{height:50px;text-align:center;border:1px solid #FFC125;}
table tr th{height:50px;text-align:center;border:1px solid #FFC125;}
.top_tr{height:45px;}
.current{background:#FFEC8B;margin-left:10px;margin-right:10px;}
.num{margin-left:5px;margin-right:5px;}
</style>
</head>
<body>
<!--
<form action="__URL__/add" method="post">
<input type="text" name="user" />
<input type="text" name="phone" />
<input type="text" name="age" />
<input type="text" name=""
<
<input type="submit" name="sub" />
-->
<div style="height:1500px;width:100%;margin:0 auto;">
<div style="height:100px;font-weight:bold;width:100%;padding-left:12%;margin:0 auto;background:#.FFC125;color:#FF1493;font-size:50px;line-height:100px;">
<div style="width:59%;height:100%;float:left;">21世纪后台管理系统</div>
<div style="width:40%;height:100%;float:left;font-size:12px;">欢迎您,{$loginname}</div>
</div>
<div style="height:600px;width:75%;margin:0 auto;margin-top:1%;">
<div style="height:600px;width:20%;margin:0 auto;float:left;text-align:center;background:#FFEC8B.;">
<ul class="left_menu" style="width:90%;height:100%;margin:0 auto;line-height:90px;">
<li class="li_neirong">添加动态</li>
<li>添加动态</li>
<li>添加动态</li>
<li>添加动态</li>
<li>添加动态</li>
</ul>
</div>
<div style="min-height:600px;width:75%;margin:0 auto;float:right;">
<table style="width:100%;border:1px solid #FFC125" cellspacing="0" cellpadding="0">
<tr class="top_tr">
<th width="5%" >序号</th>
<th width="50%">标题</th>
<th width="10%">所属栏目</th>
<th width="20%">时间</th>
<th width="15%" align="center">编辑 | 删除</th>
</tr>
<volist name="list" id="vo">
<tr>
<td>{$vo.id}</td>
<td style="text-align:left;"> {$vo.title|subtext=25} </td>
<td>
<if condition="($vo.type eq 0)">动态
<elseif condition="$vo.type eq 1"/>指导
<else />常识
</if>
</td>
<td>{$vo.ctime}</td>
<td><a href="__URL__/modify?id={$vo.id}">编辑</a>
|
<a href="javascript:void(0);" class="del" data_id="{$vo.id}">删除</a>
</td>
</tr>
</volist>
</table>
<div class="pagination">{$page}</div>
</div>
</div>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(".prev").text("上一页");
$(".next").text("下一页");
$(".end").text("尾页");
var first=$(".current").text();
if(first==1){
$(".current").text("首页");
}
$(function(){
$(".del").click(function(){
var id = $(this).attr('data_id');
var delUrl = "__URL__/del";
if(confirm("确认要删除?")){
$.ajax({
url:delUrl,
data:{'id':id},
datatype:'json',
type:'post',
success:(function(data){
//jsondata = $.parseJSON(data);
//console.log(jsondata);
if(data.status == 1){
alert("删除成功!");
location=location;
}else{
alert("删除失败!");
}
})
})
}
})
})
</script>
</body>
</html>
<?php
namespace Home\Controller;
use Think\Controller;
class LoginController extends Controller {
public function index(){
//$Verify = new \Think\Verify();
//$code=$Verify->entry();
//$this->assign('code',$code);
$this->display();
}
public function login(){
$username = $_POST['username'];
$password = $_POST['password'];
//var_dump($_POST);
//exit;
$user = M("Admin"); // 实例化User对象
$result = $user->where('username='.$username. ' AND password='.$password)->find();
//echo $user->getLastSql();
if($result){
$data['status']=1;
$user = session('loginname',$username);
$this-assign('user',$user);
$this->ajaxReturn($data,'json');
}else{
$data['status']=0;
$this->ajaxReturn($data,'json');
}
}
} 最佳答案