1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- *
- * IndexAction.class.php (前台首页)
- *
- */
- if(!defined("Ainaphp")) exit("Access Denied");
- class IndexAction extends BaseAction
- {
- public function index()
- {
- $this->assign('bcid',0);//顶级栏目
- $this->assign('ishome','home');
- $this->display();
- }
- public function message(){
- $mod = M("message");
- $_POST = get_safe_replace($_POST);
- if(false!==$mod->create()){
- $mod->status = 1;
- $mod->lang = 1;
- $mod->createtime = time();
- $mod->updatetime = time();
- $mod->add();
- $this->success("提交成功");
- }else{
- $this->error("提交失败");
- }
- }
-
- public function apply()
- {
- session_start();
- $this->stop_request();
- $mod = M("try");
- $_POST = get_safe_replace($_POST);
- if (false !== $mod->create()) {
- $mod->status = 1;
- $mod->lang = 1;
- $mod->createtime = time();
- $mod->updatetime = time();
- $mod->add();
- $this->success("提交成功");
- } else {
- $this->error("提交失败");
- }
- }
-
- //防止恶意请求
- public function stop_request(){
- $allow_sep = '120';
- if (isset($_SESSION["moban_apply"])){
- if (time() - $_SESSION["moban_apply"] < $allow_sep){
- $this->error('请不要反复提交~');
- }else{
- $_SESSION["moban_apply"] = time();
- }
- }
- $_SESSION["moban_apply"] = time();
- }
-
- }
- ?>
|