PHP Classes

Purifier: Get request variables and sanitize values

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 226 This week: 1All time: 8,194 This week: 560Up
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: 41
All time rank: 289115 in Colombia Colombia
Week rank: 411 Up2 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  
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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:226
This week:1
All time:8,194
This week:560Up