<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Welcome extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     * 		http://example.com/index.php/welcome
     * 	- or -  
     * 		http://example.com/index.php/welcome/index
     * 	- or -
     * Since this controller is set as the default controller in 
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    public function index() {
        echo 'index';
    }

    //跳转函数，用来跟踪PPC订单，或者newsletter链接等等
    public function redirect() {
        //要转向的URL
        $url = $this->input->get('url');

        //订单类型 Google PPC 32034   Bing PPC  32035
        $typecode = $this->input->get('code');
        if (!empty($typecode)) {
            set_cookie('inquireTrackFrom', $typecode, 604800); //604800秒=7天过期时间
        }

        //获取google的搜索来源
        if (isset($_SERVER['HTTP_REFERER'])) {
            $inquireTrackGoogle = $_SERVER['HTTP_REFERER'];
            set_cookie('inquireTrackGoogle', $inquireTrackGoogle, 604800); //604800秒=7天过期时间
        }

        redirect($url);
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */