function restrict_access($levels) { if (!user_access($levels)) { // Access forbidden $user_level = $_SESSION['permissions']; if ($user_level == 'X') { alert('You need to log in to do that.', -1); require_once PATH::root() . '/Account/Signin.php'; die; } else { if ($user_level == 'E') { location('Account/Verify_Email'); } else { if ($user_level == 'P') { location('Account/Approve'); } else { if ($user_level == '+') { location('Admin/Super_Admin'); } else { if ($user_level == 'B') { location('Account/Banned'); } else { // Go home - e.g. if you're logged in and it's restrict_access('X') on Signin, you shouldn't be signing in again. It'll just bring you back home. location('Home'); } } } } } } }
function gravalog($numero, $texto, $pagina = null, $linha = null, $contexto = null) { $ddf = fopen(DIR_LOGS . date('Y.M.d') . ".log", 'a'); if ($ddf) { $datalog = date('d.m.Y H:i:s'); $txt = "::[" . $datalog . "]--|" . ip() . "|----------------------\n"; $txt .= "(" . $numero . ") " . $texto . "\n"; if (!is_null($pagina)) { $txt .= "Pagina: " . $pagina . "\n"; } if (!is_null($linha)) { $txt .= "Linha: " . $linha . "\n"; } $txt .= "\n"; if (fwrite($ddf, $txt)) { return true; if (DEBUG) { alert('Arquivo gravado com sucesso', false); } } } else { if (DEBUG) { alert('Erro ao gravar arquivo', false); } } fclose($ddf); }
public function update(Request $request) { $data = $request->all(); $user = User::whereId(Auth::user()->id)->first(); if ($user->email != $data['email']) { $checkemail = User::where('email', '=', $data['email'])->first(); if (!$checkemail) { $user->email = $data['email']; } else { alert()->warning(' ', 'Cet adresse email est déjà utilisée !')->autoclose(3500); return back()->withInput(); } } $user->firstname = $data['firstname']; $user->lastname = $data['lastname']; if ($data['password']) { if ($data['password'] == $data['password_confirmation']) { $user->password = bcrypt($data['password']); } else { alert()->warning(' ', 'Les mots de passe ne correspondent pas !')->autoclose(3500); return back()->withInput(); } } $user->save(); alert()->success(' ', 'Profil modifié !')->autoclose(3500); return redirect('/membres/profil/'); }
public function checkoutCart($id) { $sql = "UPDATE cart SET state = 'checked out' WHERE ID = {$id}"; $count = $this->db->affectRows($sql); return $count; alert("Checked out"); }
public function delete($id = NULL) { $this->auth->check_access("meta_delete"); $this->model_meta->remove($id); set_flashdata("notif", alert("Berhasil menghapus data meta", "success")); redirect("admin/meta"); }
/** * Add error message * * @param string message **/ function error($msg, $i18n = '') { if ($i18n) { $msg = sprintf('<span data-i18n="%s">%s</span>', $i18n, $msg); } alert($msg, 'danger'); }
function etchosts_save() { $ID = $_POST["ID"]; unset($_POST["ID"]); if ($_POST["ipaddr"] == '___.___.___.___') { $_POST["ipaddr"] = null; } if ($_POST["ipaddr"] == null) { alert("NO IP ADDR"); return; } while (list($key, $value) = each($_POST)) { $fields[] = "`{$key}`"; $values[] = "'" . mysql_escape_string2($value) . "'"; $edit[] = "`{$key}`='" . mysql_escape_string2($value) . "'"; } if ($ID > 0) { $sql = "UPDATE net_hosts SET " . @implode(",", $edit) . " WHERE ID={$ID}"; } else { $sql = "INSERT IGNORE INTO net_hosts (" . @implode(",", $fields) . ") VALUES (" . @implode(",", $values) . ")"; } $q = new mysql(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $sock = new sockets(); $sock->getFrameWork("system.php?etchosts-build=yes"); }
function getSim($sim, $cookieName, $cookieValue) { $url = "https://siam.eseye.com/Japi/Tigrillo"; if (ENVIRONMENT === "development") { $url = "https://tigrillostaging.eseye.com/Japi/Tigrillo"; } $curl = new Curl(); $curl->setHeader("Content-type", "application/json"); try { $curl->setCookie($cookieName, $cookieValue); $curl->post($url . "/getSIMLastActivity", ["ICCID" => $sim->ICCID]); $response = $curl->response; $sim->LastRadiusStop = $response->info->LastRadiusStop; $sim->LastRadiusBytes = $response->info->LastRadiusBytes; $difference = 96; if (!empty($sim->LastRadiusStop)) { $date = DateTime::createFromFormat("Y-m-d H:i:s", $sim->LastRadiusStop); $difference = $date->getTimestamp() / 3600; } if ($difference >= 48 && $difference < 96) { alert($sim, "medium"); } if ($difference >= 96) { alert($sim, "high"); } } catch (Exception $e) { throw $e; } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $user = User::find($id); $user->delete(); alert()->info('Vaya', 'El Usuario ' . $user->name . ' a sido borrado de forma exitosa'); return redirect()->route('settings.index'); }
function index() { $member = unserialize(MEMBER); if (!$member['mb_email']) { alert('관리자 E-mail이 존재하지 않습니다.'); } $mail_addr = $mail_msg = FALSE; if ($this->input->post('mail_addr')) { check_token(); $mail_addr = $this->input->post('mail_addr'); $subject = '[메일검사] 제목'; $content = '[메일검사] 내용<br />이 내용이 제대로 보인다면 보내는 메일 서버에는 이상이 없는것입니다.<br />발송시간 : ' . date('Y-m-d H:i:s') . '<br />이 메일 주소로는 회신되지 않습니다.'; $this->email->clear(); $this->email->from($member['mb_email'], '메일검사'); $this->email->to($mail_addr); $this->email->subject($subject); $this->email->message($content); if (!$this->email->send()) { $mail_msg = '<strong>※ 메일전송 오류</strong><br/>' . $this->email->print_debugger(); } else { $mail_msg = '<strong>' . $mail_addr . '</strong> (으)로 메일을 발송 하였습니다. <br/>해당 주소로 메일이 왔는지 확인하세요. <br/>메일이 오지 않는다면 프로그램의 오류가 아닌 <br/>메일 서버(sendmail)의 오류일 가능성이 있습니다. <br/>이런 경우에는 웹 서버관리자에게 문의하세요.'; } } $head = array('title' => '메일전송 테스트'); $data = array('token' => get_token(), 'mail_addr' => $mail_addr, 'mail_msg' => $mail_msg); widget::run('head', $head); $this->load->view(ADM_F . '/sendmail_test', $data); widget::run('tail'); }
public static final function validateB($str) { if (preg_match('/[^\\d,*]/i', $str, $match)) { alert('格式錯誤' . $str); } return $str; }
function change_pass() { $this->load->helper('form'); $this->load->library('form_validation'); $rules = array(array('field' => 'new_pass', 'label' => 'Password', 'rules' => 'required'), array('field' => 'r_pass', 'label' => 'Password', 'rules' => 'required')); $this->form_validation->set_rules($rules); if ($this->form_validation->run() === FALSE) { $d['error'] = ''; $this->load->view('change_pass', $d); } else { $old = $this->input->post('old_pass'); $new = $this->input->post('new_pass'); $this->db->where('id', $this->session->userdata('id')); $u = $this->db->get('users')->row_array(); if (md5($old) == $u['password']) { if ($this->input->post('r_pass') == $new) { $data['password'] = md5($new); $this->db->where('id', $this->session->userdata('id')); $this->db->update('users', $data); redirect(base_url()); } else { $d['error'] = alert('Please confirm your password', 'danger'); $this->load->view('change_pass', $d); } } else { $d['error'] = alert('Invalid Old Password', 'danger'); $this->load->view('change_pass', $d); } } }
function gravalog($numero, $texto, $pagina = null, $linha = null, $contexto = null) { $ddf = fopen(DIR_LOGS . "/" . date('Y.M.d') . ".log", 'a'); if ($ddf) { $datalog = date('d.m.Y H:i:s'); $txt = "::[" . $datalog . "]--|" . ip() . "|----------------------\n"; $txt .= "(" . $numero . ") " . $texto . "\n"; if (!is_null($pagina)) { $txt .= "Pagina: " . $pagina . "\n"; } if (!is_null($linha)) { $txt .= "Linha: " . $linha . "\n"; } $txt .= "\n"; if (PROFILER) { if (class_exists("Console")) { $e = new ErrorException($texto, 0, $numero, $pagina, $linha); Console::logError($e, $texto); } } if (fwrite($ddf, $txt)) { return true; if (DEBUG) { alert('Arquivo gravado com sucesso', false); } } } else { if (DEBUG) { alert('Erro ao gravar arquivo', false); } } fclose($ddf); }
function index() { if (SU_ADMIN != ADMIN) { alert('최고관리자만 접근할 수 있습니다.'); return false; } function get_cf_custom($file) { $str = str_replace(array('<?', '?>', '\'', '"'), '', file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/app/config/cf_' . $file . '.php')); preg_match_all("/config\\[(.*)\\]\\s+=\\s+(.*);\\s+\\/\\/(.*)/", $str, $match); $list = array(); foreach ($match[1] as $i => $v) { $list[$i] = new stdClass(); $list[$i]->title = $v; $list[$i]->value = $match[2][$i]; $list[$i]->comment = $match[3][$i]; } return $list; } $head = array('title' => '환경설정'); $data = array('basic' => get_cf_custom('basic'), 'board' => get_cf_custom('board'), 'icon' => get_cf_custom('icon'), 'register' => get_cf_custom('register')); widget::run('head', $head); $this->load->view(ADM_F . '/config', $data); widget::run('tail'); }
private function upload($file) { if ($file !== null) { try { FileValidator::FILE_TYPE($file, 'csv'); $old_path = getcwd(); $destinationPath = '../CityGisProcess/bin/uploads'; // upload path $extension = $file->getClientOriginalExtension(); // getting file extension // $fileName = rand(11111, 99999) . '.' . $extension; // renaming file $fileName = "Connections.csv"; $file->move($destinationPath, $fileName); // Uploading file to given path // sending back with message alert()->success('Upload succesvol!')->autoclose(2500); return redirect()->back(); } catch (MimeError $e) { alert()->error('Verkeerde file extensie, alleen .csv of .txt toegestaan'); return redirect()->back(); } } alert()->error('Selecteer een .csv of .txt bestand a.u.b.!')->autoclose(2500); return redirect()->back(); }
function get_reply_step($bo_table, $wr_id, $tmp_num, $bo_reply_order, $co_reply) { $reply_len = strlen($co_reply) + 1; if ($bo_reply_order) { $begin_reply_char = 'A'; $end_reply_char = 'Z'; $reply_number = +1; $this->db->select_max(' SUBSTRING(co_reply, ' . $reply_len . ', 1) ', 'reply'); } else { $begin_reply_char = 'Z'; $end_reply_char = 'A'; $reply_number = -1; $this->db->select_min(' SUBSTRING(co_reply, ' . $reply_len . ', 1) ', 'reply'); } $this->db->where(array('bo_table' => $bo_table, 'wr_id' => $wr_id, 'co_num' => $tmp_num, 'SUBSTRING(co_reply, ' . $reply_len . ', 1) <>' => '')); if ($co_reply) { $this->db->like('co_reply', $co_reply, 'after'); } $row = $this->db->get('ki_comment')->row_array(); if (!isset($row['reply'])) { $reply_char = $begin_reply_char; } else { if ($row['reply'] == $end_reply_char) { // A~Z은 26 입니다. alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다."); } else { $reply_char = chr(ord($row['reply']) + $reply_number); } } return $co_reply . $reply_char; }
public function logout() { Auth::logout(); alert()->success('You have been logged out.', 'Good bye!'); // session()->flash('message', 'You have now been sign out.') ; return redirect('login'); }
function maps() { $this->load->helper('form'); $this->load->library('form_validation'); $this->form_validation->set_rules('caption', 'Description', 'required'); if ($this->form_validation->run() === FALSE) { $d['error'] = ''; $this->load->view('admin/maps', $d); } else { $config['upload_path'] = './assets/uploads/'; // check if the attachment belongs to image $config['allowed_types'] = 'jpg|png|jpeg'; $config['max_size'] = 0; $config['encrypt_name'] = TRUE; $this->load->library('upload', $config); if ($this->upload->do_upload()) { $data['pic'] = $this->upload->data('file_name'); $data['caption'] = $this->input->post('caption'); $this->db->insert('hazard_maps', $data); // insert logs $this->api->insert_logs('Added new hazard map'); redirect('/hazzard_maps'); } else { $d['error'] = alert($this->upload->display_errors()); $this->load->view('admin/maps', $d); } } }
public function profilstore() { $user = User::whereId(Auth::user()->id)->first(); dd('à terminer'); alert()->success('...', 'Profil modifié !')->autoclose(3500); return redirect('/membres/profil'); }
public function add() { $captcha_word = $this->session->userdata('captcha_word'); $id = $this->input->post('m_id'); $nick = $this->input->post('m_name'); if ($captcha_word != $this->input->post('captcha_word')) { alert('자동 가입 방지를 위한 문자를 잘못 입력하셨습니다.', MAIN_URL . '/register/form'); } if ($id == '') { alert('아이디를 입력해주세요.'); } if ($nick == '') { alert('이름을 입력해주세요.'); } if ($this->input->post('m_pass') == '') { alert('비밀번호를 입력해주세요.'); } if ($this->input->post('m_pass') != $this->input->post('m_pass2')) { alert('비밀번호를 확인해주세요.'); } $checkMember = $this->member_model->checkMember($id, $nick); //$member = $this->member_model->get_member_one('member', 'm_id', $this->input->post('m_id')); if ($checkMember > 0) { alert('아이디나 별명이 중복되었습니다.'); } $data = array('m_id' => $this->input->post('m_id'), 'm_name' => $this->input->post('m_name'), 'email' => $this->input->post('email'), 'm_pass' => password_hash($this->input->post('m_pass'), PASSWORD_BCRYPT), 'm_level' => 1); $this->member_model->insert('member', $data); $this->session->unset_userdata('captcha_word'); alert('회원가입이 완료되었습니다', MAIN_URL); }
private function checkLogin() { $user = M('user'); $data = $user->where('level =1')->select(); $verify = new Verify(); if ($verify->check(I('post.verify'))) { $uname = I('post.uname'); $pass = I('post.pass'); if (empty($uname)) { $this->error("账号不能为空"); } elseif (empty($pass)) { $this->error("密码不能为空"); } foreach ($data as $value) { if (I('post.uname') == $value['name'] && md5(md5(I('post.pass'))) == $value['pass']) { session('uname', I('post.uname')); header('Location:' . __APP__); } else { alert('密码错误', ''); return false; } } } else { $this->error("验证码错误!"); } }
function form() { $this->load->helper('date'); $user_to = $this->input->post('user_to'); if ($user_to == 0) { $this->db->where('id !=', $this->session->userdata('id')); $message = $this->input->post('message'); $u = $this->db->get('users')->result_array(); foreach ($u as $user) { $d['user_to'] = $user['id']; $d['user_from'] = $this->session->userdata('id'); $ttime = mdate('%h:%i%a'); $d['ttime'] = date('Y-m-d') . ' ' . $ttime; $d['status'] = 0; $d['message'] = $message; $this->db->insert('chats', $d); } echo alert('Successfully Send to All', 'info'); } else { $d['user_to'] = $this->input->post('user_to'); $d['user_from'] = $this->input->post('user_from'); $d['message'] = $this->input->post('message'); $ttime = mdate('%h:%i%a'); $d['ttime'] = date('Y-m-d') . ' ' . $ttime; $d['status'] = 0; if ($d['user_to'] or $d['user_from']) { $this->db->insert('chats', $d); $this->converse($d['user_to'], $d['user_from']); } } }
public function destroy($id) { $nasabah = Nasabah::find($id); $nasabah->delete(); alert()->overlay('Selamat', 'Hapus Data Nasabah Berhasil!', 'success'); return redirect('nasabah'); }
public function update(AdminCategoryRequest $request, $id) { $data = $request->all(); $this->repository->update($data, $id); alert()->success('O registro foi alterado.', 'Sucesso!')->autoclose(3000); return redirect()->route('admin.categories.index'); }
/** * display input Element * $arrParam accept ["value"] to corresponding value */ function display($arrParam) { if ($arrParam == '') { $arrParam = $_POST[$this->name]; } print '<span id="container_input_' . $this->name . '"><input name="' . $this->name . '" id="' . $this->name . '" type="" value="' . $arrParam["value"] . '" disabled="' . $arrParam["disabled"] . '" /></span>'; print '<script type="text/javascript"> $(\'' . $this->name . '\').validate = function() {'; if (!isset($arrParam["required"])) { /* If a value is not required, and the input field is empty, that's ok */ print ' if ($(\'' . $this->name . '\').value == \'\') { //if is empty (hidden value) return true }'; } if (false) { print alert("' . {$this->name} . '"); } // Used for debug only /*print ' var rege = '.$this->regexp.' if ((rege.exec($(\''.$this->name.'\').value))!=null) { return true } else { $(\''.$this->name.'\').style.backgroundColor = \'pink\'; new Element.scrollTo(\'container_input_'.$this->name.'\'); return 0; } };';*/ if (isset($arrParam["onchange"])) { print '$(\'' . $this->name . '\').onchange = function() {' . $arrParam["onchange"] . '};'; } print '</script>'; }
/** * 权限检测 * @author allen caowenpeng1990@126.com */ protected function check_acl() { $controller = $this->uri->rsegment(1) ? $this->uri->rsegment(1) : getgpc("mod"); $action = $this->uri->rsegment(2) ? $this->uri->rsegment(2) : getgpc("act"); $node_str = $controller . '/' . $action; $query_node = $this->db->get_where('admin_node', array('node' => $node_str, 'status' => 1)); $node = $query_node->row_array(); //查出被权限的节点 $admin_utype = $this->session->userdata('admin_utype'); if ($admin_utype == 'sysadmin') { //全站放行 return; } if (is_array($node) && count($node) > 0) { $admin_id = $this->session->userdata('admin_id'); $query_acl = $this->db->select('admin_group.acl')->from('admin_group')->join('admin_user', 'admin_user.groupid = admin_group.id')->where(array('admin_user.id' => $admin_id))->get(); $acl = unserialize($query_acl->row_array()['acl']); if (!in_array($node['id'], $acl)) { if ($this->input->is_ajax_request()) { $data['status'] = false; $data['msg'] = '您没有权限进行此操作!'; ajaxReturn($data); } else { header("Content-type:text/html;charset=utf-8"); alert("您没有权限进行此操作!"); } } } }
public function destroy($id) { $role = Role::whereId($id)->first(); $role->delete(); alert()->success('...', 'Rôle supprimé !')->autoclose(3500); return redirect('/entrust/roles'); }
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('/'); }
public function mark_all($user_reff, $user_reff_id) { $this->auth->login_scurity(); $this->model_notification->mark_all($user_reff, $user_reff_id); set_flashdata("notif", alert("Success mark as read")); redirect_back(); }
public function index() { $leave_blank = $_REQUEST['leave_blank'] == ''; $dont_change = $_REQUEST['dont_change'] == 'http://'; $email = $_REQUEST['email']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; if ($leave_blank && $dont_change) { if ($email && $subject && $message) { if (strpos($email, '@') != false && trim(strtolower($email)) != $_ENV['SUPPORT_EMAIL']) { if (Mail::raw($message, function ($m) use($email, $subject) { $m->from($email)->subject($subject); })) { // Success!!! $_SESSION['ALERT'] = alert("Message Sent!", "", "success"); } else { // Unknown Error... $_SESSION['ALERT'] = alert("Oops!", "Something went wrong, please try again. If the issue continues, please email us directly as <a href='mailto:" . $_ENV['SUPPORT_EMAIL'] . "'>" . $_ENV['SUPPORT_EMAIL'] . "</a>", "error"); } } else { // Invalid Email $_SESSION['ALERT'] = alert("Oops!", "Invalid email address provided, please try again.", "error"); } } else { // Missing Field $_SESSION['ALERT'] = alert("Oops!", "One or more required fields are missing, please try again.", "error"); } } else { // Looks like spam $_SESSION['ALERT'] = alert("Oops!", "Something went wrong, please try again.", "error"); } return redirect('/'); }