PHP Classes

Purifier: Get request variables and sanitize values

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 227 All time: 8,187 This week: 146Up
Version License PHP version Categories
purifier 1.0.0GNU General Publi...4.5PHP 5, Cryptography, Validation, Secu...
Description 

Author

This class can get request variables and sanitize values.

It can retrieve request variable values from either $_POST, $_GET or $_REQUEST.

The class can filter and sanitize the request values by either validating they they match expected type values and remove characters that are not expected.

The class can also generate hashes and verify values for passwords.

Picture of John Diaz
  Performance   Level  
Name: John Diaz <contact>
Classes: 3 packages by
Country: Colombia Colombia
Age: 42
All time rank: 289715 in Colombia Colombia
Week rank: 180 Up1 in Colombia Colombia Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php

include('Purifier.php');
$purifier = new Purifier;

$name = $purifier->getInputVar('name');

echo
'<br /><strong>Sanitized var:</strong> ' . $name ;
echo
'<br /><strong>Clean String:</strong> ' . $purifier->cleanString($name);
echo
'<br /><strong>Gen Secure Password:</strong> ' . $purifier->genSecurePassword(32);
echo
'<br /><strong>Gen Unique key:</strong> ' . $purifier->genKey(32);
$saltedPassword = $purifier->encryptPassword($name);
echo
"<br /><strong>Gen Hashed & Salted Password from '$name' :</strong>\n" .$saltedPassword ;
echo
'<br /><strong>Validate Salted Password:</strong> ';
var_dump($purifier->validatePassword($name, $saltedPassword));

?>
<hr />
<form action="example.php" method="post">
    <label>Name:</label> <input type="text" name="name" value="<?php echo $name ?>"/>
    <input type="submit" value="submit"/>
</form>


  Files folder image Files (2)  
File Role Description
Plain text file Purifier.php Class Purifier Class
Accessible without login Plain text file example.php Example Example file of using Purifier class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:227
This week:0
All time:8,187
This week:146Up