1. PHP / Говнокод #23130

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    public function sendChat ($msg) {
    	if($this->isLogged()){
    		if($this->checkAd($this->sql($msg)) !== '' || $this->checkAd($this->sql($msg))[0] !== ' '){
    			$q = $this->db->row("SELECT * FROM `chat` WHERE `user` = '".intval($_SESSION['steamid'])."' ORDER BY `id` DESC LIMIT 1");
    			if($q->time+1 <= time()){
    				if($q->text != $this->checkAd($this->sql($msg))) {
    					$r = $this->db->query("INSERT INTO `chat` (`user`,`text`,`time`) VALUES ('".intval($_SESSION['steamid'])."', '".$this->sql($this->checkAd($msg))."', ".time().")");
    					return json_encode(array("success" => true,));
    				} else {
    					return json_encode(array("success" => false, "msg" => "flood"));
    				}
    			} else {
    				return json_encode(array("success" => false, "msg" => "flood"));
    			}
    		} else {
    			json_encode(array("success" => false, "msg" => "null_msg"));
    		}
    	} else {
    		return json_encode(array("success" => false, "msg" => "not_auth"));
    	}
    }

    Запостил: enly1, 14 Июня 2017

    Комментарии (3) RSS

    Добавить комментарий