本文整理汇总了PHP中check_token函数的典型用法代码示例。如果您正苦于以下问题:PHP check_token函数的具体用法?PHP check_token怎么用?PHP check_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_token函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLogin
public function postLogin()
{
$token = isset($_POST['_token']) ? $_POST['_token'] : null;
check_token($token);
$okay = true;
$email = $_POST['email'];
$password = $_POST['password'];
// lookup the user
$user = User::user($email);
if ($user != null) {
// validate password
if (!password_verify($password, $user->password)) {
$okay = false;
}
} else {
$okay = false;
}
if ($okay) {
$_SESSION['user'] = $user;
flash('success', ['you are Login successfully']);
redirect('/');
} else {
flash('errors', ['Invalid Login or you not active your account']);
redirect('/');
}
}
示例2: postShowLoginPage
/**
* the login data post process here
* @return [type] [description]
*/
public function postShowLoginPage()
{
check_token($_POST['_token']);
$okay = true;
$email = $_POST['email'];
$password = $_POST['password'];
// Look up the user
$user = User::where('active', 1)->where('email', $email)->first();
if ($user != null) {
// validate credentials
if (!password_verify($password, $user->password)) {
$okay = false;
}
} else {
$okay = false;
}
if ($okay) {
// if valid, log them
$this->session->login($user);
header('Location: /');
exit;
} else {
// if not valid redirect to the login page
Session::flash('errors', ['Invalid Login']);
echo $this->blade->render('login');
}
}
示例3: index
function index()
{
$bo_table = $this->input->post('bo_table');
if (!IS_MEMBER || !$bo_table) {
show_404();
}
$board = $this->Basic_model->get_board($bo_table);
if (!isset($board['bo_table'])) {
alert_close('존재하지 않은 게시판입니다.');
}
$member = unserialize(MEMBER);
if ($member['mb_id'] != $board['bo_admin']) {
show_404();
}
$config = array(array('field' => 'bo_table', 'label' => 'TABLE', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean'), array('field' => 'token', 'label' => '토큰', 'rules' => 'trim|required'), array('field' => 'bo_subject', 'label' => '게시판 제목', 'rules' => 'trim|required|max_length[20]|xss_clean'), array('field' => 'bo_admin', 'label' => '게시판 관리자', 'rules' => 'trim|min_length[3]|max_length[20]|alpha_dash'));
$this->load->library('form_validation');
$this->form_validation->set_rules($config);
if ($this->form_validation->run() == FALSE) {
$head = array('title' => $board['bo_subject']);
$data = array('token' => get_token(), 'bo_table' => $board['bo_table'], 'bo_admin' => $board['bo_admin'], 'bo_subject' => $board['bo_subject'], 'bo_insert_content' => $board['bo_insert_content'], 'bo_sort_field' => $board['bo_sort_field'], 'bo_count_write' => isset($board['bo_count_write']) ? number_format($board['bo_count_write']) : FALSE, 'bo_count_comment' => isset($board['bo_count_comment']) ? number_format($board['bo_count_comment']) : FALSE, 'bo_count_delete' => $board['bo_count_delete'], 'bo_count_modify' => $board['bo_count_modify'], 'bo_use_secret' => $board['bo_use_secret'], 'bo_page_rows' => $board['bo_page_rows'], 'bo_page_rows_comt' => $board['bo_page_rows_comt'], 'bo_subject_len' => $board['bo_subject_len'], 'bo_new' => $board['bo_new'], 'bo_hot' => $board['bo_hot'], 'bo_image_width' => $board['bo_image_width'], 'bo_reply_order' => $board['bo_reply_order'], 'use_private_chk' => $board['bo_use_private'] ? "checked='checked'" : '', 'use_rss_chk' => $board['bo_use_rss'] ? "checked='checked'" : '', 'use_sns_chk' => $board['bo_use_sns'] ? "checked='checked'" : '', 'use_comment_chk' => $board['bo_use_comment'] ? "checked='checked'" : '', 'use_category_chk' => $board['bo_use_category'] ? "checked='checked'" : '', 'use_sideview_chk' => $board['bo_use_sideview'] ? "checked='checked'" : '', 'use_editor_chk' => $board['bo_use_editor'] ? "checked='checked'" : '', 'use_name_chk' => $board['bo_use_name'] ? "checked='checked'" : '', 'use_ip_view_chk' => $board['bo_use_ip_view'] ? "checked='checked'" : '', 'use_list_view_chk' => $board['bo_use_list_view'] ? "checked='checked'" : '', 'use_email_chk' => $board['bo_use_email'] ? "checked='checked'" : '', 'use_syntax_chk' => $board['bo_use_syntax'] ? "checked='checked'" : '', 'use_search_chk' => $board['bo_use_search'] ? "checked='checked'" : '', 'bo_list_level' => get_mb_level_select('bo_list_level', $board['bo_list_level'], '', $member['mb_level']), 'bo_read_level' => get_mb_level_select('bo_read_level', $board['bo_read_level'], '', $member['mb_level']), 'bo_write_level' => get_mb_level_select('bo_write_level', $board['bo_write_level'], '', $member['mb_level']), 'bo_reply_level' => get_mb_level_select('bo_reply_level', $board['bo_reply_level'], '', $member['mb_level']), 'bo_comment_level' => get_mb_level_select('bo_comment_level', $board['bo_comment_level'], '', $member['mb_level']), 'bo_upload_level' => get_mb_level_select('bo_upload_level', $board['bo_upload_level'], '', $member['mb_level']), 'bo_download_level' => get_mb_level_select('bo_download_level', $board['bo_download_level'], '', $member['mb_level']));
widget::run('head', $head);
$this->load->view('board/admin', $data);
widget::run('tail');
} else {
check_token();
// 이것을 Model로 해야 하는가 말아야 하는가
$this->db->update('ki_board', array('bo_subject' => $this->input->post('bo_subject'), 'bo_list_level' => $this->input->post('bo_list_level'), 'bo_read_level' => $this->input->post('bo_read_level'), 'bo_write_level' => $this->input->post('bo_write_level'), 'bo_reply_level' => $this->input->post('bo_reply_level'), 'bo_comment_level' => $this->input->post('bo_comment_level'), 'bo_upload_level' => $this->input->post('bo_upload_level'), 'bo_download_level' => $this->input->post('bo_download_level'), 'bo_count_modify' => $this->input->post('bo_count_modify'), 'bo_count_delete' => $this->input->post('bo_count_delete'), 'bo_use_private' => $this->input->post('bo_use_private'), 'bo_use_rss' => $this->input->post('bo_use_rss'), 'bo_use_sns' => $this->input->post('bo_use_sns'), 'bo_use_category' => $this->input->post('bo_use_category'), 'bo_use_comment' => $this->input->post('bo_use_comment'), 'bo_use_sideview' => $this->input->post('bo_use_sideview'), 'bo_use_secret' => $this->input->post('bo_use_secret'), 'bo_use_editor' => $this->input->post('bo_use_editor'), 'bo_use_name' => $this->input->post('bo_use_name'), 'bo_use_ip_view' => $this->input->post('bo_use_ip_view'), 'bo_use_list_view' => $this->input->post('bo_use_list_view'), 'bo_use_email' => $this->input->post('bo_use_email'), 'bo_use_syntax' => $this->input->post('bo_use_syntax'), 'bo_subject_len' => $this->input->post('bo_subject_len'), 'bo_page_rows' => $this->input->post('bo_page_rows'), 'bo_page_rows_comt' => $this->input->post('bo_page_rows_comt'), 'bo_new' => $this->input->post('bo_new'), 'bo_hot' => $this->input->post('bo_hot'), 'bo_image_width' => $this->input->post('bo_image_width'), 'bo_reply_order' => $this->input->post('bo_reply_order'), 'bo_sort_field' => $this->input->post('bo_sort_field'), 'bo_insert_content' => $this->input->post('bo_insert_content'), 'bo_use_search' => $this->input->post('bo_use_search')), array('bo_table' => $bo_table));
alert_close('게시판 설정이 변경되었습니다.');
}
}
示例4: memo_delete
function memo_delete()
{
$me_no = $this->input->post('me_no');
$flag = $this->input->post('flag');
check_token('member/memo/lists/' . $flag);
if (!IS_MEMBER) {
alert_close("회원만 이용하실 수 있습니다.");
}
if (!($flag && $me_no)) {
alert_close("잘못된 접근입니다.");
}
$member = unserialize(MEMBER);
$this->load->model('Member_memo_model');
if ($flag == 'R') {
$result = $this->Member_memo_model->get_del_memo($me_no, $flag, $member['mb_id']);
$cnt = 0;
foreach ($result as $row) {
if ($row['me_check'] == '0000-00-00 00:00:00') {
$cnt++;
}
}
if ($cnt > 0) {
$this->Member_memo_model->memo_count($member['mb_id'], $cnt);
}
}
$this->Member_memo_model->memo_delete($me_no, $flag, $member['mb_id']);
goto_url('member/memo/lists/' . $flag);
}
示例5: launch
public function launch(Request $request, Response $response)
{
$content = "";
if ($request->getParam('asker')) {
if ($_SESSION['statut'] == "administrateur") {
check_token();
if ($request->getParam('asker') == "calendrier") {
$this->insertPeriod($content, $request);
} else {
if ($request->getParam('asker') == "edit_period") {
$this->editPeriod($content, $request);
} else {
if ($request->getParam('asker') == "delete_period") {
$this->deletePeriod($content, $request);
} else {
if ($request->getParam('asker') == "validate_period") {
$this->validatePeriod($content, $request);
}
}
}
}
}
}
$response->addVar('content', $content);
$this->render("./lib/template/ajaxrequestSuccess.php");
$this->printOut();
}
示例6: 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');
}
示例7: route_request
function route_request()
{
$cmd = strtolower(grab_request_var("cmd"));
// token if required for most everyting
if ($cmd != "" && $cmd != "hello") {
check_token();
}
//echo "CMD='$cmd'<BR>";
switch ($cmd) {
// say hello
case "hello":
say_hello();
break;
// display a form for debugging/testing
// display a form for debugging/testing
case "":
display_form();
break;
default:
//echo "PASSING TO PLUGINS<BR>";
// let plugins handle the output
$args = array("cmd" => $cmd);
do_callbacks(CALLBACK_PROCESS_REQUEST, $args);
break;
}
echo "NO REQUEST HANDLER";
exit;
}
示例8: update
function update()
{
check_token('member/join');
check_wrkey();
$this->load->helper('chkstr');
$config = array(array('field' => 'mb_id', 'label' => '아이디', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean|callback_mb_id_check'), array('field' => 'mb_password', 'label' => '비밀번호', 'rules' => 'trim|required|max_length[20]|md5'), array('field' => 'mb_password_re', 'label' => '비밀번호 확인', 'rules' => 'trim|required|max_length[20]|matches[mb_password]|md5'), array('field' => 'mb_password_q', 'label' => '비밀번호 분실시 질문', 'rules' => 'trim|required|max_length[50]'), array('field' => 'mb_password_a', 'label' => '비밀번호 분실시 답변', 'rules' => 'trim|required|max_length[50]'), array('field' => 'mb_name', 'label' => '이름', 'rules' => 'trim|required|max_length[10]|callback_mb_name_check'), array('field' => 'mb_email', 'label' => '이메일', 'rules' => 'trim|required|max_length[50]|valid_email|callback_mb_email_check'), array('field' => 'mb_birth', 'label' => '생일', 'rules' => 'trim|exact_length[10]'), array('field' => 'mb_sex', 'label' => '성별', 'rules' => 'trim|exact_length[1]'), array('field' => 'wr_key', 'label' => '자동등록방지', 'rules' => 'trim|required'));
if ($this->config->item('cf_use_nick')) {
$config[] = array('field' => 'mb_nick', 'label' => '별명', 'rules' => 'trim|required|max_length[20]|callback_mb_nick_check');
}
$this->form_validation->set_rules($config);
if ($this->form_validation->run() == FALSE) {
$this->_form();
} else {
$this->load->library(array('encrypt', 'email'));
if ($this->config->item('cf_use_nick')) {
$mb_nick = $this->input->post('mb_nick');
} else {
$mb_nick = substr(md5(uniqid($this->input->post('mb_id'), TRUE)), 0, 14);
}
$admin = $this->Basic_model->get_member(ADMIN, 'mb_nick, mb_email');
// 회원 INSERT
$this->Member_infor_model->insert($mb_nick);
// 회원가입 포인트 부여
$this->load->model('Point_model');
$this->Point_model->insert($this->input->post('mb_id'), $this->config->item('cf_register_point'), "회원가입 축하", '@member', $this->input->post('mb_id'), '회원가입');
// 회원님께 메일 발송
if ($this->config->item('cf_email_mb_member') || $this->config->item('cf_use_email_certify')) {
$mb_md5 = md5($this->input->post('mb_id') . $this->input->post('mb_email') . TIME_YMDHIS);
$certify_href = $this->config->item('base_url') . '/member/certify/email/' . $this->input->post('mb_id') . '/' . $mb_md5;
$data = array('mb_name' => $this->input->post('mb_name'), 'certify_href' => $certify_href, 'email_chk' => $this->config->item('cf_use_email_certify'));
$content = $this->load->view('mail/join_member', $data, TRUE);
$this->email->clear();
$this->email->from($admin['mb_email'], $admin['mb_nick']);
$this->email->to($this->input->post('mb_email'));
$this->email->subject("회원가입을 축하드립니다.");
$this->email->message($content);
$this->email->send();
}
// 최고관리자님께 메일 발송
if ($this->config->item('cf_email_mb_admin')) {
$data = array('mb_id' => $this->input->post('mb_id'), 'mb_name' => $this->input->post('mb_name'), 'mb_nick' => $mb_nick);
$content = $this->load->view('mail/join_admin', $data, TRUE);
$this->email->clear();
$this->email->from($this->input->post('mb_email'), $this->input->post('mb_name'));
$this->email->to($admin['mb_email']);
$this->email->subject($this->input->post('mb_name') . " 님께서 회원으로 가입하셨습니다.");
$this->email->message($content);
$this->email->send();
}
// 메일인증 사용하지 않는 경우에만 로그인
if (!$this->config->item('cf_use_email_certify')) {
$this->session->set_userdata('ss_mb_id', $this->input->post('mb_id'));
}
$this->session->set_flashdata('ss_mb_reg', $this->input->post('mb_id'));
goto_url('member/join/result');
}
}
示例9: issubmitted
/**
* Validates form submission by checking for hidden input field and validating token
*
* @param boolean $skiptoken Set true to skip token checking for this form submission
*
* @return boolean form submit true/false
**/
public function issubmitted($skiptoken = false)
{
if (isset($_POST["__fp" . $this->frmname])) {
if (!$skiptoken) {
check_token();
}
return true;
}
return false;
}
示例10: delete
function delete() {
check_token(false);
$this->nature_selected=isset($_POST['nature'])?$_POST['nature']:(isset($_GET['nature'])?$_GET['nature']:Null);
$this->nature[]=html_entity_decode($this->nature_selected,ENT_QUOTES);
$this->categorie=isset($_POST['categorie_id'])?$_POST['categorie_id']:(isset($_GET['categorie_id'])?$_GET['categorie_id']:Null);
if($this->categorie) {
$this->modele_incidents->update_categorie('default',Null,$this->categorie);
}else {
$this->modele_incidents->update_categorie('default',$this->nature);
}
$this->index();
}
示例11: form
function form($w = '', $gr_id = '')
{
$this->load->library('form_validation');
$config = array(array('field' => 'gr_id', 'label' => '아이디', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean'), array('field' => 'gr_subject', 'label' => '제목', 'rules' => 'trim|required|max_length[20]'), array('field' => 'gr_admin', 'label' => '그룹 관리자', 'rules' => 'trim|min_length[3]|max_length[20]|alpha_dash'));
$this->form_validation->set_rules($config);
if ($this->form_validation->run() == FALSE) {
if ($w == '') {
$title = '생성';
$gr = FALSE;
} else {
if ($w == 'u') {
$gr = $this->Boardgroup_model->get_group($gr_id);
if (!isset($gr['gr_id'])) {
alert('존재하지 않는 그룹 ID 입니다.');
}
$title = '수정';
} else {
alert('잘못된 접근입니다.');
}
}
$head = array('title' => '게시판그룹' . $title);
$data = array('w' => $w, 'token' => get_token(), 'gr_id' => $gr['gr_id'], 'gr_subject' => $gr['gr_subject'], 'gr_admin' => $gr['gr_admin']);
widget::run('head', $head);
$this->load->view(ADM_F . '/boardgroup_form', $data);
widget::run('tail');
} else {
check_token();
$w = $this->input->post('w');
$gr_id = $this->input->post('gr_id');
if (!$w) {
$gr = $this->Boardgroup_model->get_group($gr_id);
if (isset($gr['gr_id'])) {
alert("이미 존재하는 그룹 ID 입니다.");
}
$this->Boardgroup_model->insert();
} else {
if ($w == 'u') {
$this->Boardgroup_model->update();
} else {
alert('잘못된 접근입니다.');
}
}
// goto_url(ADM_F.'/boardgroup/form/u/'.$gr_id);
goto_url(ADM_F . '/boardgroup/lists');
}
}
示例12: login
public function login($username = null, $password = null)
{
// testa token do formulário
if (!check_token($_POST['token'])) {
return false;
}
// verificar se username existe
$user = $this->findByUsername($username);
if (is_numeric($user->id)) {
// verificar senha digitada
if (!$password) {
return false;
}
$this->db->query("SELECT password FROM users WHERE id = :id", array(array('name' => 'id', 'value' => $user->id)));
$res = $this->db->getResults();
if ($this->db->isOk() && password_verify($password, $res->password)) {
$_SESSION["user"] = $user->id;
return true;
}
}
return false;
}
示例13: include
<?php
include('includes/header.php');
switch($_POST['act'])
{
case 'Send': // Reply
if(!check_token()) Output::HardError('Session error. Try again.');
//Lurk more?
if($_SERVER['REQUEST_TIME'] - $_SESSION['first_seen'] < REQUIRED_LURK_TIME_REPLY)
{
add_error('Lurk for at least ' . REQUIRED_LURK_TIME_REPLY . ' seconds before posting your first reply.');
}
// Flood control.
$too_early = $_SERVER['REQUEST_TIME'] - FLOOD_CONTROL_REPLY;
$res=DB::Execute(sprintf('SELECT 1 FROM {P}PMs WHERE pmFrom = \'%s\' AND pmDateSent > %d',$_SERVER['REMOTE_ADDR'], $too_early));
if($res->RecordCount() > 0)
{
add_error('Wait at least ' . FLOOD_CONTROL_REPLY . ' seconds between each reply. ');
}
//Check inputs
list($_POST['title'],$_POST['body'])=Check4Filtered($_POST['title'],$_POST['body']);
$reply=new PM();
$reply->To = $_POST['to'];
$reply->Thread = intval($_POST['thread']);
$reply->From =$User->ID;
$reply->Title = $_POST['title'];
示例14: array
$active = $db->insert('active', array('content' => "获取订单 {$tradeno} 返回状态码 {$data['message_id']} 内容 {$message[0]}", 'username' => $token['username'], 'time' => date('Y-m-d H:i:s', time())));
} else {
// 显示错误信息
$message[] = '检查订单失败,请联系管理员';
}
}
}
$title = '缴费';
include 'views/pay.php';
} else {
header('Location: member.php?action=login');
}
} else {
if ($action == 'discount') {
// Ajax 折扣码查询
$token = check_token();
if ($token) {
if (isset($_GET['commodity_id'], $_GET['code'])) {
$commodity = $db->get('commodity', array('id', 'name', 'introduction', 'time', 'price', 'transfer', 'region'), array('id' => $_GET['commodity_id']));
if ($commodity) {
/*$code = generate_string(32);
$db->insert('discount', array(
'card' => $code,
'md5' => md5($code),
'create_time' => date('Y-m-d H:i:s'),
'discount_price' => 5
));*/
$discount_code = $db->get('discount', array('card', 'md5', 'create_time', 'used_member', 'discount_price', 'min_price', 'username'), array('AND' => array('card' => $_GET['code'], 'md5' => md5($_GET['code']), 'used_member' => array('', null))));
if ($discount_code) {
echo json_encode(array('commodity' => $commodity, 'discount' => $discount_code));
} else {
示例15: array
<?php
require_once 'f-encryption.php';
$client_encryption_keys = array('127.0.0.1' => 'Qs/7S$N%C8');
$remote_ip = '206.225.90.76';
$encryption_key = $client_encryption_keys[$remote_ip];
$timeout = 60;
echo "Decrypting: {$argv['1']}\n\n";
$decr_b64 = urlsafe_b64decode($argv[1]);
$decrypted = encrypt_decrypt('decrypt', $decr_b64);
$fields = explode(":", $decrypted);
if (count($fields) == 2) {
// sleep (3);
list($ip, $timestamp) = explode(":", $decrypted);
$nowtime = time();
//echo "$ip, $timestamp, $timeout\n";
$sum = (int) ($timestamp + $timeout);
if ($nowtime > $sum || $nowtime < $timestamp) {
echo "Expired key\n";
}
echo "IP:{$ip},TIMESTAMP:{$timestamp}\n";
}
check_token($argv[1]);