Skip to content

Commit

Permalink
finish illegal Scan
Browse files Browse the repository at this point in the history
  • Loading branch information
aimerforreimu committed Apr 4, 2018
1 parent 72a9d3d commit bd0bce8
Show file tree
Hide file tree
Showing 20 changed files with 894 additions and 356 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/aimer.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

475 changes: 242 additions & 233 deletions .idea/workspace.xml

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions application/admin/controller/AdminController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* Created by aimer.
* User: aimer
* Date: 2018/4/4
* Time: 下午4:00
*/

namespace admin\controller;


use framework\core\Controller;
use framework\core\Factory;
use framework\tools\Regex;

class AdminController extends Controller
{
public function settingAction()
{
if ($this->isLogin()) {
$a_model = Factory::M('user');
$name = $_SESSION['user'];
$admin = $a_model->getInfo($name);
$this->smarty->assign('admin', $admin[0]);
$this->smarty->display('admin/setting.html');
} else {
$this->showActionInfo('请登录', null, '/?c=user&a=loginAction', '登录', 2000);
}
}

public function doResetPassWord()
{
if ($this->isLogin()) {
//Check Authenticate
if ($_POST['authenticate'] == $GLOBALS['config']['authenticate_code']) {
//Check password is same or not
if ($_POST['password'] == $_POST['password-repeat']) {
$regexTest = new Regex();
//Use Regex Tool to check password regular
$checkPassword = $regexTest->checkPassWord($_POST['password']);
if ($checkPassword) {
//Update
$a_model = Factory::M('User');
$admin['password'] = md5($_POST['password']);
$where['admin_id'] = $_POST['admin_id'];
$a_model->update($admin, $where);

//Logout
if (empty($_SESSION['user'])) {
$this->showActionInfo(null, null, nulll, null, 0);
die;
}
unset($_SESSION['user']);
setcookie('uname', '', time() - 1);
setcookie('keysid', '', time() - 1);
$this->showActionInfo('更改成功,请重新登录', null, null, null, 20000);

} else {
$this->showActionInfo('密码不符合要求', null, null, null, 2000);
}
} else {
$this->showActionInfo('两次密码不匹配', null, null, null, 2000);
}
} else {
$this->showActionInfo('验证秘钥不正确', null, null, null, 2000);
}
} else {
$this->showActionInfo('请登录', null, '/?c=user&a=loginAction', '登录', 2000);
}
}

}
4 changes: 2 additions & 2 deletions application/admin/controller/ApiController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ public function makejson()
$en = new encrypt();
$va = $en->encrypt(md5(time()), $GLOBALS['config']['en_key']);
$arr = array(
'user_id' => mt_rand(1,100),
'user_id' => 0,//mt_rand(1, 100)
'user_pic' => 'https://xxxxxxxx',
'user_name' => uniqid('user_',true),
'user_name' => 'Unknow',//uniqid('user_',true)
'time' => time(),
'token' => $va,
'status' => '1'
Expand Down
56 changes: 56 additions & 0 deletions application/admin/controller/IllegalScanController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Created by aimer.
* User: aimer
* Date: 2018/4/4
* Time: 下午2:27
*/

namespace admin\controller;


use framework\core\Controller;
use framework\core\Factory;
use framework\tools\Page;

class IllegalScanController extends Controller
{
public function illegalScanUserDashBroad()
{
if ($this->isLogin()) {
$s_model = Factory::M('Scan');

$page = new Page();
$illegal_scans_num = $page->total_pages = $s_model->getIllegalScanCount();

//How many data in one page
$page->url = '/?m=admin&c=illegalScan&a=illegalScanUserDashBroad&';
$page->pagesize = $GLOBALS['config']['page_limit'];
//Now page
$page->now_page = isset($_GET['page']) ? $_GET['page'] : 1;
$offset = ($page->now_page - 1) * $page->pagesize;
$limit = $page->pagesize;
//Get All Illegal Scan Info
$illegal_scans = $s_model->getIllegalScan($offset, $limit);
$page_bar = $page->create();
$this->smarty->assign('illegal_scans', $illegal_scans);
$this->smarty->assign('illegal_num', $illegal_scans_num);
$this->smarty->assign('page_bar', $page_bar);
$this->smarty->display('illegal/illegal.html');
} else {
$this->showActionInfo('请登录', null, '/?c=user&a=loginAction', '登录', 2000);
}
}

public function illegalScanDetail()
{
if ($this->isLogin()) {
$s_model = Factory::M('Scan');
$detail = $s_model->getIllegalScanDetail($_GET['s_id']);
$this->smarty->assign('detail',$detail[0]);
$this->smarty->display('illegal/illegal_detail.html');
} else {
$this->showActionInfo('请登录', null, '/?c=user&a=loginAction', '登录', 2000);
}
}
}
6 changes: 4 additions & 2 deletions application/admin/controller/ScanController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class ScanController extends Controller
public function showDelete()
{
if ($this->isLogin()) {
$this->showActionInfo('警告', '您真的想要删除吗,删除以后数据不可恢复,请慎重', "/?m=admin&c=scan&a=doScanDelete&scan_id=".$_GET['scan_id']."&u_id=".$_GET['u_id'], '点击删除', 200000);
isset($_GET['u_id'])?$fix = "&u_id=".$_GET['u_id'] : $fix = '';
$this->showActionInfo('警告', '您真的想要删除吗,删除以后数据不可恢复,请慎重', "/?m=admin&c=scan&a=doScanDelete&scan_id=".$_GET['scan_id'].$fix, '点击删除', 200000);
} else {
$this->showActionInfo('请登录', null, '/?c=user&a=loginAction', '登录', 2000);
}
Expand All @@ -28,7 +29,8 @@ public function doScanDelete()
if ($this->isLogin()) {
$s_model = Factory::M('Scan');
$s_model->delete($_GET['scan_id']);
$this->showActionInfo('删除成功',null,'/?m=admin&c=user&a=userDetail&u_id='.$_GET['u_id'],'返回',2000);
isset($_GET['u_id'])?$fix = '/?m=admin&c=user&a=userDetail&u_id='.$_GET['u_id'] : $fix = '/?m=admin&c=illegalScan&a=illegalScanUserDashBroad';
$this->showActionInfo('删除成功',null,$fix,'返回',2000);
} else {
$this->showActionInfo('请登录', null, '/?c=user&a=loginAction', '登录', 2000);
}
Expand Down
2 changes: 1 addition & 1 deletion application/admin/model/RegisterUserModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getNum()

public function getAllUserInfo($offset,$limit)
{
$sql = "SELECT ru.*,COUNT(s.user_id) AS scan_num FROM `face_scan` AS s LEFT JOIN `face_register_user` AS ru ON s.user_id=ru.user_id GROUP BY ru.user_id ORDER BY s.user_id LIMIT $offset,$limit";
$sql = "SELECT ru.*,COUNT(s.user_id) AS scan_num FROM `face_scan` AS s LEFT JOIN `face_register_user` AS ru ON s.user_id=ru.user_id WHERE s.user_id!=0 GROUP BY ru.user_id ORDER BY s.user_id LIMIT $offset,$limit";
return $this->dao->fetchAll($sql);

}
Expand Down
20 changes: 20 additions & 0 deletions application/admin/model/ScanModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,24 @@ public function getScanNum($user_id)
$data = $this->dao->fetchAll($sql);
return $data[0]['scan_num'];
}

public function getIllegalScan($offset,$limit)
{
$sql = "SELECT * FROM `face_scan` WHERE user_id=0 LIMIT $offset,$limit";
return $this->dao->fetchAll($sql);
}

public function getIllegalScanCount()
{
$sql = "SELECT count(user_id) AS illegal_num FROM `face_scan` WHERE user_id=0";
$data = $this->dao->fetchAll($sql);
return $data[0]['illegal_num'];
}

public function getIllegalScanDetail($s_id)
{
$where['scan_id'] = $s_id;
return $this->find(null,$where);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,40 @@ <h1>用户设置</h1>
<div class="panel-body" id="packs">
<div class="col-md-8">
<div class="row fix">
<div class="col-md-3 option_name"><label for="uid">UID:</label></div>
<div class="col-md-9">
<div class="non_input">user_id</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="admin_id">管理员UID:</label>
</div>
<div class="col-md-9">
<div class="non_input"><{$admin['admin_id']}></div>
</div>
</div>
</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="nick">昵称:</label></div>
<div class="col-md-6">
<input type="text" class="form-control" id="nick" value="user_id">
<div class="col-md-3 option_name"><label for="uid">管理员名称:</label></div>
<div class="col-md-9">
<div class="non_input"><{$admin['name']}></div>
</div>
</div>

<div class="row fix">
<div class="col-md-3 option_name"><label for="email">Email:</label></div>
<div class="col-md-9">
<input type="email" class="form-control" id="email" value="user_id"
<input type="email" class="form-control" id="email"
value="<{$admin['email']}>"
disabled>
</div>
</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail">注册日期:</label>
</div>
<div class="col-md-9">
<div class="non_input ">user_id</div>
<div class="non_input "><{$admin['reg_time']|date_format:'%Y-%m-%d
%H:%M:%S'}>
</div>
</div>
</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail"></label></div>
<div class="col-md-9">
<div class="non_input ">
<button class="btn btn-raised btn-primary" id="saveNick">保存更改
</button>
</div>
</div>
</div>
Expand All @@ -72,55 +74,30 @@ <h1>用户设置</h1>
</div>
</div>
</div>
<div class="tab-pane fade" id="security">
<div class="panel panel-default">
<div class="panel-body">
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail">开启注册:</label></div>
<div class="col-md-9">
<div>
<div class="togglebutton">
<label>
<input type="checkbox" id="homePage" checked>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="password">
<div class="panel panel-default">
<div class="panel-body">
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail">原密码:</label></div>
<div class="col-md-6">
<input type="password" class="form-control" id="passOrigin">
<form id="registerForm" method="post" action="/?m=admin&c=admin&a=doResetPassWord">
<div class="form-group label-floating">
<label class="control-label" for="inputPwd">新密码 : 最少6位,必须含有数字和字母</label>
<input type="password" class="form-control" id="inputPwd" name="password">
</div>
</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail">新密码:</label></div>
<div class="col-md-6">
<input type="password" class="form-control" id="passNew">
<div class="form-group label-floating">
<label class="control-label" for="inputPwd">重复密码 : 最少6位,必须含有数字和字母</label>
<input type="password" class="form-control" id="inputPwd"
name="password-repeat">
</div>
</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail">确认新密码:</label></div>
<div class="col-md-6">
<input type="password" class="form-control" id="passNewRepet">
<div class="input-group form-group label-floating">
<label class="control-label" for="inputPwd">认证秘钥</label>
<input type="password" class="form-control" id="inputPwd" name="authenticate">
</div>
</div>
<div class="row fix">
<div class="col-md-3 option_name"><label for="inputEmail"></label></div>
<div class="col-md-9">
<div class="non_input ">
<button class="btn btn-raised btn-primary waves-effect" id="savePwd">
保存更改
</button>
</div>
<input type="hidden" name="admin_id" value="<{$admin['admin_id']}>">
<div class="input-group form-group label-floating">
<input type="submit" value="重置" class="btn btn-raised btn-primary"
id="regButton">
</div>
</div>

</form>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion application/admin/view/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h3>成功识别</h3>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-default" style="background-color: #78909c">
<div class="panel panel-default" style="background-color: #ef4349">
<div class="panel-body">
<div class="panel-title">
<h3>非法识别</h3>
Expand Down
Loading

0 comments on commit bd0bce8

Please sign in to comment.