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


PHP Request::getPost方法代码示例

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


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

示例1: validateRequest

 public function validateRequest(array $requiredParams)
 {
     $objUtilResponse = new Response();
     $objUtilRequest = new Request();
     if ($objUtilRequest->isPost()) {
         $accessKeyId = $objUtilRequest->getPost('access_key', false);
         $signature = trim($objUtilRequest->getPost('signature', false));
         $timestamp = $objUtilRequest->getPost('timestamp', false);
         // Required to generate variable signature
         $parameters = array('timestamp' => $timestamp);
         $allParamsPresent = true;
         foreach ($requiredParams as $paramName) {
             $paramValue = $objUtilRequest->getPost($paramName, false);
             if ($paramName) {
                 $parameters[$paramName] = $paramValue;
             } else {
                 $allParamsPresent = false;
                 break;
             }
         }
         if ($accessKeyId && $signature && $timestamp) {
             // Okay we have all required parameters
             // Let's identify user
             $requestParams = $objUtilRequest->getRequest();
             $objServerHelper = new ServerInfo();
             $url = $objServerHelper->serverUrl(true);
             $userSyncRestMdl = new \api\Server($parameters, $accessKeyId, null, $url);
             $isValidTimestamp = $userSyncRestMdl->isValidTimestamp($timestamp);
             if (!$isValidTimestamp) {
                 $objUtilResponse->renderJson(array('status' => 403, 'message' => 'Invalid Timestamp'), 403);
             }
             $userProductMdl = new \models\ApiProducts();
             $apiProductDetails = $userProductMdl->isValidAccessKey($accessKeyId);
             if ($apiProductDetails) {
                 // Valid access key
                 $userSyncRestMdl->setSecretKey($apiProductDetails->secret_key);
                 $isValidSignature = $userSyncRestMdl->isValidSignature($signature);
                 if ($isValidSignature === true) {
                     return $apiProductDetails;
                 } else {
                     $objUtilResponse->renderJson(array('status' => 403, 'message' => 'Invalid Signature'), 403);
                 }
             } else {
                 $objUtilResponse->renderJson(array('status' => 403, 'message' => 'Invalid access key.'), 403);
             }
         } else {
             $objUtilResponse->renderJson(array('status' => 403, 'message' => 'Required parameters are missing.'), 403);
         }
     } else {
         $objUtilResponse->renderJson(array('status' => 403, 'message' => 'Only post requests are accepted'), 403);
     }
 }
开发者ID:samiksha-singla,项目名称:Api-Framework,代码行数:52,代码来源:Validator.php

示例2: saveRouteAction

 public function saveRouteAction()
 {
     $message = ErMessenger::getInstance();
     $request = new Request();
     $request->initRequest();
     $post = $request->getPost();
     $userEmail = ErSession::getFromSession('user');
     $roadMapper = new RoadMapper();
     $road = new Roadrout();
     $road->id = (string) time();
     $road->driverid = $userEmail;
     $road->start = $post['id_citystart'];
     $road->start_adress = $post['id_streetstart'];
     $road->finish = $post['id_cityfinish'];
     $road->finish_adress = $post['id_streetfinish'];
     $road->terms = $post['dopinfo'];
     $road->autoid = $post['regnumber'];
     $road->freeseats = $post['seats'];
     $road->price = $post['price'];
     $road->startdate = $post['dateDep'];
     $road->timetrip = $post['dateArrival'];
     $road->status = 'opened';
     if ($roadMapper->insertNewRoad($road)) {
         $message->setSucceedMessage('202', 'index/index');
         ErApplication::redirect('/');
     } else {
         $message->setErrMessage('100', 'road/addRoute');
         ErApplication::redirect('road/addRoute');
     }
 }
开发者ID:G-Grand,项目名称:webosen2014_diplom,代码行数:30,代码来源:RoadController.php

示例3: test2

 public function test2()
 {
     $data['user'] = Request::getPost('username');
     $data['pass'] = Request::getPost('password');
     $return_data = array('error' => 0, 'msg' => 'ok', 'data' => $data);
     $this->ajaxReturn($return_data);
 }
开发者ID:Rgss,项目名称:imp,代码行数:7,代码来源:IndexController.php

示例4: checkRequest

 public static function checkRequest($type, $key, $validation, $strict = false)
 {
     switch ($type) {
         case 'server':
             $value = Request::getServer($key);
             break;
         case 'post':
             $value = Request::getPost($key);
             break;
     }
     if ($value == false) {
         return false;
     }
     switch ($validation) {
         case 'boolean':
             return self::isBoolean($value, $strict);
         case 'date':
             return self::isDate($value);
         case 'integer':
             return self::isInteger($value, $strict);
         case 'ip':
             return self::isIP($value);
         case 'string':
             return self::isString($value, $strict);
         case 'url':
             return self::isURL($value, $strict);
         case 'name':
             return self::isName($value, $strict);
         case 'email':
             return self::isEmail($value, $strict);
     }
     return false;
 }
开发者ID:jacobemerick,项目名称:web,代码行数:33,代码来源:Validate.class.inc.php

示例5: upload

function upload()
{
    global $root;
    if ($_FILES['sub']['size'] == 0 && $_FILES['sub']['error'] > 0) {
        return 'Error al subir el subtítulo.';
    }
    $file = $_FILES['sub']['name'];
    $frame = Request::getPost('frame');
    $comment = Request::getPost('comment');
    $credits = Request::getPost('credits');
    if (empty($frame)) {
        return 'Falta el frame.';
    }
    $format = substr($file, -3);
    $formatName = Formats::get($format);
    if (empty($formatName)) {
        return 'El archivo no es de un formato válido.';
    }
    $filename = substr($file, 0, strlen($file) - 4);
    $id = Db::insert('subs', array('filename' => $filename, 'ext' => $format, 'frame' => $frame, 'comment' => $comment, 'credits' => $credits, 'time' => time()));
    $fullpath = "{$root}/upload/{$id}";
    # $fullpath = "/var/www/subs/$id";
    if (!@move_uploaded_file($_FILES['sub']['tmp_name'], $fullpath)) {
        if ($id) {
            Db::delete('subs', "id = '{$id}'");
        }
        return 'No se logró subir el archivo, intente nuevamente en unos minutos.';
    }
    header("Location: /{$id}.html");
}
开发者ID:joksnet,项目名称:php-old,代码行数:30,代码来源:upload.php

示例6: post

    public function post()
    {
        if (!('' == Request::getPost('fake', ''))) {
            return false;
        }
        if (!isset($this->datos['correo']) || isset($this->datos['correo']) && empty($this->datos['correo']->contenido)) {
            return false;
        }
        $to = $this->datos['correo']->contenido;
        $nombre = Request::getPost('nombre', '');
        $correo = Request::getPost('correo', '');
        $mensaje = Request::getPost('mensaje', '');
        $nombreLang = __('Nombre y Apellidos');
        $correoLang = __('Correo Electrónico');
        $mensajeLang = __('Mensaje');
        $text = __('Nombre: $0\\nCorreo: $1\\nMensaje:\\n$2', $nombre, $correo, $mensaje);
        $html = <<<HTML
<p>{$nombreLang}: {$nombre}</p>
<p>{$correoLang}: {$correo}</p>
<p>{$mensajeLang}:<br />{$mensaje}</p>
HTML;
        DefinedMail::from('info@buenosairesrentnow.com', 'BsAs Rent Now');
        DefinedMail::mail('[BARN] ' . __('Mensaje de $0', $nombre))->to($to)->text($text)->html($html)->send();
        return new Url(array('ok' => 1));
    }
开发者ID:joksnet,项目名称:php-old,代码行数:25,代码来源:Contacto.php

示例7: process_form

 private function process_form()
 {
     $domain = Request::getPost('domain');
     if (strlen($domain) < 1) {
         return;
     }
     $this->set_body('form_success', true);
     $url = CrawlerURL::instance($domain);
     $domain = $url->getDomain();
     $link = "{$domain}/";
     $domainObject = Finder::instance('Domain')->setNameFilter($domain)->getDomain();
     if (!$domainObject) {
         $domainObject = Mutator::instance('Domain', 'Create')->setData($domain)->execute();
     }
     $linkObject = Finder::instance('Link')->setNameFilter($link)->getLink();
     if (!$linkObject) {
         $linkObject = Mutator::instance('Link', 'Create')->setData($link)->execute();
     }
     $crawlSiteQueueObject = Finder::instance('CrawlSiteQueue')->setDomainFilter($domainObject->getID())->setStatusFilter(CrawlSiteQueue::$IS_UNCRAWLED)->getCrawlSiteQueue();
     if (!$crawlSiteQueueObject) {
         Mutator::instance('CrawlSiteQueue', 'Create')->setData($domainObject, CrawlSiteQueue::$IS_UNCRAWLED)->execute();
     }
     $crawlPageQueueObject = Finder::instance('CrawlPageQueue')->setDomainFilter($domainObject->getID())->setLinkFilter($linkObject->getID())->setStatusFilter(CrawlPageQueue::$IS_UNCRAWLED)->getCrawlPageQueue();
     if (!$crawlPageQueueObject) {
         Mutator::instance('CrawlPageQueue', 'Create')->setData($domainObject, $linkObject, CrawlPageQueue::$IS_UNCRAWLED)->execute();
     }
 }
开发者ID:jacobemerick,项目名称:crawler,代码行数:27,代码来源:HomeController.class.inc.php

示例8: get_form_results

	private function get_form_results()
	{
		if(!Request::hasPost())
			return array();
		
		if(!Validate::checkRequest('post', 'name', 'string'))
			$error_message['name'] = 'Please enter a value for your name.';
		if(!Validate::checkRequest('post', 'email', 'string'))
			$error_message['email'] = 'Please enter a valid email address.';
		if(!Validate::checkRequest('post', 'message', 'string'))
			$error_message['message'] = 'Please enter a message.';
		
		if(!empty($error_message))
		{
			return array(
				'error_message' => $error_message,
				'value' => Request::getPost());
		}

    global $container;
    $sent = $container['mail']
      ->addTo($container['config']->admin_email)
      ->setSubject('Site Contact')
      ->setPlainMessage(
        'Name: ' . Request::getPost('name') . "\n" .
        'Email: ' . Request::getPost('email') . "\n" .
        'Message: ' . Request::getPost('message')
      )
      ->send();

		return array(
			'success_message' => "Thank you for your message, " . Request::getPost('name') . "! I'll get back to you as soon as possible.");
	}
开发者ID:jacobemerick,项目名称:web,代码行数:33,代码来源:ContactController.class.inc.php

示例9: post

 public function post()
 {
     $this->inmueble->inmueble_pagina_id_inicio = Request::getPost('inicio', $this->inmueble->found() ? $this->inmueble->inmueble_pagina_id_inicio : 0);
     $this->inmueble->inmueble_pagina_id_lateral = Request::getPost('lateral', $this->inmueble->found() ? $this->inmueble->inmueble_pagina_id_lateral : 0);
     $this->inmueble->diseno = Request::getPost('diseno', $this->inmueble->found() ? $this->inmueble->diseno : 0);
     $this->inmueble->update();
     return "/admin/inmuebles/{$this->codigo}?config=1";
 }
开发者ID:joksnet,项目名称:php-old,代码行数:8,代码来源:Configuracion.php

示例10: submit

 public function submit()
 {
     list($this->validationFlag, $this->validation) = Validation::check(array('nombre' => 'required'));
     if ($this->validationFlag) {
         $nombre = Request::getPost('nombre');
         Db::insert('empresas', array('nombre' => $nombre, 'fecha_creacion' => time()));
         Response::setRedirect('/personas');
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:9,代码来源:EmpresasAgregar.php

示例11: init

 public function init()
 {
     if (!Session::getInstance()->usuario) {
         return '/admin/ingresar';
     }
     $configuration = Configuration::getInstance();
     $this->config = array('nombre' => Request::getPost('nombre', $configuration->nombre), 'idioma' => Request::getPost('idioma', $configuration->idioma), 'efecto' => Request::getPost('efecto', $configuration->efecto), 'twitter' => Request::getPost('twitter', $configuration->twitter), 'per' => Request::getPost('per', $configuration->per));
     return true;
 }
开发者ID:joksnet,项目名称:php-old,代码行数:9,代码来源:Configuracion.php

示例12: init

 /**
  * 初始化
  * 
  */
 public function init()
 {
     $this->set('currentUrl', Request::currentUrl());
     $this->set('refererUrl', Request::refererUrl());
     $this->set('controller', Router::getController());
     $this->set('action', Router::getAction());
     $this->set('get', Request::getGet());
     $this->set('post', Request::getPost());
 }
开发者ID:Rgss,项目名称:imp,代码行数:13,代码来源:Tracer.php

示例13: post

 public function post()
 {
     $login = new Personas();
     $login->usuario = Request::getPost('usuario', '');
     $login->contrasena = md5(Request::getPost('contrasena', ''));
     if (!$login->queryAll()) {
         return false;
     }
     Session::getInstance()->usuario = $login->usuario;
     return '/admin';
 }
开发者ID:joksnet,项目名称:php-old,代码行数:11,代码来源:Ingresar.php

示例14: submit

 public function submit()
 {
     list($this->validationFlag, $this->validation) = Validation::check(array('nombre' => 'required', 'apellido' => 'required'));
     if ($this->validationFlag) {
         $nombre = Request::getPost('nombre');
         $apellido = Request::getPost('apellido');
         $correo = Request::getPost('correo');
         $cargo = Request::getPost('cargo');
         Db::insert('personas', array('id_empresas' => $this->idEmpresas, 'nombre' => $nombre, 'apellido' => $apellido, 'correo' => $correo, 'cargo' => $cargo, 'fecha_creacion' => time()));
         Response::setRedirect("/empresas/{$this->idEmpresas}/personas");
     }
 }
开发者ID:joksnet,项目名称:php-old,代码行数:12,代码来源:EmpresasPersonasAgregar.php

示例15: verify

 public static function verify()
 {
     $request = new Request();
     $request->initRequest();
     $post = $request->getPost();
     //��������� ������������ ���� CAPTCHA
     if (ErSession::getFromSession("code") == $post['captcha']) {
         //�������� ������ true, ���� ��� �������������
         return true;
     } else {
         //�������� ������ false, ���� ��� �� �������������
         return false;
     }
 }
开发者ID:G-Grand,项目名称:webosen2014_diplom,代码行数:14,代码来源:Captcha.php


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