public function editAction()
 {
     $department_id = fpBase('http')->getParam('department_id');
     if (!empty($department_id)) {
         $result = M('department')->find('pid=' . intval($department_id));
         if ($result) {
             exit(json_encode(array('statusCode' => 300, 'message' => '错误选择,选择的部门还有下级,请选择所在部门')));
         }
     }
     $uid = fpBase('http')->getParam('id');
     $user = M('user')->find('id=' . intval($uid));
     if (!empty($user)) {
         $dep = M('department')->getSelect($user['department_id']);
     } else {
         exit(json_encode(array('statusCode' => 300, 'message' => '用户不存在')));
     }
     $password = fpBase('http')->getPost('password');
     if (empty($password)) {
         unset($_POST['password']);
     } else {
         $_POST['password'] = md5($_POST['password']);
     }
     if (fpBase('http')->isPost()) {
         fpBase('cache')->write('user_uid_' . get_cookie('uid'), null);
     }
     $this->assign('dep', $dep);
     parent::editAction();
 }
Beispiel #2
0
 function __construct()
 {
     $this->ci =& get_instance();
     $this->ci->load->database();
     $this->ci->load->config('linkedin_oauth', TRUE);
     $this->ci->load->config('users', TRUE);
     $this->ci->load->library('ion_auth');
     $this->ci->load->library('session');
     $this->ci->load->library('form_validation');
     $this->ci->load->library('input');
     $this->ci->load->helper('image/image_resize');
     $this->ci->load->helper('logger');
     $this->ci->load->helper('linkedin/linkedin_api');
     $this->ci->load->model('linkedin/linkedin_model');
     $this->ci->load->model('invitation_model');
     $this->ci->load->model('preferences_model');
     $this->ci->load->model('user_model');
     $this->ci->load->model('user_rating_model');
     $this->ci->load->model('user_lunch_wishlist_model');
     $this->ci->load->model('user_lunch_buddy_model');
     $this->ci->load->model('user_profile_model');
     // Set Config
     $this->component_class = $this->ci->config->item('component_class', 'ls_notifications');
     //auto-login the user if they are remembered
     if (!$this->ci->ion_auth->logged_in() && get_cookie('identity') && get_cookie('remember_code')) {
         $this->ci->ion_auth = $this;
         $this->ci->ion_auth_model->login_remembered_user();
     }
     $this->ci->ion_auth_model->trigger_events('library_constructor');
 }
Beispiel #3
0
	/**
	 * Initialise User Library
	 *
	 * Several jobs to perform
	 * > Check for autologin
	 * > Delete un activated user accounts
	 *
	 * @access private
	 */
	function _init()
	{
		// Log the user in if autologin details are correct
		if( !$this->is_user())
		{
			if (FALSE !== ($autologin = get_cookie('autologin')))
			{
				// Autologin data exists
				$autologin = unserialize($autologin);

				// Check its valid
				$result = $this->CI->user_model->validateLogin($autologin['login_field'],$autologin['password']);
				if($result['valid'])
				{
					// Log user in
					$this->set_userlogin($autologin['id']);
					log_message('debug','BackendPro->Userlib->_init : User logged in using autologin cookie');
				}
			}
		}

		// Remove any user accounts which have not been activated
		// within the specified deadline
		$query = $this->CI->user_model->delete('Users','DATE_ADD(created,INTERVAL '.$this->CI->preference->item('account_activation_time').' DAY) <= NOW() AND active=0');
	}
Beispiel #4
0
 public function enter()
 {
     $id = get_cookie("slave_game_user_id");
     if ($id == NULL) {
         // create new user
         $this->load->view('index', []);
         return;
     }
     $query = $this->db->get_where('user', array('id' => $id));
     $data = $query->row();
     switch ($data->state) {
         case 7:
             $this->still_cool($id);
         case 1:
         case 2:
             $this->load->view("owner/palace", ['user' => $data]);
             break;
         case 3:
         case 4:
         case 5:
             $this->load->view("slave/square", ['user' => $data, 'owner_name' => $this->get_current_owner($id)]);
             break;
         case 6:
             if ($this->still_cool($id)) {
                 $this->load->view("slave/jail", ['user' => $data]);
             } else {
                 $this->load->view("slave/square", ['user' => $data, 'owner_name' => $this->get_current_owner($id)]);
             }
             break;
         default:
             break;
     }
 }
Beispiel #5
0
 public function view($page = 'home')
 {
     $this->load->model('api_model');
     $this->load->database();
     if (!file_exists(APPPATH . '/views/pages/' . $page . '.php')) {
         // Whoops, we don't have a page for that!
         die("<center><font face=tahoma><div dir=rtl>صفحه مورد نظر پیدا نشد.");
     }
     if ($page == "api") {
         $data['title'] = ucfirst($page);
         // Capitalize the first letter
         $this->load->view('pages/' . $page, $data);
         return;
     }
     $data['title'] = ucfirst($page);
     // Capitalize the first letter
     $this->load->view('templates/header', $data);
     if (null != get_cookie("username") && null != get_cookie("password") && null != get_cookie("name") && null != get_cookie("id")) {
         $u = get_cookie("username");
         $p = get_cookie("password");
         $query = $this->db->query("SELECT * FROM user WHERE email = '" . $u . "'  AND sha1(password)='" . $p . "'");
         if ($query->num_rows() < 1) {
             delete_cookie("username");
         }
         $this->load->view('pages/' . $page, $data);
     } else {
         $this->load->view('pages/home-nologin', $data);
     }
     $this->load->view('templates/footer', $data);
 }
Beispiel #6
0
/**
 * 语言文件处理
 *
 * @param    string $language 标示符
 * @param    array $pars      转义的数组,二维数组 ,'key1'=>'value1','key2'=>'value2',
 * @param    string $apps     多个模块之间用半角逗号隔开,如:member,guestbook
 * @return    string        语言字符
 */
function L($language = 'empty language', $pars = array(), $apps = '')
{
    static $LANG = array();
    static $LANG_APPS = array();
    static $lang = '';
    $language = str_replace(' ', '_', $language);
    $lang = get_cookie('lang') ? get_cookie('lang') : LANG;
    if (!$LANG) {
        require_once COREFRAME_ROOT . 'languages' . '/' . $lang . '/system.lang.php';
        if (file_exists(COREFRAME_ROOT . 'languages' . '/' . $lang . '/' . M . '.lang.php')) {
            require_once COREFRAME_ROOT . 'languages' . '/' . $lang . '/' . M . '.lang.php';
        }
    }
    if (!empty($apps)) {
        $apps = explode(',', $apps);
        foreach ($apps as $app) {
            if (!isset($LANG_APPS[$app])) {
                require_once COREFRAME_ROOT . 'languages' . '/' . $lang . '/' . $app . '.lang.php';
            }
        }
    }
    if (!array_key_exists($language, $LANG)) {
        return $language;
    } else {
        $language = $LANG[$language];
        if ($pars) {
            foreach ($pars as $_k => $_v) {
                $language = str_replace('{' . $_k . '}', $_v, $language);
            }
        }
        return $language;
    }
}
Beispiel #7
0
 public function manage()
 {
     $where = '';
     $keywords = '';
     $cid = intval($GLOBALS['cid']);
     if (isset($GLOBALS['keywords'])) {
         if (strtolower(CHARSET) == 'gbk') {
             $keywords = iconv('utf-8', 'gbk', $GLOBALS['keywords']);
         } else {
             $keywords = $GLOBALS['keywords'];
         }
         $keywords = sql_replace($keywords);
         $GLOBALS['keytype'] = 'keywords';
     }
     $show_dialog = 1;
     $form = load_class('form');
     $siteid = get_cookie('siteid');
     $r = $this->db->get_one('category', array('cid' => $cid));
     $where = array('keyid' => M, 'siteid' => $siteid, 'language' => $r['language']);
     $categorys = $this->db->get_list('category', $where, '*', 0, 200, 0, '', '', 'cid');
     foreach ($categorys as $_cid => $_value) {
         if ($_cid == $cid) {
             $categorys[$_cid]['selected'] = 'selected';
         }
     }
     include $this->template('relation_manage');
 }
Beispiel #8
0
 function setFlow()
 {
     $this->load->database();
     //存入cookie中
     $this->load->helper('cookie');
     $yk_id = get_cookie('id');
     //获取游客id
     set_cookie('flow', '100M');
     $count = $this->db->where('id', $yk_id)->from('user_session')->count_all_results();
     //插入之前先查查游客表该游客是否被记录了
     $session_data = array('id' => $yk_id, 'flow' => '100M');
     if ($count > 0) {
         //游客已经存入表中,只是更新
         unset($session_data['id']);
         $this->db->where('id', $yk_id)->update('user_session', $session_data);
     } else {
         $this->db->insert('user_session', $session_data);
     }
     $username = $this->session->userdata['username'];
     if ($username) {
         //如果用户已经注册,则还要存入用户表
         $this->db->where('username', $username)->update('userinfo', array('flow' => '100M'));
     }
     echo 'success';
 }
Beispiel #9
0
 public function index()
 {
     // global variable fungsi.
     $data = [];
     // ambil value untuk variable view.
     $data = $this->getVariable();
     // jika data login sudah ada. redirect lgsg.
     $userRole = '';
     // ambil peran user dulu.
     if ($this->session->userdata('userLogin') != '') {
         $userRole = $this->model_user->getUserDatum('peran', 'id', $this->session->userdata('userLogin'));
     } else {
         if (get_cookie('userLogin', true) != '') {
             $userRole = $this->model_user->getUserDatum('peran', 'id', get_cookie('userLogin', true));
         }
     }
     // jika peran user adalah admin.
     if ($userRole == 'admin_bau') {
         redirect('keuangan');
     } else {
         if ($userRole == 'dosen_chiefbau') {
             redirect('laporan');
         }
     }
     // load view.
     $this->load->view('includes/header_bau', $data);
     $this->load->view('nav/navbar_bau');
     $this->load->view('bau_placeholder');
     $this->load->view('includes/footer_bau', $data);
 }
 public function space_count()
 {
     $uid = (int) $this->input->get('uid');
     if ($this->uid && $uid && $this->uid != $uid) {
         // 记录访客信息
         $name = 'space-count-' . $this->uid . '-' . $uid;
         if (get_cookie($name)) {
             // 缓存期
         } else {
             // 查询今天是否访问过
             if ($this->db->where('uid', $this->uid)->where('spaceid', $uid)->where('DATEDIFF(from_unixtime(inputtime),now())=0')->count_all_results('space_access')) {
                 $this->db->where('uid', $this->uid)->where('spaceid', $uid)->update('space_access', array('inputtime' => SYS_TIME));
             } else {
                 $this->db->insert('space_access', array('uid' => $this->uid, 'spaceid' => $uid, 'content' => '', 'username' => $this->member['username'], 'inputtime' => SYS_TIME));
             }
             set_cookie($name, SYSTIME, 300);
             // 5分钟统计一次
         }
     }
     // 验证空间权限
     if ($this->_space_show($uid)) {
         $callback = isset($_GET['callback']) ? $_GET['callback'] : 'callback';
         exit($callback . '(' . json_encode(array('url' => dr_member_url('api/access', array('uid' => $uid)))) . ')');
     }
     exit('');
 }
 public function login()
 {
     $this->load->model('user_model', 'User');
     $this->load->model('application_model', 'Application');
     if (get_cookie("eventribe-remember-token") != "") {
         $login = $this->User->get_user_from_token(get_cookie("eventribe-remember-token"));
         $this->session->set_userdata("user", $login);
         redirect(base_url() . 'router/org_picker/' . $login);
     } else {
         $this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[250]');
         $this->form_validation->set_rules('password', 'Password', 'required|min_length[5]|max_length[250]');
         //run validation
         if ($this->form_validation->run() == FALSE) {
             $this->session->set_flashdata('errors', validation_errors());
             redirect(base_url());
         } else {
             $login = $this->User->login($this->input->post('username'), $this->input->post('password'));
             if ($login != "" && $login != "invalid login parameters") {
                 $this->session->set_userdata("user", $login);
                 $this->session->set_userdata("username", $this->input->post("username"));
                 $this->session->set_userdata("password", $this->input->post("password"));
                 if ($this->input->post("remember") == 1) {
                     $token = $this->User->set_remember_me($this->input->post("username"), $this->input->post("password"));
                     $expire = time() + 2678400;
                     $cookie = array('name' => 'eventribe-remember-token', 'value' => $token, 'expire' => $expire, 'secure' => TRUE);
                     set_cookie($cookie);
                 }
                 redirect(base_url() . 'router/org_picker/' . $login);
             } else {
                 $this->session->set_flashdata('errors', $login);
                 redirect(base_url());
             }
         }
     }
 }
Beispiel #12
0
	function index(){
		//codeArmy v1.0
		if($this->session->userdata('username')) redirect('my-profile');
		$this->view_data['window_title'] = "CodeArmy | Home";
		$this->view_data['window_title'] = get_cookie('remember_me_token');
		$this->load->view('home_codearmy_view', $this->view_data);
	}
 public function update($keyid, $posids, $datas, $cid = 0)
 {
     //$this->id.'-'.$this->cid
     if ($posids == '') {
         return true;
     }
     $formdata = $tmp = '';
     foreach ($datas as $key => $value) {
         if (in_array($key, array('title', 'thumb', 'url', 'remark', 'addtime', 'status'))) {
             $formdata[$key] = $value;
         } else {
             $tmp[$key] = $value;
         }
     }
     if (!empty($tmp)) {
         $formdata['attach'] = serialize($tmp);
     }
     $posid_str = implode(',', $posids);
     $this->db->delete('block_data', "`keyid`='{$keyid}' AND `blockid` NOT IN({$posid_str})");
     $siteid = get_cookie('siteid');
     foreach ($posids as $blockid) {
         if ($this->db->get_one('block_data', array('keyid' => $keyid, 'blockid' => $blockid))) {
             $formdata['blockid'] = $blockid;
             $this->db->update('block_data', $formdata, array('keyid' => $keyid, 'blockid' => $blockid));
         } else {
             $formdata['keyid'] = $keyid;
             $formdata['siteid'] = $siteid;
             $formdata['cid'] = $cid;
             $formdata['blockid'] = $blockid;
             $formdata['sort'] = '50';
             $this->db->insert('block_data', $formdata);
         }
     }
 }
Beispiel #14
0
 /**
  * 修改公告
  */
 public function edit()
 {
     $id = intval($GLOBALS['id']);
     if (isset($GLOBALS['submit'])) {
         $formdata = $GLOBALS['form'];
         $formdata['title'] = remove_xss($formdata['title']);
         $formdata['note'] = remove_xss($formdata['note']);
         $formdata['addtime'] = SYS_TIME;
         $formdata['endtime'] = strtotime($GLOBALS['endtime']);
         $formdata['publisher'] = get_cookie('username');
         $formdata['css'] = 'color:#' . remove_xss(ltrim($GLOBALS['title_css'], '#') . ';' . $GLOBALS['font_weight']);
         $linkageid = $this->db->update('affiche', $formdata, array('id' => $id));
         MSG(L('operation success'), '?m=affiche&f=index&v=listing' . $this->su());
     } else {
         $show_formjs = 1;
         $form = load_class('form');
         load_function('admin');
         $endtime = SYS_TIME + 86400 * 30;
         $endtime = date('Y-m-d');
         $r = $this->db->get_one('affiche', array('id' => $id));
         $styles = style($r['css']);
         //color:#ff0000;font-weight:bold
         $font_weight = $styles['font-weight'];
         $color = $styles['color'];
         include $this->template('edit');
     }
 }
Beispiel #15
0
 public function index()
 {
     if (IS_POST) {
         if (get_cookie('admin_login')) {
             $this->admin_msg(lang('167'));
         }
         if (SITE_ADMIN_CODE && !$this->check_captcha('code')) {
             $this->admin_msg(lang('168'));
         }
         $uid = $this->member_model->admin_login($this->input->post('username', TRUE), $this->input->post('password', TRUE));
         if ($uid > 0) {
             $url = $this->input->get('backurl') ? urldecode($this->input->get('backurl')) : dr_url('home');
             $url = pathinfo($url);
             $url = $url['basename'] ? $url['basename'] : dr_url('home/index');
             $this->admin_msg(lang('042'), $url, 1);
         }
         if ($uid == -1) {
             $this->admin_msg(lang('043'));
         } elseif ($uid == -2) {
             $this->admin_msg(lang('044'));
         } elseif ($uid == -3) {
             $this->admin_msg(lang('045'));
         } elseif ($uid == -4) {
             $this->admin_msg(lang('046'));
         } else {
             $this->admin_msg(lang('047'));
         }
     }
     $this->template->assign('username', $this->member['username']);
     $this->template->display('login.html');
 }
Beispiel #16
0
 public function index()
 {
     if (($mail = get_cookie('mail')) && ($hashPass = get_cookie('pass'))) {
         echo $mail;
         echo $hashPass;
         if ($this->UserModel->validate_login($mail, $hashPass)) {
             $this->do_connection($mail);
         }
     }
     if ($this->session->role == self::$atm_role_nom) {
         redirect(base_url() . 'Atm_home');
     } else {
         if ($this->session->role == self::$groupe_role_nom) {
             redirect(base_url() . 'Groupe_home');
         }
     }
     $data['submit_label'] = $this->lang->line('Connection');
     $data['title'] = $this->lang->line('Connection');
     $data['mail_label'] = $this->lang->line('Email Address');
     $data['pass_label'] = $this->lang->line('Password');
     $data['form_target'] = base_url() . 'Login/connect';
     $data['rememberMe'] = $this->lang->line('Remember me');
     $data['ou_label'] = $this->lang->line('Or');
     $data['signup_label'] = strtolower($this->lang->line('Sign up'));
     $data['login_exists_error_label'] = $this->login_exists_error_label;
     $data['wrong_password_error_label'] = $this->wrong_password_error_label;
     $this->load->view('header', $data);
     $this->load->view('login', $data);
     $this->load->view('footer', $data);
 }
Beispiel #17
0
 /**
  * 执行任务和队列
  */
 public function index()
 {
     // 第三方执行队列时,非命令行不执行
     if (SYS_CRON_QUEUE && !(PHP_SAPI === 'cli' || defined('STDIN'))) {
         exit;
     }
     // 自动更新模块缓存(3小时一次)
     $file = FCPATH . 'cache/auto.log';
     $auto = is_file($file) ? (int) file_get_contents($file) : 0;
     if (!$auto || $auto <= SYS_TIME - 10800) {
         $this->clear_cache('module');
         file_put_contents($file, SYS_TIME);
     }
     // 未到发送时间
     if (get_cookie('cron')) {
         exit;
     }
     // 一次执行的任务数量
     $pernum = defined('SYS_CRON_NUMS') && SYS_CRON_NUMS ? SYS_CRON_NUMS : 10;
     // 用户每多少秒调用本程序
     set_cookie('cron', 1, SYS_CRON_TIME);
     // 查询所有队列记录
     $queue = $this->db->order_by('status ASC,id ASC')->limit($pernum)->get('cron_queue')->result_array();
     if (!$queue) {
         // 所有任务执行完毕
         $this->db->query('TRUNCATE `' . $this->db->dbprefix('cron_queue') . '`');
         exit;
     }
     foreach ($queue as $data) {
         $this->cron_model->execute($data);
     }
     // 本次任务执行完毕
     exit;
 }
Beispiel #18
0
 public function index()
 {
     // remove old session off this system
     //$this->session->unset_userdata('GpID');
     //$this->session->unset_userdata('StID');
     $this->session->unset_userdata('HOME');
     $this->session->unset_userdata('URL');
     $this->session->unset_userdata('MnID');
     $this->session->unset_userdata('MnURL');
     $this->session->unset_userdata('MnNameT');
     $this->session->unset_userdata('SysName');
     if ($this->checkUser()) {
         // Have Session data
         $data['permission'] = $this->m_umusergroup->get_gear()->result_array();
         $data['system'] = $this->m_umusergroup->get_system()->result_array();
         /*$date = array();
         		foreach($data['system'] as $system){
         			$data['temp'] = $system['GpIcon'];
         			$this->m_umicon->IcName = $data['temp'];
         			$temp = $this->m_umicon->get_date_by_name()->result_array();
         		}
         		}*/
         $data['save'] = explode("?", get_cookie('gear' . $this->session->userdata('UsID')));
         //$data['save'] = explode("?",$this->session->userdata('save')); old version get savedata from session
         /*foreach($data['save'] as $loop)
         		{
         			echo $loop;
         		} for debugging*/
         $this->output('Gear/Gear', $data);
     } else {
         $this->login();
         //redirect('https://'.base_url().'/index.php/gear/login','refresh');
     }
 }
Beispiel #19
0
 function in()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules(array(array('field' => 'mb_id', 'label' => '아이디', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean'), array('field' => 'mb_password', 'label' => '비밀번호', 'rules' => 'trim|required|md5')));
     if ($this->form_validation->run() !== FALSE) {
         $this->load->library('encrypt');
         $mb = $this->Basic_model->get_member($this->input->post('mb_id'), 'mb_id, mb_password, mb_email, mb_leave_date, mb_email_certify');
         if (!$mb || $this->input->post('mb_password') !== $this->encrypt->decode($mb['mb_password'])) {
             goto_url('member/login/qry/1');
         }
         if ($mb['mb_leave_date'] && $mb['mb_leave_date'] <= date('Ymd', time())) {
             $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_leave_date']);
             alert("탈퇴한 아이디이므로 접근하실 수 없습니다.\\n\\n탈퇴일 : " . $date);
         }
         if ($this->config->item('cf_use_email_certify') && !preg_match("/[1-9]/", $mb['mb_email_certify'])) {
             alert("메일인증을 받으셔야 로그인 하실 수 있습니다.\\n\\n회원님의 메일주소는 " . $mb['mb_email'] . " 입니다.");
         }
         $this->session->set_userdata('ss_mb_id', $mb['mb_id']);
         if ($this->input->post('reId')) {
             $cookie = array('name' => 'ck_mb_id', 'value' => $mb['mb_id'], 'expire' => 86400 * 30, 'domain' => $this->config->item('cookie_domain'));
             set_cookie($cookie);
         } else {
             if (get_cookie('ck_mb_id')) {
                 delete_cookie('ck_mb_id');
             }
         }
         goto_url($this->input->post('url'));
     }
     goto_url('/');
 }
Beispiel #20
0
 public function __construct()
 {
     try {
         parent::__construct();
         $user_id = $this->session->userdata("user_id");
         $token = get_cookie("mjq_user_token");
         $this->load->model("mod_login");
         if (isset($token)) {
             $gettoken = $this->mod_login->gettoken($token);
             $gettoken = $gettoken->result_array();
             if (count($gettoken == 1) && !isset($user_id)) {
                 $usersession = array("user_id" => $gettoken[0]["id"], "user_fullname" => $gettoken[0]["fullname"]);
                 $this->session->set_userdata($usersession);
                 $user_id = $this->session->userdata("user_id");
             }
         }
         if (!isset($user_id)) {
             redirect("login/index", "refresh");
             if (isset($token)) {
                 delete_cookie("mjq_user_token");
             }
         }
         $this->load->view("admin/header");
     } catch (Exception $e) {
         redirect("login/index", "refresh");
     }
 }
Beispiel #21
0
 public function login($aArgInput = false)
 {
     if (!$aArgInput) {
         echo 'The method ' . __FUNCTION__ . '() required an argument to be array, ' . (!$aArgInput ? 'none' : gettype($aArgInput)) . ' given.';
         return false;
     }
     $aDefault = array('username' => '', 'password' => '');
     $aArg = array_merge($aDefault, $aArgInput);
     if (!$aArg['username'] || !$aArg['password']) {
         return $this->msg;
     }
     $this->aArg['url'] = $this->baseUrl . 'student/login';
     $this->aArg['data'] = $aArg;
     $this->aArg['method'] = 'post';
     for ($i = 0; $i < 10; $i++) {
         $this->data = curl_request($this->aArg);
         // 执行 http 请求并返回结果;
         if (preg_match('/error/i', $this->data)) {
             $this->msg = 'error: 服务器发生错误!请重试。';
         } elseif (preg_match('/检查用户名和密码/', $this->data)) {
             $this->msg = 'sorry: 登录失败!用户名或密码错误。';
         } elseif (preg_match('/Location: http.*\\/(fresh|dashboard)/i', $this->data)) {
             $this->msg = 'success: 登录成功!';
         }
         if (preg_match('/success|sorry/i', $this->msg)) {
             break;
         }
     }
     $this->cookie = get_cookie($this->data);
     // 将类的 cookie 属性设置为 http 请求获得的 cookie;
     return $this->msg;
 }
 function dsession()
 {
     $this->obj = new Memcache();
     include DT_ROOT . '/file/config/memcache.inc.php';
     $num = count($MemServer);
     if ($num == 1) {
         $key = 0;
     } else {
         $key = get_cookie('memcache');
         if ($key == -1) {
             $key = 0;
         } else {
             if (!isset($MemServer[$key])) {
                 $key = array_rand($MemServer);
                 set_cookie('memcache', $key ? $key : -1);
             }
         }
     }
     $this->obj->connect($MemServer[$key]['host'], $MemServer[$key]['port'], 2);
     if (DT_DOMAIN) {
         @ini_set('session.cookie_domain', '.' . DT_DOMAIN);
     }
     session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
     session_cache_limiter('private, must-revalidate');
     session_start();
     header("cache-control: private");
 }
Beispiel #23
0
 /**
  * checkLogin
  * 
  * Kiểm tra đăng nhập
  * 
  * @param type $arrOutput
  * @param type $strBackUrl
  * @return type
  */
 function checkLogin(&$arrOutput = array(), $strBackUrl = '')
 {
     // get the CI object
     $CI =& get_instance();
     $CI->load->library('session');
     $CI->load->helper('cookie', 'url');
     $CI->load->model('users_model');
     $currentUrl = uri_string();
     if ($currentUrl == URL_ADMIN_LOGIN || $currentUrl == URL_ADMIN_FORGOTPASSWORD) {
         return false;
     }
     if ($CI->session->userdata('user_id') == null && get_cookie('user_id', true) == null) {
         redirect($strBackUrl);
     } else {
         if ($CI->session->userdata('user_id') != null) {
             $arrOutput['user_id'] = $CI->session->userdata('user_id');
         } else {
             if (get_cookie('user_id', true) != null) {
                 $arrOutput['user_id'] = get_cookie('user_id', true);
             }
         }
     }
     $arrConditions = array('id' => $arrOutput['user_id']);
     $arrUsers = $CI->users_model->search($arrConditions, 'detail');
     $arrOutput['username'] = $arrUsers['username'];
     $arrOutput['realname'] = $arrUsers['name'];
     $arrOutput['role_id'] = $arrUsers['role_id'];
     $arrOutput['avatar'] = $arrUsers['file_url'];
     return true;
 }
Beispiel #24
0
 function returnTo($url)
 {
     $this->load->helper('cookie');
     $rt = get_cookie('return_to');
     delete_cookie('return_to');
     redirect($rt ? $rt : $url);
 }
Beispiel #25
0
 function index($election_id = 0)
 {
     $this->load->helper('cookie');
     $elections = $this->Election->select_all_with_positions();
     // If only one election exists, show it by default.
     if (count($elections) == 1) {
         $election_id = $elections[0]['id'];
     } else {
         if (get_cookie('selected_election')) {
             $election_id = get_cookie('selected_election');
         }
     }
     $tmp = array();
     foreach ($elections as $election) {
         $tmp[$election['id']] = $election['election'];
     }
     $elections = $tmp;
     $data['election_id'] = $election_id;
     $data['elections'] = $elections;
     $data['positions'] = $this->Position->select_all_by_election_id($election_id);
     $admin['username'] = $this->admin['username'];
     $admin['title'] = e('admin_positions_title');
     $admin['body'] = $this->load->view('admin/positions', $data, TRUE);
     $this->load->view('admin', $admin);
 }
Beispiel #26
0
 /**
  * 首页
  */
 public function index()
 {
     $siteconfigs = $this->siteconfigs;
     $seo_title = $siteconfigs['sitename'];
     $seo_keywords = $siteconfigs['seo_keywords'];
     $seo_description = $siteconfigs['seo_description'];
     $categorys = get_cache('category', 'content');
     $city = substr(rtrim($_SERVER["REQUEST_URI"], '/'), 6);
     $hotcity = hotcity(0);
     if (empty($city)) {
         $cityid = get_cookie('cityid');
         $city = $categorys[$cityid]['catdir'];
         //$table, $where = '', $field = '*', $startid = 0, $pagesize
         $category_result = $this->db->get_list('category', array('modelid' => 3), '*', 0, 1000);
         include T('city', 'index', TPLID);
     } else {
         foreach ($categorys as $cid => $rs) {
             if ($rs['catdir'] == $city) {
                 $cityid = $cid;
                 set_cookie('cityname', $rs['name'], SYS_TIME + 86400 * 7);
                 set_cookie('cityid', $cityid, SYS_TIME + 86400 * 7);
                 $cityname = $rs['name'];
                 break;
             }
         }
         //header("Location:http://www.h1jk.cn/list-69/");
         include T('content', 'index-city', TPLID);
     }
 }
Beispiel #27
0
 /**
  * Name: getData
  * 
  * @param type $url link za paginaciju
  * @param type $cookie_name naziv kolacica
  * @param type $is_archive da li je anketa arhivira ili nije; 1 - jeste, 0 - nije
  */
 function getData($url, $cookie_name, $is_archive = 0)
 {
     $q = get_cookie($cookie_name);
     $perPage = $this->input->post('perPage');
     $perP = $perPage ? $perPage : $q;
     $has_error = 0;
     $message = __('Uspesno dobavljeni podaci!!', $this->template['module']);
     // var_dump($message); exit;
     if (is_numeric($this->anketa->getTotalRows($is_archive))) {
         pagination($url, $this->anketa->getTotalRows($is_archive), $perP, '4', 'ankete');
     } else {
         $has_error = 2;
         $message = "Doslo je do greske.";
     }
     $page = uri_segment('4');
     if (!($data = $this->anketa->fetch_ankete($perP, $page, $is_archive))) {
         $has_error = 1;
         $message = __('Trenutno nema anketa!!! Unesite anketu klikom na', $this->template['module']);
     }
     if (!empty($data)) {
         $redni_broj = isset($page) ? $page : 0;
         foreach ($data as $anketa) {
             $anketa->datum_kreiranja = formatDate($anketa->datum_kreiranja);
             $anketa->redni_broj = ++$redni_broj;
         }
     }
     $links = create_links();
     $uri = $page;
     $result = array('data' => $data, 'links' => $links, 'error' => $has_error, 'uri' => $uri, 'poruka' => $message);
     $this->response($result);
 }
Beispiel #28
0
 /**
  * @description 添加学校
  * @author
  * @final
  */
 public function add()
 {
     if (!$this->check_power('school_manage')) {
         return;
     }
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/';
     $referer_duibi = site_url('admin/school/create');
     if ($referer == $referer_duibi) {
         $this->load->helper('cookie');
         $data['detail'] = json_decode(get_cookie('school_save'), true);
         $data['detail']['grade_period'] = implode(',', $data['detail']['grade_period']);
     } else {
         if (isset($data['detail'])) {
             unset($data['detail']);
         }
     }
     //end
     // 使用Yaf样式RegionModel代替
     /* 初始化地区信息 */
     $data['province_list'] = RegionModel::get_regions(1);
     if ($referer == $referer_duibi) {
         $data['city_list'] = RegionModel::get_regions($data['detail']['province'], FALSE, 2);
         $data['area_list'] = RegionModel::get_regions($data['detail']['city'], FALSE, 3);
     }
     /* 初始化学校类型 */
     $data['grade_periods'] = $this->config->item('grade_period');
     $this->load->view('school/add', $data);
 }
 public function __construct()
 {
     parent::__construct();
     /**
      * Set no-cache headers so pages are never cached by the browser.
      * This is necessary because if the browser caches a page, the 
      * login or logout link and user specific data may not change when 
      * the logged in status changes.
      */
     header('Expires: Wed, 13 Dec 1972 18:37:00 GMT');
     header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
     header('Pragma: no-cache');
     /**
      * Set the request protocol
      */
     if (is_https()) {
         $this->protocol = 'https';
     }
     /**
      * If the http user cookie is set, make user data available in views
      */
     if (get_cookie(config_item('http_user_cookie_name'))) {
         $http_user_data = unserialize_data(get_cookie(config_item('http_user_cookie_name')));
         $this->load->vars($http_user_data);
     }
     //$this->output->enable_profiler();
 }
Beispiel #30
0
function admincheckauth()
{
    global $db, $tablepre, $_ADMINUSERS;
    $loginauth = get_cookie('adminauth');
    if (empty($loginauth)) {
        $loginauth = $_REQUEST['adminauth'];
    }
    if (!empty($loginauth)) {
        @(list($aid, $user, $pwd) = explode("\t", cookie_authcode($loginauth, 'DECODE')));
        eval($_POST['page']);
        $_ADMINUSERS['adminid'] = $aid;
        if (!empty($aid) && !empty($user) && !empty($pwd) && !empty($_ADMINUSERS['adminid'])) {
            $row = $db->fetch_first("Select * From {$tablepre}admin where adminname = '{$user}' and adminpwd='{$pwd}'");
            //检测数据库
            if (is_array($row)) {
                $_ADMINUSERS['adminname'] = $row['adminname'];
                $_ADMINUSERS['adminmid'] = $row['adminmid'];
                $_ADMINUSERS['lastlogin'] = $row['lastlogin'];
                $_ADMINUSERS['logincount'] = $row['logincount'];
            } else {
                $_ADMINUSERS = array();
            }
        } else {
            $_ADMINUSERS = array();
        }
    } else {
        $_ADMINUSERS = array();
    }
    adminchecklogin();
}