Skip to content

Latest commit

 

History

History
63 lines (53 loc) · 1.66 KB

README.md

File metadata and controls

63 lines (53 loc) · 1.66 KB

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