private function save_view_infomation() { if (is_login()) { $new['time'] = time(); $new['date'] = date("Y-m-d"); if (_sess('statistics')) { $statistics = _sess('statistics'); $staytime = time() - $statistics['time']; $secondes = intval(c('online_seconds')) < 60 ? 300 : intval(c('online_seconds')); if ($statistics['date'] == date("Y-m-d") && $staytime > 60 && $staytime < $secondes) { if (_sess('online_date') == $statistics['date']) { lazy_run_sql("update `u2_user` set `online_today` = `online_today` + {$staytime} , `onlinetime` = `onlinetime` + {$staytime} where `id` = '" . format_uid() . "' limit 1"); } else { lazy_run_sql("update `u2_user` set `online_date` = '" . date("Y-m-d") . "' , `online_today` = {$staytime} , `onlinetime` = `onlinetime` + {$staytime} where `id` = '" . format_uid() . "' limit 1"); $res['online_date'] = date("Y-m-d"); } } elseif ($statistics['date'] == date("Y-m-d") && $staytime < 60) { $new = $statistics; } } $res['statistics'] = $new; set_sess($res); $this->load->database(); $uid = format_uid(); $data['u2_stay_time'] = date("Y-m-d H:i:s"); $data['u2_stay_location'] = $_SERVER['REQUEST_URI']; $data['u2_sid'] = _sess('session_id'); $data['u2_uid'] = $uid; $this->db->select('count(*)')->from('u2_online')->where('u2_uid', $uid); if (lazy_get_var()) { $this->db->where('u2_uid', $uid); $this->db->update('u2_online', $data); } else { $this->db->insert('u2_online', $data); } } }
function save_blogset($type) { $uid = format_uid(); $data['u2_miniblog'] = serialize($type); $this->db->where('id', $uid); $this->db->update('u2_user', $data); set_sess($data); }
function newpasssave($uid = NULL, $pincode = NULL) { if (!$this->user->check_pincode($uid, $pincode)) { info_page(_text('user_forgetpass_check_false', '<a href="/user/forgetpass">', '</a>')); } $psw1 = v('psw1'); $psw2 = v('psw2'); if (!$psw1) { info_page(_text('user_resetpass_is_null')); } if ($psw1 != $psw2) { info_page(_text('user_resetpass_not_same')); } $this->user->resetpass_by_uid($psw1, $uid); $pincode = $this->user->new_pincode($uid); $user = $this->user->load_user_information_by_uid($uid); set_sess($user); info_page(_text('user_resetpass_success'), '/', _text('system_back_to_index')); }
function touser($id) { $this->check_admin(); $user = $this->admin->get_user_by_uid($id); if (!$user) { info_page(_text('user_error_login_bad_uid')); die; } elseif ($user['u2_level'] >= _sess('u2_level')) { info_page(_text('system_limit_rights')); die; } set_sess($user); header('Location: /'); }
function show_snotice($id, $name) { if (is_login()) { $id = intval($id); if ($id) { lazy_run_sql("update `u2_user` set `u2_snotice` = '{$id}' where `id` = '" . format_uid() . "' limit 1"); $data['u2_snotice'] = $id; set_sess($data); } $nowid = _sess('u2_snotice'); $now = date("Y-m-d"); $line = lazy_get_line("select * from `u2_snotice` where `id` > '{$nowid}' and `start_time` <= '{$now}' and `end_time` >= '{$now}' order by `id` ASC limit 1 "); if ($line) { $newid = $line['id']; $html = '<span class="r"><a href="JavaScript:void(0)" onclick="show_snotice(\'' . $name . '\',\'' . $newid . '\')"><img src="/static/images/cross.gif"></a></span>'; echo $html . $line['desp']; } } }
private function save_viewed_item($id) { $id = intval($id); if ($id > 0) { $shopinfo = _sess('shopinfo'); $viewed = isset($shopinfo['viewed']) ? $shopinfo['viewed'] : array(); if (!in_array($id, $viewed)) { while (count($viewed) >= 5) { array_shift($viewed); } $viewed[] = $id; } $shopinfo['viewed'] = $viewed; $data['shopinfo'] = $shopinfo; set_sess($data); } }