PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of John Diaz   Purifier   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file of using Purifier class
Class: Purifier
Get request variables and sanitize values
Author: By
Last change:
Date: 9 years ago
Size: 872 bytes
 

Contents

Class file image Download
<?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>