当前位置: 首页>>代码示例>>PHP>>正文


PHP fRequest::validateCSRFToken方法代码示例

本文整理汇总了PHP中fRequest::validateCSRFToken方法的典型用法代码示例。如果您正苦于以下问题:PHP fRequest::validateCSRFToken方法的具体用法?PHP fRequest::validateCSRFToken怎么用?PHP fRequest::validateCSRFToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fRequest的用法示例。


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

示例1: catch

                $project->setState('Extended');
            }
        }
        $project->store();
        $project->submitLog('Status changed to ' . $project->getState(), $user->getId());
        fURL::redirect("/storage/{$project->getId()}");
    } catch (fValidationException $e) {
        echo $e->printMessage();
    } catch (fSQLException $e) {
        echo '<div class="alert alert-danger">An unexpected error occurred, please try again later</div>';
    }
}
// has another member updated the status?
if (isset($_POST['submit']) && ($user->getId() != $project->getUserId() || $user->isAdmin())) {
    try {
        fRequest::validateCSRFToken($_POST['token']);
        if (!isset($_POST['state']) || $_POST['state'] == '') {
            throw new fValidationException('Status field is required.');
        }
        $newStatus = filter_var($_POST['state'], FILTER_SANITIZE_STRING);
        $reason = filter_var($_POST['reason'], FILTER_SANITIZE_STRING);
        if ($newStatus != $project->getState() && $project->canTransitionStates($project->getState(), $newStatus)) {
            $project->setState($newStatus);
            $project->store();
            if ($reason != '') {
                $reason = ' with the reason \'' . $reason . "'";
            }
            // log the update
            $project->submitLog('Status changed to ' . $project->getState() . $reason, $user->getId());
            if ($project->getState() != 'Archived') {
                // send to mailing list
开发者ID:increpare,项目名称:hackspace-foundation-sites,代码行数:31,代码来源:details.php

示例2: catch

        fURL::redirect($manage_url);
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/ackAll_results.php';
} else {
    if ($action == 'notifyAll') {
        try {
            $check = new Check($check_id);
            $subject_mail = fRequest::get('subject_mail');
            $content_mail = fRequest::get('content_mail');
            if (fRequest::isPost()) {
                if (empty($subject_mail) || empty($content_mail)) {
                    fMessaging::create('error', fURL::get(), "You have to fill the subject and the content to send this mail");
                } else {
                    fRequest::validateCSRFToken(fRequest::get('token'));
                    $recipients = array();
                    $id_user_session = fSession::get('user_id');
                    $user_session = new User($id_user_session);
                    $recipients[] = array("mail" => $user_session->getEmail(), "name" => $user_session->getUsername());
                    $alt_ids = array();
                    $subscription_alt = Subscription::findAll($check_id, NULL, NULL, NULL, TRUE);
                    foreach ($subscription_alt as $alt) {
                        $user = new User($alt->getUserId());
                        $recipients[] = array("mail" => usr_var('alt_email', $user->getUserId()), "name" => $user->getUsername());
                        $alt_ids[] = $alt->getUserId();
                    }
                    $subscriptions = $db->query("SELECT DISTINCT user_id,check_id FROM subscriptions WHERE check_id=" . $check_id . ";");
                    foreach ($subscriptions as $sub) {
                        $user_id = $sub['user_id'];
                        if (!in_array($user_id, $alt_ids) && $user_id != $id_user_session) {
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:result.php


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