基本信息
源码名称:php 微网站 实例源码(pc手机平板 均可浏览)
源码大小:1.97M
文件格式:.zip
开发语言:PHP
更新时间:2014-12-16
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<?php
class AdminAction extends CommAction {
public function _initialize(){
if(session('adminuser')!=C('webuser')){
$this->error('你没有权限',U('/Admin/Index/home'));
}
}
public function index(){
if($this->ispost()){
if(empty($_POST['user']) || empty($_POST['pwd'])){
$this->error('用户名密码不能为空');
}
$_POST['pwd']=MD5($_POST['pwd']);
$_POST['status']=1;
if(M('admin')->data($_POST)->add($_POST)){
$this->success('添加成功');
}else{
$this->error('添加失败');
}
}else{
$this->admin=M('admin')->order("id desc")->select();
$this->display();
}
}
public function edit(){
if($this->ispost()){
if(empty($_POST['user']) || empty($_POST['pwd'])){
$this->error('用户名密码不能为空');
}
$_POST['pwd']=MD5($_POST['pwd']);
if(M('admin')->data($_POST)->save($_POST)){
$this->success('修改成功',U('/Admin/Admin/index'));
}else{
$this->error('修改失败');
}
}else{
$this->admin=M('admin')->find($_GET['id']);
$this->display();
}
}
public function del(){
if(M('admin')->delete($_GET['id'])){
$this->success('删除成功');
}else{
$this->success('删除失败');
}
}
}