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


PHP r::postData方法代码示例

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


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

示例1: function

<?php

return function ($site, $pages, $page) {
    //set variables
    $troubleshootLink = null;
    $typeOfTroubleshoot = null;
    $invalid = null;
    //if $_POST data is present
    if (count($_POST) > 0) {
        //store specific sanitized $_POST variables into $data variable
        $data = r::postData(array('email', 'password'));
        //define validation rules for $data
        $rules = array('email' => array('required', 'email'), 'password' => array('required', 'match' => c::get('password.length.regex')));
        //define validation messages for $data
        $messages = array('email' => l('field.email.validation.message'), 'password' => l('field.password.validaton.message'));
        //if validation is passed
        if (!($invalid = invalid(array_filter($data), $rules, $messages))) {
            //compute user's username (based upon user's email)
            $computedUsername = Auth::computeUsername($data['email']);
            //get user
            $user = Auth::loadUser($computedUsername);
            //if user exists
            if ($user) {
                //get user's activation hash
                //(if user's activation hash is empty -> user is activated, otherwise not)
                //please note: in case the activation procedure is disabled
                //this test evaluates always to true, as if the user was activated
                $isActivated = $user->activation();
                //if user has been activated
                if (empty($isActivated)) {
                    //set login redirect page to tests page
开发者ID:alkaest2002,项目名称:risky2,代码行数:31,代码来源:login.php

示例2: function

<?php

return function ($site, $pages, $page) {
    //set variables
    $url = null;
    $data = null;
    $status = null;
    //if page is accessed thorugh ajax
    if (r::ajax()) {
        //store sanitized $_POST variables
        $currentTestData = r::postData(array('test', 'user', 'data'));
        //get logged user (if any)
        if ($user = Auth::loggedUser()) {
            //get user's session page
            $userSession = site()->find(implode(DS, array(c::get('sessions.folder'), $user->session())));
            //istantiate testSession object
            $tSession = new testSession($userSession, $user->username());
            //get user's current session status
            $userSessionStatus = $user->status();
            //if ajaxed $currentTestData equals user's current session status
            if (str::lower($currentTestData['test']) == str::lower($userSessionStatus)) {
                //if it was possitble to update user's results file (by appending $currentTestData)
                if (f::append($tSession->getUserResultsFile(), PHP_EOL . a::json($currentTestData))) {
                    //set updated user's session status to next avalibale test
                    $updatedStatus = $tSession->getNextTest($currentTestData['test']);
                    //if there aren't tests available, set user's session statuts to completed session
                    if (!$updatedStatus) {
                        $updatedStatus = c::get('session.status.completed');
                    }
                    //update user's session status to next avalibale test
                    $user->update(array('status' => $updatedStatus));
开发者ID:alkaest2002,项目名称:risky2,代码行数:31,代码来源:cerebro.php

示例3: function

return function ($site, $pages, $page) {
    //set variables
    $data = null;
    $userTestSession = null;
    $invalid = null;
    $success = null;
    //get current logged user
    $user = Auth::loggedUser();
    //if a user is currently logged
    if ($user) {
        //get user's subscribed session
        $userTestSession = $pages->find(implode(DS, array(c::get('sessions.folder'), $user->session())));
        //if $_POST data is present
        if (count($_POST) > 0) {
            //store specific sanitized $_POST variables into editData session variable
            s::set('editData', r::postData(array('password', 'password2')));
            //redirect to same page (POST/GET/REDIRECT PATTERN-like)
            header('HTTP/1.1 303 See Other');
            header('Location: ' . $page->url());
        } elseif (s::get('editData')) {
            //store editData session variable into $data
            $data = s::get('editData');
            //unset editData session variable
            s::remove('editData');
            //define validation rules for $data
            $rules = array('password' => array('required', 'match' => c::get('password.length.regex')), 'password2' => array('required', 'same' => $data['password']));
            //define validation messages for $data
            $messages = array('password' => l('field.password.validaton.message'), 'password2' => l('field.password2.validaton.message'));
            //edit user only if validation is passed
            if (!($invalid = invalid(array_filter($data), $rules, $messages))) {
                //store user's old password
开发者ID:alkaest2002,项目名称:risky2,代码行数:31,代码来源:edit.php

示例4: function

<?php

return function ($site, $pages, $page) {
    //set variables
    $user = null;
    $data = null;
    $invalid = null;
    $success = null;
    //if $_POST data is present
    if (count($_POST) > 0) {
        //store specific sanitized $_POST variables into registerData session variable
        s::set('registerData', r::postData(array('email', 'password', 'password2', 'session')));
        //redirect to same page (POST/GET/REDIRECT PATTERN-like)
        header('HTTP/1.1 303 See Other');
        header('Location: ' . $page->url());
    } elseif (s::get('registerData')) {
        //store registerData session variable into $data varaiable
        $data = s::get('registerData');
        //unset $registerData session variable
        s::remove('registerData');
        //define validation rules for $data
        $rules = array('email' => array('required', 'email'), 'password' => array('required', 'match' => c::get('password.length.regex')), 'password2' => array('required', 'same' => $data['password']), 'session' => array('required'));
        //define validation messages for $data
        $messages = array('email' => l('field.email.validation.message'), 'password' => l('field.password.validaton.message'), 'password2' => l('field.password2.validaton.message'), 'session' => l('field.session.validaton.message'));
        //if validation is passed
        if (!($invalid = invalid(array_filter($data), $rules, $messages))) {
            //compute user's username (based upon user's email)
            $computedUsername = Auth::computeUsername($data['email']);
            //**** USER DATA****************************************************************************
            //user's computed name
            $paramUsername = $computedUsername;
开发者ID:alkaest2002,项目名称:risky2,代码行数:31,代码来源:register.php


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