Results 1 to 10 of 18
Threaded View
-
21st Jun 2010, 08:05 PM #8MemberWebsite's:
litewarez.net litewarez.com triniwarez.comThe way i prefer to do things is to check all data that can be inputted via GET/POST.
The way i do this is create a class that will recursively check the inputted userdata before we use anywhere within application.
A simple class can do this, taking into note the class below is an example, and is only for informational purposes.
PHP Code:class Input
{
var $get,$post,$cookie; //Cleaned (Not DB)
var $_get,$_post,$_cookie; //Uncleaned / RAW
function __construct()
{
$this->clean();
}
private function clean()
{
//Keep the raw stuff in there designated variables.
$_get = $_GET;
$_post = $_POST;
$_cookie = $_COOKIE;
//Clean them and assign the data to the designated variables;
$get = $this->escape($_GET);
$post = $this->escape($_POST);
$cookie = $this->escape($_COOKIE);
}
public function __get($type)
{
return isset($this->{$type}) ? $this->{$type} : array(); // usage: $input->get->some_key
}
public function escape($var)
{
$return = array();
foreach($var as $key => $val)
{
if(is_array($val))
{
$return[$key] = $this->escape($val);
}else
{
$return[$key] = htmlentities($val); //MORE WORK HERE
}
}
return $return; //Return it;
}
}
Doing your escaping this way reduces the amount of code you need to write as its all done for you,
PeaceJoin Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
How to secure RDP??
By Jiung in forum Technical Help Desk SupportReplies: 6Last Post: 9th Aug 2012, 09:55 PM -
How to Secure SSH in WHM
By Bharat in forum Technical and Security TutorialsReplies: 0Last Post: 28th Dec 2011, 02:10 PM -
How to recover deleted or lost data, file, photo on Mac with Data Recovery software
By Jack20126 in forum General DiscussionReplies: 0Last Post: 20th Dec 2011, 03:37 AM -
How We Can Secure
By WarezMania in forum Webmaster DiscussionReplies: 6Last Post: 17th May 2010, 04:27 PM -
How to convert data of wordpress to data of Datalife Engine
By chipve in forum Webmaster DiscussionReplies: 0Last Post: 5th May 2010, 05:35 PM
themaCreator - create posts from...
Version 3.47 released. Open older version (or...