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

    +146

    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
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    if ($url=='/news/index.html')
    {
    	$data = $this->dbf->execute('select * from news where status=1 order by date_add desc,id desc limit 10');
    	$object->smarty->assign('news_body',$data);
    	$object->smarty->assign('title','Новости');
    } elseif(preg_match('@/news/([0-9]+?)/@i',$url,$out)){
    			$data = $this->dbf->execute('select * from news where status=1 and id='.intval($out[1]).' order by date_add desc limit 1');
    			$object->smarty->assign('news_body',$data);
    			$object->smarty->assign('title','Новости');			
    } elseif($url=='/search/') {
    	$data = array();
    			
    	if ($_POST['search']!='' && strlen($_POST['search'])>6)
    	{
    		$data = $this->dbf->execute('select * from pages where content like "%'.mysql_real_escape_string($_POST['search'],$this->dbh->conn).'%" limit 10');
    	}
    	$object->smarty->assign('search',$data);
    	$object->smarty->assign('title','Поиск');
    	$object->smarty->assign('news',$this->dbh->execute('select * from news where status=1 order by date_add desc limit 3'));
    			
    } else {
    	$data = $this->dbf->execute('select * from pages where link="'.mysql_real_escape_string($url,$this->dbh->conn).'"');
    	$this->data = $data[0];
    	$object->smarty->assign('title',$this->data['title']);
    	$object->smarty->assign('news',$this->dbh->execute('select * from news where status=1 order by date_add desc limit 3'));
    }

    Запостил: laplay, 29 Ноября 2011

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

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