load->library('session'); $this->load->library('input'); $this->load->library('email'); $this->load->library('pagination'); $this->load->library('image_lib'); $this->load->model('ne_model'); $this->load->model('banner'); $this->load->model('dx_auth/user_profile', 'user_profile'); //$this->load->model('dx_auth/users', 'users'); $this->load->helper('date'); $this->load->helper('psu'); $this->load->helper('file'); $this->load->helper('cookie'); $this->_init(); } public function _init() { $good_get_vars = ['p', 's', 'o', 'object', 'action', 'rooms', 'metro', 'price_ot', 'price_do', 'currency', 'price_for', 'street', 'id_ul', 'phrase', 'withfoto', 'floor_ot', 'floor_do', 'square_do', 'antiparser', 'from', 'id_list', 'square_ot', 'pg_user_contact_email', 'pg_need_email_notification', 'vip', 'item_ident', 'item_id', '', '', '', '', 'pg_salt', 'pg_order_id', 'pg_payment_id', 'pg_amount', 'pg_currency', 'pg_net_amount', 'pg_ps_amount', 'pg_ps_full_amount', 'pg_ps_currency', 'pg_payment_system', 'pg_result', 'pg_payment_date', 'pg_can_reject', 'pg_user_phone', 'pg_need_phone_notification', 'pg_card_brand', 'pg_card_pan', 'pg_card_hash', 'pg_auth_code', 'pg_captured', 'userid', 'pg_sig', 'pg_status', 'pg_description', 'pg_order_id', 'pg_payment_id', 'pg_card_brand', 'pg_card_pan', 'pg_card_hash', 'pg_auth_code', 'pg_captured', 'pg_failure_code', 'pg_failure_description', 'utm_source', 'utm_medium', 'utm_campaign', 'MNT_ID', 'MNT_TRANSACTION_ID', 'MNT_OPERATION_ID', '', '', '', '', '', '', '', '', '', '', '', '', '' ]; if(!empty($_GET)) { foreach($_GET as $key => $value) { if(!in_array($key, $good_get_vars)) show_404(); //if(in_array($key, $good_get_vars) && !$value) show_404(); } } if(isset($_GET['beg'])) show_404(); if(isset($_GET['s']) && $_GET['s'] == '') show_404(); $this->search_locker = md5(date("Y--m--d::H")); if(preg_match("/search.html/",uri_string())) { if(!isset($_GET['antiparser'])) die(''); //die('time out'); if($_GET['antiparser'] != $this->search_locker) redirect(''); } /* логируем поиск */ $parse_url = parse_url($_SERVER['REQUEST_URI']); if(isset($parse_url['query'])) { $path = $parse_url['path']; @parse_str($parse_url['query'], $parse_str); $parse_str['ip'] = $this->input->ip_address(); unset($parse_str['p']); $data['ip'] = $this->input->ip_address(); $data['vars'] = json_encode($parse_str); if(preg_match("/search.html/",$path) && count($parse_str)>2) $this->db->insert('search',$data); } /* логируем поиск */ // $this->ne_model->kill_mysql_old_pocess(); $this->ne_model->set_list_counts(); $this->menu_counts = $this->ne_model->get_list_counts(); $this->MC = new Memcached(); $this->MC->addServer('localhost', 11211); //$this->MC->flush(); $subdomen = $this->ne_model->gorod; if (preg_match("/www\./", $subdomen)) { $subdomen = str_replace("www.","",$subdomen); echo $subdomen; // redirect("http://".$subdomen.".egent.ru", 'location', 301); } //echo $_SERVER['HTTPS'] . " " . $_SERVER['SERVER_NAME']; if(preg_match("/85\.140\.0/",$this->input->ip_address())) { // show_404(); // exit(); } if(preg_match("/_html|\/\?sd|p=0|s=p=/",$_SERVER['REQUEST_URI'])) { /*if(preg_match("/\/\?sd/",$_SERVER['REQUEST_URI'])) mail("web@egent.ru","?sd", $_SERVER['REQUEST_URI'] . " " . $_SERVER['HTTP_REFERER'] . " " . $_SERVER['REMOTE_ADDR'] . " " . $_SERVER['HTTP_USER_AGENT'] );*/ show_404(); exit(); } if(preg_match("/index.php/",$_SERVER['REQUEST_URI'])) { // redirect('https://egent.ru', 'location', 301); // exit(); } if(isset($_SERVER['HTTPS'])) { // redirect('http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'], 'location', 301); // exit(); } $this->output->cache(0); $this->user = $this->ne_model->get_userdata($this->dx_auth->get_user_id()); if ($this->dx_auth->is_admin()) $this->output->enable_profiler(TRUE); $this->page_tags = $this->ne_model->get_page_tags($_SERVER['REQUEST_URI']); $this->tags = $this->ne_model->get_tags(); $this->incity = isset($this->tags->incity) ? $this->tags->incity : ""; $this->user_items = 0; if($this->dx_auth->get_user_id()) $this->user_items = $this->ne_model->get_items(NULL,NULL,$this->dx_auth->get_user_id(),NULL,NULL,1); //if($this->dx_auth->is_admin()) //print_r($tags); if($this->dx_auth->get_user_id()) $this->balans = $this->ne_model->getmoney($this->dx_auth->get_user_id()); /* уникальная переменная для новых фоток */ if(!get_cookie('tmp_dirname')) { $dirname = random_string('alnum',5); $tmp_dirname = array( 'name' => 'tmp_dirname', 'value' => $dirname, 'expire' => '100000', 'domain' => '.egent.ru', 'path' => '/', 'prefix' => '' ); set_cookie($tmp_dirname); } } }