function force_session_restart($id_author) { include_lcm('inc_session'); global $author_session, $lcm_session; zap_sessions($id_author, true); if ($author_session['id_author'] == $id_author) { lcm_debug("lcm_session = " . $lcm_session); delete_session($lcm_session); } else { lcm_debug("I am ID = " . $author_session['id_author']); } }
function save_session($session, $player) { if ($fd = fopen('save.csv', 'a+')) { if (flock($fd, LOCK_EX | LOCK_NB)) { $db = get_database(); if (isset($db[$player])) { delete_session($db, $player); } fputcsv($fd, array('player' => $player, 'session' => serialize($session)), ';'); flock($fd, LOCK_UN); } fclose($fd); } }
function aunthenticate() { $branch = 0; if (empty($_SESSION)) { // check if a session existed before $output .= "\n session variables are not set \ncurrent session id:" . session_id(); $branch = 1; } else { if (is_session_valid()) { update_session_time(); $branch = 3; //go to home page } else { delete_session(); $branch = 2; //go to login } } if ($branch == 1 or $branch == 2) { header("Location: login.php"); } else { // proceed to } }
<?php /* * hyCMS * Copyright(C)2009 by Peter Neubauer * Published under the terms of the Lesser GNU General Public License v2 * */ include "session.php"; delete_session(); echo "Logged out";
$sql = "SELECT * FROM " . $GLOBALS["DB_PREFIX"] . "Member AS M, "; $sql .= $GLOBALS["DB_PREFIX"] . "Registration as R "; $sql .= "WHERE M.RegisterID = R.RegisterID "; //$sql .= "WHERE PrivilegeTypeID > 1 "; $sql .= "ORDER BY M.PrivilegeTypeID DESC, R.LastName ASC"; $result = $db->Execute($sql); $users = array(); while ($user = $result->FetchNextObj()) { $users[] = $user; } return $users; } $sessionID = $_GET["id"]; // Perform session deletion if ($_POST["Submit"] == "Delete") { delete_session($_POST["SessionID"]); } if ($_POST["Submit"] == "Delete" || $_POST["Submit"] == "Cancel") { $url = "Location: sessions.php"; header($url); } // Confirm session deletion if ($_GET["delete"]) { $session = get_session_info($sessionID); $track = get_track_info($session->TrackID); $type = get_presentation_info($session->PresentationTypeID); $sessionSlotsInfo = get_session_slots_info($session->SessionID); do_html_header("Delete Session", &$err_message); ?> <br /> <table align="center">
$cible = new Link("index.php"); } else { $cible = new Link(); } // [ML] XXX uses current page, but this can create strange bugs.. } // Replay the cookie to renew lcm_session if (_request('change_session') == 'yes' || _request('change_session') == 'oui') { if (verifier_session($_COOKIE['lcm_session'])) { // Warning: only the user with the correct IP has the right to replay // the cookie, therefore a cookie theft cannot disconnect the vitim // but be disconnected by her. if ($author_session['hash_env'] == hash_env()) { $author_session['ip_change'] = false; $cookie = creer_cookie_session($author_session); delete_session($_COOKIE['lcm_session']); lcm_setcookie('lcm_session', $cookie); } @header('Content-Type: image/gif'); @header('Expires: 0'); @header("Cache-Control: no-store, no-cache, must-revalidate"); @header('Pragma: no-cache'); @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); @readfile('ecrire/img_pack/rien.gif'); // XXX change this exit; } } // If cookie_admin == no, delete the lcm_admin cookie // This is the "connect with another identifier" on the login page $cookie_admin = _request('cookie_admin');
private function synlogout($get, $post) { if (!self::API_SYNLOGOUT) { return self::API_RETURN_FORBIDDEN; } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); #$this->load->library('session'); #$this->session->sess_destroy(); delete_session(); ci_set_cookie('user', '', null); return self::API_RETURN_SUCCEED; }
/** * 차단 삭제 * @author KangMin * @since 2011.11.23 */ public function del_block() { $data = NULL; if (!defined('USER_INFO_idx') or defined('USER_INFO_idx') && USER_INFO_group_idx !== SETTING_admin_group_idx) { delete_session(); $this->layout->view_admin('login_view'); } else { //rules $this->form_validation->set_rules('idx', 'INDEX', 'trim|required|xss_clean|is_natural_no_zero'); //폼검증 성공이면 if ($this->form_validation->run() == TRUE) { $this->load->model('client_ip_block_model'); $this->client_ip_block_model->del_client_ip_block($this->form_validation->set_value('idx')); $data['message'] = lang('delete_success'); $data['redirect'] = '/admin/ip/block'; } $this->layout->view_admin_only_contents('alert_view', $data); } //로그인,권한 체크 end if }
function supprimer_session($id_session) { lcm_log("supprimer_session: deprecated, call delete_session() instead"); return delete_session($id_session); }
/** * 테마 복사 * * @author 배강민 */ public function copy_theme() { $this->load->model('themes_model'); $idx = $this->input->get('idx'); if (!$idx) { $idx = 0; } $type = $this->input->get('type'); if (!in_array($type, array('M', 'P'))) { $type = 'M'; } $result_source = $this->themes_model->get_theme($type, $idx); if (!defined('USER_INFO_idx') or defined('USER_INFO_idx') && USER_INFO_group_idx !== SETTING_admin_group_idx or count($result_source) !== 1) { delete_session(); $this->layout->view_admin('login_view'); } else { $title = substr('Copy Of ' . $result_source->title, 0, 100); $folder_name = $result_source->folder_name . '_copy_' . time(); $type_folder = $result_source->type == 'M' ? 'mobile' : 'pc'; $source = 'front_end/themes/' . $type_folder . '/' . $result_source->folder_name; $target = 'front_end/themes/' . $type_folder . '/' . $folder_name; //source 폴더가 있고, target 폴더가 없는지 확인 if (file_exists($source) == FALSE or file_exists($target) == TRUE) { $data['message'] = lang('theme_copy_folder_check_fail_msg'); } else { if (SETTING_OS == 'WIN') { $source_win = str_replace('/', "\\", $source); $target_win = str_replace('/', "\\", $target); exec("xcopy {$source_win} {$target_win} /e/i"); } else { exec("cp -r {$source} {$target}"); } if (file_exists($target) == TRUE) { $result_theme = $this->themes_model->insert_theme($result_source->type, $idx, $title, $folder_name); if ($result_theme == TRUE) { $data['message'] = lang('theme_copy_success_msg'); } else { $data['message'] = lang('theme_copy_fail_msg'); } } else { $data['message'] = lang('theme_copy_fail_msg'); } } $data['redirect'] = '/admin/setting/themes'; $this->layout->view_admin_only_contents('alert_view', $data); } }
/** * Process a logout. */ function handle_active_logout() { // Kill cookie // $expire=time()-300; $member_cookie_name = get_member_cookie(); $colon_pos = strpos($member_cookie_name, ':'); if ($colon_pos !== false) { $base = substr($member_cookie_name, 0, $colon_pos); } else { $real_member_cookie = get_member_cookie(); $base = $real_member_cookie; } ocp_eatcookie($base); unset($_COOKIE[$base]); // Kill session $session = get_session_id(); if ($session != -1) { delete_session($session); } }
/** * 차단된 IP (후킹에 있던걸 공용 확장한 코어로 이동) * @author KangMin * @since 2011.11.17 */ public function block_client_ip() { $CI =& get_instance(); $allow = array('block'); $CI->load->model('client_ip_block_model'); $check_client_ip_block = $CI->client_ip_block_model->check_client_ip_block(); if ($check_client_ip_block == TRUE) { if (!in_array($CI->uri->segment(1), $allow)) { delete_session(); redirect('/block/ip', 'refresh'); } } }
/** * 포인트 (팝업) * @author KangMin * @since 2011.11.25 */ public function point() { $data = NULL; $post_success = FALSE; $req_user_idx = $data['user_idx'] = (int) $this->input->get_post('user_idx') > 0 ? (int) $this->input->get_post('user_idx') : NULL; $req_page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1; //체크 $check_req_user_idx = $this->users_model->check('idx', $req_user_idx); if ($check_req_user_idx !== TRUE) { $req_user_idx = NULL; } if (!defined('USER_INFO_idx') or defined('USER_INFO_idx') && USER_INFO_group_idx !== SETTING_admin_group_idx or $req_user_idx == NULL) { delete_session(); show_error(lang('unusual_approach')); } else { $this->load->model('users_point_model'); $req_mode = $this->input->post('mode'); $this->form_validation->set_rules('point', lang('point'), 'trim|required|xss_clean|integer'); if ($req_mode == 'delete' or $req_mode == 'normal') { //rules $this->form_validation->set_rules('idx', 'idx', 'trim|required|xss_clean|is_natural_no_zero'); } else { if ($req_mode == 'insert') { //rules $this->form_validation->set_rules('comment', lang('ment'), 'trim|required|htmlspecialchars|xss_clean|max_length[255]'); } else { } } //폼검증 성공이면 if ($this->form_validation->run() == TRUE) { $this->db->trans_start(); $req_point = (int) $this->form_validation->set_value('point'); if ($req_mode == 'delete') { $result = $this->users_point_model->update_is_deleted($this->form_validation->set_value('idx'), $req_user_idx, 1); $result_users = $this->users_model->update_count_users($req_user_idx, 'point', $req_point * -1); } else { if ($req_mode == 'normal') { $result = $this->users_point_model->update_is_deleted($this->form_validation->set_value('idx'), $req_user_idx, 0); $result_users = $this->users_model->update_count_users($req_user_idx, 'point', $req_point); } else { $result = $this->users_point_model->insert_point_comment($req_point, $this->form_validation->set_value('comment'), $req_user_idx); $result_users = $this->users_model->update_count_users($req_user_idx, 'point', $req_point); } } $this->db->trans_complete(); if ($result == TRUE and $result_users == TRUE) { $post_success = TRUE; $data['message'] = lang('success'); $data['redirect'] = '/admin/users/point?user_idx=' . $req_user_idx; $this->layout->view_admin_only_contents('alert_view', $data); } else { $data['result_msg'] = lang('fail_msg'); } } if ($post_success == FALSE) { $this->load->library('pagination'); $req_operator = $this->input->get('operator'); $add_where_operator = ''; if ($req_operator == 'plus') { $add_where_operator = ' AND USERS_POINT.point >= 0 '; } else { if ($req_operator == 'minus') { $add_where_operator = ' AND USERS_POINT.point < 0 '; } } //포인트내역의 합계 포인트 표출 //회원 DB의 포인트와 비교 //요건 삭제가 아닌것만이니 $data['point_sum'] = $this->users_point_model->get_point_sum($req_user_idx, ' AND is_deleted = 0 '); $data['total_cnt'] = $this->users_point_model->get_point_info_total_cnt($req_user_idx, $add_where_operator); // http://codeigniter-kr.org/user_guide_2.1.0/libraries/pagination.html $config['base_url'] = BASE_URL . 'admin/users/point?user_idx=' . $req_user_idx . '&operator=' . $req_operator; $config['enable_query_strings'] = TRUE; // ?page=10 이런 일반 get 방식 $config['page_query_string'] = TRUE; $config['use_page_numbers'] = TRUE; $config['num_links'] = 5; $config['query_string_segment'] = 'page'; $config['total_rows'] = $data['total_cnt']; $config['per_page'] = 30; //30개씩 $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); if ($data['total_cnt'] > 0) { $data['users_point'] = $this->users_point_model->get_point_info($req_user_idx, ($req_page - 1) * $config['per_page'], $config['per_page'], $add_where_operator, TRUE); } $this->layout->view_admin_only_contents('users/point_view', $data); } } //로그인,권한 체크 end if }
method_not_allowed(); }); Flight::route('POST /confirmations/new', function () { incl('new_confirm_code'); new_confirm_code(Flight::request()); }); Flight::route('/confirmations/new', function () { method_not_allowed(); }); Flight::route('POST /sessions', function () { incl('create_session'); create_session(Flight::request()); }); Flight::route('DELETE /sessions', function () { incl('delete_session'); delete_session(Flight::request()); }); Flight::route('/sessions', function () { method_not_allowed(); }); Flight::route('POST /programming_languages', function () { incl('create_programming_language'); create_programming_language(Flight::request()); }); Flight::route('GET /programming_languages', function () { incl('get_programming_languages'); get_programming_languages(Flight::request()); }); Flight::route('/programming_languages', function () { method_not_allowed(); });
/** * 탈퇴 * * @author KangMin * @since 2014.07.13 */ public function unregistered() { $data = NULL; //로그인 상태가 아니거나 권한이 없으면 if (!defined('USER_INFO_idx')) { $assign['message'] = lang('unusual_approach'); } else { $result = $this->users_model->unregistered(); if ($result == TRUE) { $assign['message'] = lang('success_unregistered'); } else { $assign['message'] = lang('fatal_error'); } } delete_session(); $assign['redirect'] = '/'; $this->alert($assign); }
function ping_enemy() { global $dbc; $name = "chess_users_" . $_SESSION["name"]; $sql = "SELECT time, id FROM {$name}"; $query = @mysql_query($sql, $dbc); if (!$query) { return true; } while ($row = mysql_fetch_assoc($query)) { if ($row["id"] != $_SESSION["id"] && $row["time"] + 11 < time()) { delete_session($_SESSION["name"]); return true; } } return false; }
/** * 게시물 일괄 삭제 * * @author 배강민 */ public function delete() { $checked = $this->input->post('checked'); $data = NULL; if (!defined('USER_INFO_idx') or defined('USER_INFO_idx') && USER_INFO_group_idx !== SETTING_admin_group_idx) { delete_session(); $this->layout->view_admin('login_view'); } else { if ($checked) { $this->load->model('bbs_article_model'); $this->load->driver('cache'); foreach ($checked as $k => $v) { $temp = explode('^', $v); //현재 삭제상태면 카운트 조작안하게 $check_deleted = $this->bbs_article_model->check_idx($temp[0], ' AND is_deleted = 0 '); if ($check_deleted === TRUE) { $result_users = $this->users_model->update_count_users($temp[1], 'article_count', -1); } $bbs_idx = $this->bbs_article_model->get_bbs_idx($temp[0]); if ($this->cache->file->get('recently_' . $bbs_idx . '_mobile')) { $this->cache->file->delete('recently_' . $bbs_idx . '_mobile'); } if ($this->cache->file->get('recently_' . $bbs_idx . '_pc')) { $this->cache->file->delete('recently_' . $bbs_idx . '_pc'); } } $result = $this->bbs_article_model->delete_admin($checked); $data['message'] = lang('delete_success'); if ($this->cache->file->get('recently_comment_mobile')) { $this->cache->file->delete('recently_comment_mobile'); } //최근게시물 갯수를 수정하면 이도 삭제해야 바로 적용된다. if ($this->cache->file->get('recently_comment_pc')) { $this->cache->file->delete('recently_comment_pc'); } //최근게시물 갯수를 수정하면 이도 삭제해야 바로 적용된다. } else { $data['message'] = lang('delete_fail_msg'); } $data['redirect'] = '/admin/bbs/lists?bbs_idx=' . $this->input->post('bbs_idx') . '&is_deleted=' . $this->input->post('is_deleted') . '&date_start=' . $this->input->post('date_start') . '&date_end=' . $this->input->post('date_end') . '&search_word=' . $this->input->post('search_word') . '&writer=' . $this->input->post('writer') . '&page=' . $this->input->post('page') . ''; $this->layout->view_admin_only_contents('alert_view', $data); } }