Skip to content

Class for sanitizing form data and preparing data to be stored in database

License

Notifications You must be signed in to change notification settings

sagarguhe/PHP_Form_Data_Sanitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

PHP Form Data Sanitizer

This class lets you quickly sanitize the request array and make it ready to store in the database. This is my first try at OOP PHP so there may be many issues with standards and concepts. I will appreciate your incredible contribution.


Table of content

Installation

    require_once ('DataSanitizer.php');

Initialization

    $clean = new DataSanitizer($_REQUEST);

Sanitize Request Array

Sanitize HTML in array element

    $clean->sanitizeArrayHtml();

MySQL Escape Array Elements

Mysql escape array elements

    $clean->sqlEscapeArray();

Both Sanitize And Escape Array Elements

Both sanitize and escape array elements

    $clean->sanitizeAndSqlEscArray();

Sanitize String

Alternative to htmlspecialchars();

    $clean->sanitizeStr($str);

MySQL Escape String

Alternative to addslashes();

    $clean->sqlEscapeStr($str);

Both Sanitize And Escape String

Both sanitize and Escape string

    $clean->sanitizeAndSqlEscString($str);

Contribution

I need your contribution. Your contribution will make me learn from you and will make me more passionate about this community. Thanks!! :D

About

Class for sanitizing form data and preparing data to be stored in database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages