request.class.php - AJAX Code Search ~ Ajax Training, Learn Ajax Video Tutorials Online, Ajax Examples
Ajax Training, Learn Ajax Video Tutorials Online, Ajax Examples: request.class.php - AJAX Code Search

request.class.php - AJAX Code Search

<?php

class HttpRequest {
var $get;
var $post;
var $request;
var $cookie;
var $session;

function HttpRequest() {
$this->get = $_GET;
$this->post = $_POST;
$this->cookie = $_COOKIE;
$this->request = array();
$this->init();
}

function init() {
$valueArrays = array($this->get, $this->post, $this->cookie);
foreach($valueArrays as $valueArray) {
if ($valueArray) {
foreach($valueArray as $paramName=>$paramValue) {
if (!is_array($paramValue)) {
$this->request[$paramName] = addslashes(trim(htmlspecialchars(str_replace('\\', '', $paramValue))));
} else {
foreach($paramValue as $index=>$value) {
$paramValue[$index] = addslashes(trim(htmlspecialchars(str_replace('\\', '', $value))));
}
$this->request[$paramName] = $paramValue;
}
}
}
}
}

function getReferer() {
if (isset($GLOBALS['_SERVER']['HTTP_REFERER'])) {
return $GLOBALS['_SERVER']['HTTP_REFERER'];
}
return null;
}

function getIp() {
if (isset($GLOBALS['_SERVER']['REMOTE_ADDR'])) {
return $GLOBALS['_SERVER']['REMOTE_ADDR'];
}
return null;
}

function getUserAgent() {
if (isset($GLOBALS['_SERVER']['REMOTE_ADDR'])) {
return $GLOBALS['_SERVER']['REMOTE_ADDR'];
}
return null;
}

function getParameter($parameterName) {
return isset($this->request[$parameterName]) ? $this->request[$parameterName] : null;
}

function getParameters() {
return $this->request;
}

function getPostVars() {
return $GLOBALS['_POST'];
}

function getGetVars() {
return $GLOBALS['_GET'];
}

function getRequestVars() {
return $GLOBALS['_REQUEST'];
}

function getCookieVars() {
return $GLOBALS['_COOKIE'];
}

function getSessVars() {
return $GLOBALS['_SESSION'];
}

}

?>

Related Posts by Categories

0 comments:

Useful Links on Adobe Flex

Your Ad Here

Latest Books on Adobe Flex