• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP verify_token函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中verify_token函数的典型用法代码示例。如果您正苦于以下问题:PHP verify_token函数的具体用法?PHP verify_token怎么用?PHP verify_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了verify_token函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: process_form

function process_form()
{
    global $phpcid, $vars, $phpcdb, $phpc_script;
    verify_token();
    if (empty($vars['user_name'])) {
        return message(__('You must specify a user name'));
    }
    if (empty($vars['password1'])) {
        return message(__('You must specify a password'));
    }
    if (empty($vars['password2']) || $vars['password1'] != $vars['password2']) {
        return message(__('Your passwords did not match'));
    }
    $make_admin = empty($vars['make_admin']) ? 0 : 1;
    $passwd = md5($vars['password1']);
    if ($phpcdb->get_user_by_name($vars["user_name"])) {
        return message(__('User already exists.'));
    }
    $uid = $phpcdb->create_user($vars["user_name"], $passwd, $make_admin);
    if (!empty($vars['groups'])) {
        foreach ($vars['groups'] as $gid) {
            $phpcdb->user_add_group($uid, $gid);
        }
    }
    return message(__('Added user.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:26,代码来源:user_create.php


示例2: process_form

function process_form()
{
    global $phpcid, $vars, $phpcdb, $phpc_script, $phpc_cal;
    verify_token();
    $user = $phpcdb->get_user($vars["uid"]);
    // Remove existing groups for this calendar
    foreach ($user->get_groups() as $group) {
        if ($group["cid"] == $phpcid) {
            $phpcdb->user_remove_group($vars["uid"], $group["gid"]);
        }
    }
    $valid_groups = array();
    foreach ($phpc_cal->get_groups() as $group) {
        $valid_groups[] = $group["gid"];
    }
    if (!empty($vars["groups"])) {
        foreach ($vars["groups"] as $gid) {
            if (!in_array($gid, $valid_groups)) {
                soft_error("Invalid gid");
            }
            $phpcdb->user_add_group($vars["uid"], $gid);
        }
    }
    return message(__('Groups updated.'));
}
开发者ID:Godjqb,项目名称:Php-test,代码行数:25,代码来源:user_groups.php


示例3: process_form

function process_form()
{
    global $vars, $phpcdb, $phpc_script;
    verify_token();
    $cid = $phpcdb->create_calendar();
    foreach (get_config_options() as $item) {
        $name = $item[0];
        $type = $item[2];
        if ($type == PHPC_CHECK) {
            if (isset($vars[$name])) {
                $value = "1";
            } else {
                $value = "0";
            }
        } else {
            if (isset($vars[$name])) {
                $value = $vars[$name];
            } else {
                soft_error(__("{$name} was not set."));
            }
        }
        $phpcdb->create_config($cid, $name, $value);
    }
    message(__('Calendar created.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:25,代码来源:calendar_form.php


示例4: password_submit

function password_submit()
{
    global $vars, $phpcdb, $phpc_user;
    if (!is_user()) {
        return tag('div', __('You must be logged in.'));
    }
    verify_token();
    if (!$phpc_user->is_password_editable()) {
        soft_error(__('You do not have permission to change your password.'));
    }
    if (!isset($vars['old_password'])) {
        return tag('div', __('You must specify your old password.'));
    } else {
        $old_password = $vars['old_password'];
    }
    if ($phpc_user->password != md5($old_password)) {
        return tag('div', __('The password you entered did not match your old password.'));
    }
    if (empty($vars['password1'])) {
        return tag('div', __('You must specify a password'));
    }
    if (empty($vars['password2']) || $vars['password1'] != $vars['password2']) {
        return tag('div', __('Your passwords did not match'));
    }
    $passwd = md5($vars['password1']);
    $phpcdb->set_password($phpc_user->get_uid(), $passwd);
    return tag('div', __('Password updated.'));
}
开发者ID:php-calendar,项目名称:php-calendar,代码行数:28,代码来源:password_submit.php


示例5: user_settings_submit

function user_settings_submit()
{
    global $phpcid, $vars, $phpcdb, $phpc_user_tz, $phpc_user_lang, $phpc_prefix, $phpc_user, $phpc_script;
    verify_token();
    // If we have a timezone, make sure it's valid
    if (!empty($vars["timezone"]) && !in_array($vars['timezone'], timezone_identifiers_list())) {
        soft_error(__("Invalid timezone."));
    }
    // Expire 20 years in the future, give or take.
    $expiration_time = time() + 20 * 365 * 24 * 60 * 60;
    // One hour in the past
    $past_time = time() - 3600;
    if (!empty($vars["timezone"])) {
        setcookie("{$phpc_prefix}tz", $vars['timezone'], $expiration_time);
    } else {
        setcookie("{$phpc_prefix}tz", '', $past_time);
    }
    if (!empty($vars["language"])) {
        setcookie("{$phpc_prefix}lang", $vars['language'], $expiration_time);
    } else {
        setcookie("{$phpc_prefix}lang", '', $past_time);
    }
    if (is_user()) {
        $uid = $phpc_user->get_uid();
        $phpcdb->set_user_default_cid($uid, $vars['default_cid']);
        $phpcdb->set_timezone($uid, $vars['timezone']);
        $phpcdb->set_language($uid, $vars['language']);
        $phpc_user_tz = $vars["timezone"];
        $phpc_user_lang = $vars["language"];
    }
    return message_redirect(__('Settings updated.'), "{$phpc_script}?action=user_settings&phpcid={$phpcid}");
}
开发者ID:hubandbob,项目名称:php-calendar,代码行数:32,代码来源:user_settings_submit.php


示例6: settings_submit

function settings_submit()
{
    global $phpcid, $vars, $phpcdb, $phpc_user_tz, $phpc_user_lang, $phpc_prefix, $phpc_user;
    verify_token();
    // Expire 20 years in the future, give or take.
    $expiration_time = time() + 20 * 365 * 24 * 60 * 60;
    // One hour in the past
    $past_time = time() - 3600;
    if (!empty($vars["timezone"])) {
        setcookie("{$phpc_prefix}tz", $vars['timezone'], $expiration_time);
    } else {
        setcookie("{$phpc_prefix}tz", '', $past_time);
    }
    if (!empty($vars["language"])) {
        setcookie("{$phpc_prefix}lang", $vars['language'], $expiration_time);
    } else {
        setcookie("{$phpc_prefix}lang", '', $past_time);
    }
    if (is_user()) {
        $uid = $phpc_user->get_uid();
        $phpcdb->set_timezone($uid, $vars['timezone']);
        $phpcdb->set_language($uid, $vars['language']);
        $phpc_user_tz = $vars["timezone"];
        $phpc_user_lang = $vars["language"];
    }
    return message(__('Settings updated.'));
}
开发者ID:Godjqb,项目名称:Php-test,代码行数:27,代码来源:settings.php


示例7: format_number

    if ($format != $translation) {
        $args[0] = format_number($number);
    }
    return vsprintf($format, $args);
}
function switch_lang()
{
    global $LANG, $langs;
    echo "<form action='' method='post'>\n<div id='lang'>";
    echo lang('Language') . ": " . html_select("lang", $langs, $LANG, "this.form.submit();");
    echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
    echo "<input type='hidden' name='token' value='" . get_token() . "'>\n";
    // $token may be empty in auth.inc.php
    echo "</div>\n</form>\n";
}
if (isset($_POST["lang"]) && verify_token()) {
    // $error not yet available
    cookie("adminer_lang", $_POST["lang"]);
    $_SESSION["lang"] = $_POST["lang"];
    // cookies may be disabled
    $_SESSION["translations"] = array();
    // used in compiled version
    adminer_redirect(remove_from_uri());
}
$LANG = "en";
if (isset($langs[$_COOKIE["adminer_lang"]])) {
    cookie("adminer_lang", $_COOKIE["adminer_lang"]);
    $LANG = $_COOKIE["adminer_lang"];
} elseif (isset($langs[$_SESSION["lang"]])) {
    $LANG = $_SESSION["lang"];
} else {
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:31,代码来源:lang.inc.php


示例8: process_form

function process_form()
{
    global $vars, $phpcdb, $phpc_cal, $phpcid, $phpc_script;
    if (!isset($vars['eid']) && !isset($vars['oid'])) {
        soft_error(__("Cannot create occurrence."));
    }
    $start_ts = get_timestamp("start");
    $end_ts = get_timestamp("end");
    switch ($vars["time-type"]) {
        case 'normal':
            $time_type = 0;
            break;
        case 'full':
            $time_type = 1;
            break;
        case 'tba':
            $time_type = 2;
            break;
        default:
            soft_error(__("Unrecognized Time Type."));
    }
    $duration = $end_ts - $start_ts;
    if ($duration < 0) {
        soft_error(__("An event cannot have an end earlier than its start."));
    }
    verify_token();
    if (!$phpc_cal->can_write()) {
        permission_error(__('You do not have permission to write to this calendar.'));
    }
    if (!isset($vars['oid'])) {
        $modify = false;
        if (!isset($vars["eid"])) {
            soft_error(__("EID not set."));
        }
        $oid = $phpcdb->create_occurrence($vars["eid"], $time_type, $start_ts, $end_ts);
    } else {
        $modify = true;
        $oid = $vars["oid"];
        $phpcdb->modify_occurrence($oid, $time_type, $start_ts, $end_ts);
    }
    if ($oid != 0) {
        if ($modify) {
            $message = __("Modified occurence: ");
        } else {
            $message = __("Created occurence: ");
        }
        return message_redirect(tag('', $message, create_event_link($oid, 'display_event', $oid)), "{$phpc_script}?action=display_event&phpcid={$phpcid}&oid={$oid}");
    } else {
        return message_redirect(__('Error submitting occurrence.'), "{$phpc_script}?action=display_month&phpcid={$phpcid}");
    }
}
开发者ID:Godjqb,项目名称:Php-test,代码行数:51,代码来源:occur_form.php


示例9: process_form

function process_form()
{
    global $vars, $phpcdb, $phpc_cal, $phpcid, $phpc_script, $phpc_user;
    // When modifying events, this is the value of the checkbox that
    //   determines if the date should change
    $modify_occur = !isset($vars['eid']) || !empty($vars['phpc-modify']);
    if ($modify_occur) {
        $start_ts = get_timestamp("start");
        $end_ts = get_timestamp("end");
        switch ($vars["time-type"]) {
            case 'normal':
                $time_type = 0;
                break;
            case 'full':
                $time_type = 1;
                break;
            case 'tba':
                $time_type = 2;
                break;
            default:
                soft_error(__("Unrecognized Time Type."));
        }
        $duration = $end_ts - $start_ts;
        if ($duration < 0) {
            message(__("An event cannot have an end earlier than its start."));
            return display_form();
        }
    }
    verify_token();
    if (0) {
        permission_error(__('You do not have permission to write to this calendar.'));
    }
    if ($phpc_cal->can_create_readonly() && !empty($vars['readonly'])) {
        $readonly = true;
    } else {
        $readonly = false;
    }
    $catid = empty($vars['catid']) ? false : $vars['catid'];
    if (!isset($vars['eid'])) {
        $modify = false;
        $eid = $phpcdb->create_event($phpcid, $phpc_user->get_uid(), $vars["subject"], $vars["description"], $readonly, $catid);
    } else {
        $modify = true;
        $eid = $vars['eid'];
        $phpcdb->modify_event($eid, $vars['subject'], $vars['description'], $readonly, $catid);
        if ($modify_occur) {
            $phpcdb->delete_occurrences($eid);
        }
    }
    if ($modify_occur) {
        $oid = $phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
        $occurrences = 1;
        switch ($vars["repeats"]) {
            case "never":
                break;
            case 'daily':
                if (!isset($vars["every-day"])) {
                    soft_error(__("Required field \"every-day\" is not set."));
                }
                $ndays = $vars["every-day"];
                if ($ndays < 1) {
                    soft_error(__("every-day must be greater than 1"));
                }
                $daily_until = get_timestamp("daily-until");
                while ($occurrences <= 730) {
                    $start_ts = add_days($start_ts, $ndays);
                    $end_ts = add_days($end_ts, $ndays);
                    if (days_between($start_ts, $daily_until) < 0) {
                        break;
                    }
                    $phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
                    $occurrences++;
                }
                break;
            case 'weekly':
                if (!isset($vars["every-week"])) {
                    soft_error(__("Required field \"every-week\" is not set."));
                }
                if ($vars["every-week"] < 1) {
                    soft_error(__("every-week must be greater than 1"));
                }
                $ndays = $vars["every-week"] * 7;
                $weekly_until = get_timestamp("weekly-until");
                while ($occurrences <= 730) {
                    $start_ts = add_days($start_ts, $ndays);
                    $end_ts = add_days($end_ts, $ndays);
                    if (days_between($start_ts, $weekly_until) < 0) {
                        break;
                    }
                    $phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
                    $occurrences++;
                }
                break;
            case 'monthly':
                if (!isset($vars["every-month"])) {
                    soft_error(__("Required field \"every-month\" is not set."));
                }
                if ($vars["every-month"] < 1) {
                    soft_error(__("every-month must be greater than 1"));
                }
//.........这里部分代码省略.........
开发者ID:bluewarest,项目名称:gameboard,代码行数:101,代码来源:event_form.php


示例10: lang

    echo "</select>";
    echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
    echo "<input type='hidden' name='token' value='" . get_token() . "'>\n";
    // $token may be empty in auth.inc.php
    echo "</div>\n</form>\n";
}
if (isset($_POST["lang"]) && verify_token()) {
    // $error not yet available
    cookie("adminer_lang", $_POST["lang"]);
    $_SESSION["lang"] = $_POST["lang"];
    // cookies may be disabled
    $_SESSION["translations"] = array();
    // used in compiled version
    redirect(remove_from_uri());
}
if (isset($_POST["theme"]) && verify_token()) {
    // $error not yet available
    if ($_POST["theme"] == 'default') {
        setcookie("adminer_theme", null, time() - 3600);
        if (file_exists("./adminer.css")) {
            unlink("./adminer.css");
        }
    } else {
        copy("../designs/" . $_POST["theme"] . "/adminer.css", "./adminer.css");
        cookie("adminer_theme", $_REQUEST["theme"]);
    }
    redirect(remove_from_uri());
}
$LANG = "en";
if (isset($langs[$_COOKIE["adminer_lang"]])) {
    cookie("adminer_lang", $_COOKIE["adminer_lang"]);
开发者ID:sk335577,项目名称:wp-adminer-db-manager,代码行数:31,代码来源:lang.inc.php


示例11: connect

        exit;
    }
    $connection = connect();
}
$driver = new Min_Driver($connection);
if (!is_object($connection) || !$adminer->login($_GET["username"], get_password())) {
    auth_error(is_string($connection) ? $connection : lang('Invalid credentials.'));
}
if ($auth && $_POST["token"]) {
    $_POST["token"] = $token;
    // reset token after explicit login
}
$error = '';
///< @var string
if ($_POST) {
    if (!verify_token()) {
        $ini = "max_input_vars";
        $max_vars = ini_get($ini);
        if (extension_loaded("suhosin")) {
            foreach (array("suhosin.request.max_vars", "suhosin.post.max_vars") as $key) {
                $val = ini_get($key);
                if ($val && (!$max_vars || $val < $max_vars)) {
                    $ini = $key;
                    $max_vars = $val;
                }
            }
        }
        $error = !$_POST["token"] && $max_vars ? lang('Maximum number of allowed fields exceeded. Please increase %s.', "'{$ini}'") : lang('Invalid CSRF token. Send the form again.') . ' ' . lang('If you did not send this request from Adminer then close this page.');
    }
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
    // posted form with no data means that post_max_size exceeded because Adminer always sends token at least
开发者ID:ly95,项目名称:adminer,代码行数:31,代码来源:auth.inc.php


示例12: ensure_privileged_api_data_and_token_or_slave

function ensure_privileged_api_data_and_token_or_slave($db)
{
    $data = ensure_privileged_api_data();
    if (should_authenticate_as_slave($data)) {
        verify_slave($db, $data);
    } else {
        if (!verify_token(array_get($data, 'token'))) {
            exit_with_error('InvalidToken');
        }
    }
    return $data;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:12,代码来源:json-header.php


示例13: Array

         "Content-Type: application/x-www-form-urlencoded"
        ,"Authorization: $token"
    ));
    $response = Array();
    parse_str(curl_exec($ch), $response);
    curl_close($ch);
    return $response;
  }
}

// AUTH FIRST
// Verify token
$headers = apache_request_headers();
if(isset($headers['Authorization'])) {
  $token = $headers['Authorization'];
  $response = verify_token($token);
  $me = @$response['me'];
  $iss = @$response['issued_by'];
  $client = @$response['client_id'];
  $scope = @$response['scope'];
}else{
  header("HTTP/1.1 403 Forbidden");
  echo "403: No authorization header set.";
  exit;
}

if(empty($response)){
  header("HTTP/1.1 401 Unauthorized");
  echo "401: Access token could not be verified.";
  exit;
}elseif(stripos($me, "rhiaro.co.uk") === false || $scope != "update"){
开发者ID:rhiaro,项目名称:img,代码行数:31,代码来源:pub.php


示例14: process_form

function process_form()
{
    global $vars, $phpcdb, $phpc_script, $phpc_user, $phpc_cal;
    // When modifying events, this is the value of the checkbox that
    //   determines if the date should change
    $modify_occur = !isset($vars['eid']) || !empty($vars['phpc-modify']);
    if ($modify_occur) {
        $start_ts = get_timestamp("start");
        $end_ts = get_timestamp("end");
        switch ($vars["time-type"]) {
            case 'normal':
                $time_type = 0;
                break;
            case 'full':
                $time_type = 1;
                break;
            case 'tba':
                $time_type = 2;
                break;
            default:
                soft_error(__("Unrecognized Time Type."));
        }
        $duration = $end_ts - $start_ts;
        if ($duration < 0) {
            throw new Exception(__("An event cannot have an end earlier than its start."));
        }
    }
    verify_token();
    if (!isset($vars['cid'])) {
        throw new Exception(__("Calendar ID is not set."));
    }
    $cid = $vars['cid'];
    $calendar = $phpcdb->get_calendar($cid);
    if (!$calendar->can_write()) {
        permission_error(__('You do not have permission to write to this calendar.'));
    }
    if ($calendar->can_create_readonly() && !empty($vars['readonly'])) {
        $readonly = true;
    } else {
        $readonly = false;
    }
    $catid = empty($vars['catid']) ? false : $vars['catid'];
    if (!isset($vars['eid'])) {
        $modify = false;
        $eid = $phpcdb->create_event($cid, $phpc_user->get_uid(), $vars["subject"], $vars["description"], $readonly, $catid);
    } else {
        $modify = true;
        $eid = $vars['eid'];
        $phpcdb->modify_event($eid, $vars['subject'], $vars['description'], $readonly, $catid);
        if ($modify_occur) {
            $phpcdb->delete_occurrences($eid);
        }
    }
    foreach ($phpc_cal->get_fields() as $field) {
        $fid = $field['fid'];
        if (empty($vars["phpc-field-{$fid}"])) {
            if ($field['required']) {
                throw new Exception(sprintf(__('Field "%s" is required but was not set.'), $field['name']));
            }
            continue;
        }
        $phpcdb->add_event_field($eid, $fid, $vars["phpc-field-{$fid}"]);
    }
    if ($modify_occur) {
        $occurrences = 0;
        $n = 1;
        $until = $start_ts;
        switch ($vars['repeats']) {
            case 'daily':
                check_input("every-day");
                $n = $vars["every-day"];
                $until = get_timestamp("daily-until");
                break;
            case 'weekly':
                check_input("every-week");
                $n = $vars["every-week"] * 7;
                $until = get_timestamp("weekly-until");
                break;
            case 'monthly':
                check_input("every-month");
                $n = $vars["every-month"];
                $until = get_timestamp("monthly-until");
                break;
            case 'yearly':
                check_input("every-year");
                $n = $vars["every-year"];
                $until = get_timestamp("yearly-until");
                break;
        }
        if ($n < 1) {
            soft_error(__('Increment must be 1 or greater.'));
        }
        while ($occurrences <= 730 && days_between($start_ts, $until) >= 0) {
            $oid = $phpcdb->create_occurrence($eid, $time_type, $start_ts, $end_ts);
            $occurrences++;
            switch ($vars["repeats"]) {
                case 'daily':
                case 'weekly':
                    $start_ts = add_days($start_ts, $n);
                    $end_ts = add_days($end_ts, $n);
//.........这里部分代码省略.........
开发者ID:hubandbob,项目名称:php-calendar,代码行数:101,代码来源:event_form.php



注:本文中的verify_token函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP verify_uploaded_image函数代码示例发布时间:2022-05-23
下一篇:
PHP verify_session函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap