From 7b3e979fd41b7a2ad73a32777df50d9ffb09b48f Mon Sep 17 00:00:00 2001 From: martinzhou2015 <1009465756@qq.com> Date: Tue, 6 Oct 2015 20:25:13 +0800 Subject: [PATCH] Update 2015-10-06 --- .../Admin/Controller/BlogController.class.php | 101 +++++++ .../Admin/Controller/HallController.class.php | 97 +++++++ .../Admin/Controller/InfoController.class.php | 44 +++ .../Controller/LoginController.class.php | 6 + .../Admin/Controller/PostController.class.php | 29 +- Application/Admin/Model/BlogModel.class.php | 10 + Application/Admin/Model/HallModel.class.php | 9 + Application/Admin/View/Blog/add.html | 35 +++ Application/Admin/View/Blog/index.html | 43 +++ Application/Admin/View/Blog/update.html | 35 +++ Application/Admin/View/Hall/add.html | 17 ++ Application/Admin/View/Hall/index.html | 40 +++ Application/Admin/View/Hall/update.html | 18 ++ Application/Admin/View/Info/index.html | 45 +++ Application/Admin/View/Links/add.html | 2 +- Application/Admin/View/Links/update.html | 2 +- Application/Admin/View/Post/index.html | 2 +- Application/Admin/View/Post/send.html | 27 ++ Application/Admin/View/Public/sidebar.html | 17 +- Application/Common/Conf/config.php | 9 +- Application/Common/Conf/db.php | 2 +- .../Home/Controller/BlogController.class.php | 43 +++ .../Home/Controller/IndexController.class.php | 2 + Application/Home/View/Blog/index.html | 35 +++ Application/Home/View/Blog/view.html | 23 ++ Application/Home/View/Index/index.html | 49 +++- Application/Home/View/Public/footer.html | 20 +- Application/Home/View/Public/header.html | 3 +- Application/User/Conf/config.php | 2 +- .../Controller/ChangeController.class.php | 56 ++++ .../Controller/ForgetController.class.php | 60 ++++ .../User/Controller/InfoController.class.php | 78 ++++++ .../User/Controller/PostController.class.php | 2 +- Application/User/Model/ChangeModel.class.php | 11 + Application/User/Model/InfoModel.class.php | 25 ++ Application/User/View/Change/index.html | 32 +++ Application/User/View/Forget/index.html | 96 +++++++ Application/User/View/Index/index.html | 7 +- Application/User/View/Info/add.html | 33 +++ Application/User/View/Info/index.html | 42 +++ Application/User/View/Info/update.html | 33 +++ Application/User/View/Login/index.html | 21 +- Application/User/View/Public/footer.html | 18 +- Application/User/View/Public/header.html | 3 +- Application/User/View/Reg/index.html | 2 +- DB/srcms.sql | 262 ++++++++++++++++++ Public/Home/css/styles.css | 15 +- Public/Home/pic/douban.png | Bin 0 -> 1054 bytes Public/Home/pic/tencent.png | Bin 0 -> 849 bytes Public/Home/pic/wechat.png | Bin 0 -> 1341 bytes Public/Home/pic/weibo.png | Bin 0 -> 1588 bytes ThinkPHP/Library/Org/Net/Mail.class.php | 1 + 52 files changed, 1484 insertions(+), 80 deletions(-) create mode 100644 Application/Admin/Controller/BlogController.class.php create mode 100644 Application/Admin/Controller/HallController.class.php create mode 100644 Application/Admin/Controller/InfoController.class.php create mode 100644 Application/Admin/Model/BlogModel.class.php create mode 100644 Application/Admin/Model/HallModel.class.php create mode 100644 Application/Admin/View/Blog/add.html create mode 100644 Application/Admin/View/Blog/index.html create mode 100644 Application/Admin/View/Blog/update.html create mode 100644 Application/Admin/View/Hall/add.html create mode 100644 Application/Admin/View/Hall/index.html create mode 100644 Application/Admin/View/Hall/update.html create mode 100644 Application/Admin/View/Info/index.html create mode 100644 Application/Admin/View/Post/send.html create mode 100644 Application/Home/Controller/BlogController.class.php create mode 100644 Application/Home/View/Blog/index.html create mode 100644 Application/Home/View/Blog/view.html create mode 100644 Application/User/Controller/ChangeController.class.php create mode 100644 Application/User/Controller/ForgetController.class.php create mode 100644 Application/User/Controller/InfoController.class.php create mode 100644 Application/User/Model/ChangeModel.class.php create mode 100644 Application/User/Model/InfoModel.class.php create mode 100644 Application/User/View/Change/index.html create mode 100644 Application/User/View/Forget/index.html create mode 100644 Application/User/View/Info/add.html create mode 100644 Application/User/View/Info/index.html create mode 100644 Application/User/View/Info/update.html create mode 100644 DB/srcms.sql create mode 100644 Public/Home/pic/douban.png create mode 100644 Public/Home/pic/tencent.png create mode 100644 Public/Home/pic/wechat.png create mode 100644 Public/Home/pic/weibo.png create mode 100644 ThinkPHP/Library/Org/Net/Mail.class.php diff --git a/Application/Admin/Controller/BlogController.class.php b/Application/Admin/Controller/BlogController.class.php new file mode 100644 index 0000000..4f17314 --- /dev/null +++ b/Application/Admin/Controller/BlogController.class.php @@ -0,0 +1,101 @@ +where($where); + } + + $count = $model->where($where)->count();// 查询满足要求的总记录数 + $Page = new \Extend\Page($count,15);// 实例化分页类 传入总记录数和每页显示的记录数(25) + $show = $Page->show();// 分页显示输出 + $pages = $model->limit($Page->firstRow.','.$Page->listRows)->where($where)->order('id DESC')->select(); + $this->assign('model', $pages); + $this->assign('page',$show); + $this->display(); + } + + /** + * 添加博客 + */ + public function add() + { + //默认显示添加表单 + if (!IS_POST) { + $this->display(); + } + if (IS_POST) { + //如果用户提交数据 + $model = D("Blog"); + if (!$model->create()) { + // 如果创建失败 表示验证没有通过 输出错误提示信息 + $this->error($model->getError()); + exit(); + } else { + if ($model->add()) { + $this->success("添加成功", U('blog/index')); + } else { + $this->error("添加失败"); + } + } + } + } + /** + * 更新博客信息 + * @param [type] $id [单页ID] + * @return [type] [description] + */ + public function update() + { + $id = I('get.id',0,'intval'); + //默认显示添加表单 + if (!IS_POST) { + $model = M('blog')->where('id='.$id)->find(); + $this->assign('page',$model); + $this->display(); + } + if (IS_POST) { + $model = D("Blog"); + if (!$model->create()) { + $this->error($model->getError()); + }else{ + if ($model->save()) { + $this->success("更新成功", U('blog/index')); + } else { + $this->error("更新失败"); + } + } + } + } + /** + * 删除博客 + * @param [type] $id [description] + * @return [type] [description] + */ + public function delete() + { + $id = I('get.id',0,'intval'); + $model = M('blog'); + $result = $model->where("id=".$id)->delete(); + if($result){ + $this->success("删除成功", U('blog/index')); + }else{ + $this->error("删除失败"); + } + } +} diff --git a/Application/Admin/Controller/HallController.class.php b/Application/Admin/Controller/HallController.class.php new file mode 100644 index 0000000..d221615 --- /dev/null +++ b/Application/Admin/Controller/HallController.class.php @@ -0,0 +1,97 @@ +where($where); + } + + $count = $model->where($where)->count();// 查询满足要求的总记录数 + $Page = new \Extend\Page($count,15);// 实例化分页类 传入总记录数和每页显示的记录数(25) + $show = $Page->show();// 分页显示输出 + $hall = $model->limit($Page->firstRow.','.$Page->listRows)->where($where)->order('id DESC')->select(); + $this->assign('model', $hall); + $this->assign('page',$show); + $this->display(); + } + + /** + * 添加贡献者 + + public function add() + { + //默认显示添加表单 + if (!IS_POST) { + $this->display(); + } + if (IS_POST) { + //如果用户提交数据 + $model = D("hall"); + if (!$model->create()) { + // 如果创建失败 表示验证没有通过 输出错误提示信息 + $this->error($model->getError()); + exit(); + } else { + if ($model->add()) { + $this->success("添加成功", U('hall/index')); + } else { + $this->error("添加失败"); + } + } + } + } */ + + /** + * 更新贡献者信息 + */ + public function update() + { + $id = I('get.id',0,'intval'); + //默认显示添加表单 + if (!IS_POST) { + $model = M('hall')->where('id='.$id)->find(); + $this->assign('model',$model); + $this->display(); + } + if (IS_POST) { + $model = D("hall"); + if (!$model->create()) { + $this->error($model->getError()); + }else{ + if ($model->save()) { + $this->success("更新成功", U('hall/index')); + } else { + $this->error("更新失败"); + } + } + } + } + /** + * 删除贡献者 + */ + public function delete() + { + $id = I('get.id',0,'intval'); + $model = M('hall'); + $result = $model->delete($id); + if($result){ + $this->success("删除成功", U('hall/index')); + }else{ + $this->error("删除失败"); + } + } +} diff --git a/Application/Admin/Controller/InfoController.class.php b/Application/Admin/Controller/InfoController.class.php new file mode 100644 index 0000000..55d9fbe --- /dev/null +++ b/Application/Admin/Controller/InfoController.class.php @@ -0,0 +1,44 @@ +where($where); + } + + $count = $model->where($where)->count();// 查询满足要求的总记录数 + $Page = new \Extend\Page($count,15);// 实例化分页类 传入总记录数和每页显示的记录数(25) + $show = $Page->show();// 分页显示输出 + $pages = $model->limit($Page->firstRow.','.$Page->listRows)->where($where)->order('user_id DESC')->select(); + $this->assign('model', $pages); + $this->assign('page',$show); + $this->display(); + } + + public function delete() + { + $id = I('get.id',0,'intval'); + $model = M('info'); + $result = $model->where("user_id=".$id)->delete(); + if($result){ + $this->success("删除成功", U('info/index')); + }else{ + $this->error("删除失败"); + } + } +} diff --git a/Application/Admin/Controller/LoginController.class.php b/Application/Admin/Controller/LoginController.class.php index 34b23e3..3c83364 100644 --- a/Application/Admin/Controller/LoginController.class.php +++ b/Application/Admin/Controller/LoginController.class.php @@ -43,6 +43,12 @@ class LoginController extends Controller { if($member->save($data)){ session('adminId',$user['id']); session('username',$user['username']); + //发送验证码邮件 + import('ORG.Net.Mail'); + $ip = get_client_ip(); + $time = date("Y-m-d h:i:sa"); + $con='您好,您的后台管理账户 '.$username.' 于 '.$time.' 被登录,登录IP地址为 '.$ip.' 如果该操作非您本人操作,可能帐号信息已经被泄露,请您及时修改密码。 '; + SendMail('1009465756@qq.com','应急响应中心后台登录提示',$con,'应急响应中心'); //使用时注意将1009465756@qq.com修改为您的邮箱帐号 $this->success("登陆成功",U('Index/index')); } //定向之后台主页 diff --git a/Application/Admin/Controller/PostController.class.php b/Application/Admin/Controller/PostController.class.php index e2c1c88..9ea6656 100644 --- a/Application/Admin/Controller/PostController.class.php +++ b/Application/Admin/Controller/PostController.class.php @@ -124,4 +124,31 @@ class PostController extends BaseController $this->error("添加积分失败"); } } -} + + /** + * 分发漏洞报告 + * @param [type] $id [description] + * @return [type] [description] + */ + public function send() + { + import('ORG.Net.Mail'); + $id = I('get.id',0,'intval'); + $email = I('post.email'); + $title = I('post.title'); + $tips = I('post.tips'); + if (!IS_POST) { + $model = M('post')->where('id='.$id)->find(); + $this->assign('post',$model); + $this->display(); + } + if (IS_POST) { + $result = SendMail($email,$title,$tips,'应急响应中心'); + if($result){ + $this->success("发送成功", U('post/index')); + }else{ + $this->error("发送失败"); + } + } + } +} \ No newline at end of file diff --git a/Application/Admin/Model/BlogModel.class.php b/Application/Admin/Model/BlogModel.class.php new file mode 100644 index 0000000..358fa27 --- /dev/null +++ b/Application/Admin/Model/BlogModel.class.php @@ -0,0 +1,10 @@ + +
| 编号 | +分类 | +标题 | +操作 | +
|---|---|---|---|
| {$v.id} | +{$v.name} | +{$v.title} | +编辑 | 删除 | +
| 编号 | +贡献者 | +图片地址 | +操作 | +
|---|---|---|---|
| {$v.id} | +{$v.name} | +{$v.url} | +编辑 | 删除 | +
| 编号 | +用户名 | +真实姓名 | +住址 | +联系方式 | +邮编 | +操作 | +
|---|---|---|---|---|---|---|
| {$v.user_id} | +{$v.username} | +{$v.realname} | +{$v.location} | +{$v.tel} | +{$v.zipcode} | +删除 | +
diff --git a/Application/Home/View/Public/header.html b/Application/Home/View/Public/header.html index 55b7e05..3b2eecd 100644 --- a/Application/Home/View/Public/header.html +++ b/Application/Home/View/Public/header.html @@ -7,7 +7,7 @@ - + @@ -29,6 +29,7 @@
diff --git a/Application/User/Conf/config.php b/Application/User/Conf/config.php
index cc42ec6..634c0e7 100644
--- a/Application/User/Conf/config.php
+++ b/Application/User/Conf/config.php
@@ -1,4 +1,4 @@
'配置值'
+
);
\ No newline at end of file
diff --git a/Application/User/Controller/ChangeController.class.php b/Application/User/Controller/ChangeController.class.php
new file mode 100644
index 0000000..1991881
--- /dev/null
+++ b/Application/User/Controller/ChangeController.class.php
@@ -0,0 +1,56 @@
+ 2015-08-03
+ * @copyright ©2105-2018 SRCMS
+ * @homepage http://www.src.pw
+ * @version 1.0
+ */
+
+
+class ChangeController extends BaseController{
+ /**
+ * 显示更改密码页面
+ * @return [type] [description]
+ */
+ public function index()
+ {
+ $this->display();
+ }
+
+ /**
+ * 修改密码流程
+ */
+ public function change()
+ {
+ //验证请求方式
+ if(!IS_POST)$this->error("非法请求");
+ $member = M('member');
+ $id = session('userId');
+ $oldpassword =I('post.oldpassword','','md5');
+ $password =I('post.password','','md5');
+
+ //验证原密码
+ $user = $member->where(array('id'=>$id,'password'=>$oldpassword))->find();
+
+ if(!$user) {
+ $this->error('邮箱不存在 :(') ;
+ }
+
+ //验证账户是否管理员
+ if($user['type'] == 2){
+ $this->error('前台无法修改管理员密码 :(') ;
+ }
+
+
+ $member-> password=$password;
+ $result = $member->where(array('id'=>$id,'password'=>$oldpassword))->save();
+ if($result){
+ $this->success("修改成功",U('login/logout'));
+ }else{
+ $this->error('修改失败 :(') ;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Application/User/Controller/ForgetController.class.php b/Application/User/Controller/ForgetController.class.php
new file mode 100644
index 0000000..30048ba
--- /dev/null
+++ b/Application/User/Controller/ForgetController.class.php
@@ -0,0 +1,60 @@
+ 2015-07-27
+ * @copyright ©2105-2018 SRCMS
+ * @homepage http://www.src.pw
+ * @version 1.0
+ */
+
+class ForgetController extends Controller {
+ //显示找回密码页面
+ public function index(){
+ $this->display();
+ }
+ //找回密码逻辑
+ public function find(){
+ if(!IS_POST)$this->error("非法请求");
+ $member = M('member');
+ $email =I('post.email','','email');
+ $username =I('post.username');
+ //$code = I('verify','','strtolower');
+ //验证验证码是否正确
+ //if(!($this->check_verify($code))){
+ //$this->error('验证码错误');
+ //}
+ //验证输入邮箱是否存在
+ $user = $member->where(array('username'=>$username,'email'=>$email))->find();
+
+ if(!$user) {
+ $this->error('邮箱不存在 :(') ;
+ }
+ //验证账户是否被禁用
+ if($user['status'] == 0){
+ $this->error('账号被禁用,无法找回密码 :(') ;
+ }
+
+ if($user['type'] == 2){
+ $this->error('前台无法重置管理员密码 :(') ;
+ }
+
+ //发送验证码邮件
+ import('ORG.Net.Mail');
+ $str = '1234567890abcdefghijklmnopqrstuvwxyz';
+ $passwd=$str[rand(0,35)].$str[rand(0,35)].$str[rand(0,35)].$str[rand(0,35)].$str[rand(0,35)].$str[rand(0,35)];
+ $content = md5($passwd);
+ $member = M('member');
+ $member-> password=$content;
+ $member ->where(array('username'=>$username,'email'=>$email))->save();
+ $con='您好您正在找回密码,您的临时新密码为'.$passwd.'请您妥善保管,登陆平台后请及时修改密码';
+ if(SendMail($email,'找回密码',$con,'应急响应中心')){
+ $this->success("发送成功",U('login/index'));
+ }else{
+ $this->error('账号被禁用 :(') ;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/Application/User/Controller/InfoController.class.php b/Application/User/Controller/InfoController.class.php
new file mode 100644
index 0000000..28ed5aa
--- /dev/null
+++ b/Application/User/Controller/InfoController.class.php
@@ -0,0 +1,78 @@
+ 2015-08-02
+ * @copyright ©2105-2018 SRCMS
+ * @homepage http://www.src.pw
+ * @version 1.0
+ */
+
+class InfoController extends BaseController{
+
+ public function index(){
+ $id = session('userId');
+ $info = M('info')->where('user_id='.$id)->select();
+ $this->assign('info',$info);
+ $this->display();
+ }
+
+ /**
+ * 添加联系方式
+ */
+ public function add()
+ {
+ //默认显示添加表单
+ if (!IS_POST) {
+ $this->display();
+ }
+ if (IS_POST) {
+ //如果用户提交数据
+ $model = D("info");
+ $model->user_id = 1;
+ $model->username = 1;
+ if (!$model->create()) {
+ // 如果创建失败 表示验证没有通过 输出错误提示信息
+ $this->error($model->getError());
+ exit();
+ } else {
+ if ($model->add()) {
+ $this->success("添加成功", U('info/index'));
+ } else {
+ $this->error("添加失败");
+ }
+ }
+ }
+ }
+
+ /**
+ * 更新联系方式
+ */
+
+ public function update()
+ {
+ //默认显示添加表单
+ if (!IS_POST) {
+ $this->display();
+ }
+ if (IS_POST) {
+ //如果用户提交数据
+ $model = D("info");
+ $model->user_id = 1;
+ $model->username = 1;
+ if (!$model->create()) {
+ // 如果创建失败 表示验证没有通过 输出错误提示信息
+ $this->error($model->getError());
+ exit();
+ } else {
+ if ($model->save()) {
+ $this->success("更新成功", U('info/index'));
+ } else {
+ $this->error("更新失败");
+ }
+ }
+ }
+ }
+
+}
diff --git a/Application/User/Controller/PostController.class.php b/Application/User/Controller/PostController.class.php
index 23122f8..4556fcd 100644
--- a/Application/User/Controller/PostController.class.php
+++ b/Application/User/Controller/PostController.class.php
@@ -9,7 +9,7 @@ use Think\Controller;
* @version 1.0
*/
-class PostController extends Controller
+class PostController extends BaseController
{
/**
* 漏洞报告列表
diff --git a/Application/User/Model/ChangeModel.class.php b/Application/User/Model/ChangeModel.class.php
new file mode 100644
index 0000000..7084f4f
--- /dev/null
+++ b/Application/User/Model/ChangeModel.class.php
@@ -0,0 +1,11 @@
+
+
+ 更改密码
+
+
+
+ + +
+ + + + + + + +
+