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


PHP PMF_User_CurrentUser::getCsrfTokenFromSession方法代码示例

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


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

示例1: sprintf

 // delete user confirmation
 if ($userAction == 'delete_confirm' && $user->perm->checkRight($user->getUserId(), 'deluser')) {
     $message = '';
     $user = new PMF_User_CurrentUser($faqConfig);
     $userId = PMF_Filter::filterInput(INPUT_POST, 'user_list_select', FILTER_VALIDATE_INT, 0);
     if ($userId == 0) {
         $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_noId']);
         $userAction = $defaultUserAction;
     } else {
         $user->getUserById($userId);
         // account is protected
         if ($user->getStatus() == 'protected' || $userId == 1) {
             $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_protectedAccount']);
             $userAction = $defaultUserAction;
         } else {
             $twig->loadTemplate('user/delete_confirm.twig')->display(array('PMF_LANG' => $PMF_LANG, 'csrfToken' => $user->getCsrfTokenFromSession(), 'userId' => $userId, 'userLogin' => $user->getLogin()));
         }
     }
 }
 // delete user
 if ($userAction == 'delete' && $user->perm->checkRight($user->getUserId(), 'deluser')) {
     $message = '';
     $user = new PMF_User($faqConfig);
     $userId = PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT, 0);
     $csrfOkay = true;
     $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
     if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) {
         $csrfOkay = false;
     }
     $userAction = $defaultUserAction;
     if ($userId == 0 && !$csrfOkay) {
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:31,代码来源:user.php

示例2: sprintf

        $groupAction = $defaultGroupAction;
        $message = sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_group_suc']);
        // display error messages and show form again
    } else {
        $groupAction = 'add';
        $message = '<p class="alert alert-error">';
        foreach ($messages as $err) {
            $message .= $err . '<br />';
        }
        $message .= '</p>';
    }
}
if (!isset($message)) {
    $message = '';
}
// show new group form
if ($groupAction == 'add' && $user->perm->checkRight($user->getUserId(), 'addgroup')) {
    $user = new PMF_User_CurrentUser($faqConfig);
    $twig->loadTemplate('group/add.twig')->display(array('PMF_LANG' => $PMF_LANG, 'csrfToken' => $user->getCsrfTokenFromSession(), 'descriptionCols' => $descriptionCols, 'descriptionRows' => $descriptionRows, 'groupAutoJoin' => !empty($group_auto_join), 'groupDescription' => isset($group_description) ? $group_description : '', 'groupName' => isset($group_name) ? $group_name : '', 'message' => $message));
}
// end if ($groupAction == 'add')
// show list of users
if ($groupAction == 'list') {
    $rightsData = $user->perm->getAllRightsData();
    foreach ($rightsData as $key => $right) {
        if (isset($PMF_LANG['rightsLanguage'][$right['name']])) {
            $rightsData[$key]['description'] = $PMF_LANG['rightsLanguage'][$right['name']];
        }
    }
    $twig->loadTemplate('group/list.twig')->display(array('PMF_LANG' => $PMF_LANG, 'descriptionCols' => $descriptionCols, 'descriptionRows' => $descriptionRows, 'groupAutoJoin' => !empty($group_auto_join), 'groupDescription' => isset($group_description) ? $group_description : '', 'groupName' => isset($group_name) ? $group_name : '', 'groupSelectSize' => $groupSelectSize, 'memberSelectSize' => $memberSelectSize, 'message' => $message, 'rightsData' => $rightsData));
}
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:31,代码来源:group.php

示例3:

                ?>
 <strong><?php 
                print $user->getLogin();
                ?>
</strong></legend>
        <p><?php 
                print $text['delUser_question'];
                ?>
</p>
        <form action ="?action=user&amp;user_action=delete" method="post">
            <input type="hidden" name="user_id" value="<?php 
                print $userId;
                ?>
" />
            <input type="hidden" name="csrf" value="<?php 
                print $user->getCsrfTokenFromSession();
                ?>
" />
            <div class="button_row">
                <input class="reset" type="submit" name="cancel" value="<?php 
                print $text['delUser_cancel'];
                ?>
" />
                <input class="submit" type="submit" value="<?php 
                print $text['delUser_confirm'];
                ?>
" />
            </div>
        </form>
    </fieldset>
</div>
开发者ID:rybal06,项目名称:phpMyFAQ,代码行数:31,代码来源:user.php


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