<?php namespace controllers; use Engine\X; use Engine\Route; /** * 首页 */ Route::get('index', function () { print vsprintf("%04d-%02d-%02d", ["k'3", 3, 4]); // 1988-08-01 });
<?php namespace controllers; use Engine\X; use Engine\Gvar; use Engine\Route; /** * 首页 */ Route::get('index', function () { $get = X::request()->get(['p' => 1]); list($count, $log) = X::module('post')->allByBanLog(Gvar::audit('company_id'), $get->p); X::render('audit/post', ['log' => $log, '__page_html' => defaultPageHtml($count, $get->p, '?')]); });
<?php namespace controllers; use Engine\X; use Engine\Gvar; use Engine\Route; /** * 添加脏词 */ Route::get('add', function () { X::render('audit/dirtyword_add'); }); Route::post('add', function () { $post = X::request()->post(['dirtyword' => '']); //添加脏词 X::module('dirtyword')->add(['words' => $post->dirtyword, 'company_id' => Gvar::audit('company_id')]); X::redirect("/audit/dirtyword/add"); }); Route::get('delete', function () { $get = X::request()->get(['id' => '']); //添加脏词 X::module('dirtyword')->del($get->id); echo "success"; });
X::db()->query("UPDATE banip \n\t\t\t\t\t\t\tSET valid_time = {$valid_time} ,\n\t\t\t\t\t\t\t\tattack_amount = attack_amount + 1\n\t\t\t\t\t\t\tWHERE ip_id = {$ipInfo['ip_id']}"); } //统计命中率 X::module('company')->statisticsHit($company['company_id']); apiOutput(YES, ['hit' => YES, 'dirty_works' => "ip({$post->client_ip})被拦截"]); } //命中脏词 if ($tutu['hit']) { //统计命中率 X::module('company')->statisticsHit($company['company_id']); //如果命中的词是公共库而且是要封ip的 if ($tutu['depot'] === 2) { $dwRow = X::module('dirtyword')->byGlobal($tutu['dirty_id']); if ($dwRow['if_deny_id'] === 1) { X::module('post')->banIp($post->client_ip); } } apiOutput(YES, ['hit' => YES, 'dirty_works' => $tutu['dirty_works'], 'dirty_works_category_id' => $tutu['dwcategory_id'], 'category_name' => $tutu['category_name'], 'depot' => $tutu['depot']]); } }); /** * ip检测API * *$post['if_spam'] = 0; //是否拦截水贴 *$post['if_duplicate_deny'] = 0; //重复内容超过次数禁IP *$post['if_spate_deny'] = 0; //短时间内大量发帖 * */ Route::get('ip', function () { echo 'ip'; });
/** * 查找 */ Route::get('search', function () { $get = X::request()->get(['search' => '']); $dw = X::module('dirtyword')->search($get->search); X::render('audit/index', ['dirtyword' => $dw]); }); /** * 登录 */ Route::get('signin', function () { X::render('audit/login'); }); Route::post('signin', function () { $post = X::request()->post(['account' => '', 'password' => '']); if (!$post->account || !$post->password) { X::redirect('/audit/signin'); } if ($company = X::module('company')->signin($post->account, $post->password)) { X::redirect('/audit'); } else { X::redirect('www.baidu.com'); } }); /** * 脏词管理 */ Route::get('dirtyword', function () { X::render('audit/dirtyword'); });