Giter Site home page Giter Site logo

securityclass's Introduction

securityClass

This is a set of class which can secure the application against XSS and SQL Injection.

This class will also help to fight against the Cross-Site Request Forgery (CSRF).

There are 2 different classes for both the functionalities which can be used in package as well as independent class.

Usage for FilterClass

  1. For Filtering a Single value

    $objString = FilterClass::prepareDataObject($valueToFilter, $filterArray); $finalValue = FilterClass::filterDataValue($objString);

    In Above a. $valueToFilter: Teh value which can to be filtered b. $filterArray: operation to be performed on the string eg: $filterArray = array('strip_tags' => array(), 'addslashes' => array());

  2. For Filtering the complte array $resultArray = FilterClass::filterXSS($arrayToFilter);

    In Above: $arrayToFilter: This is the array to be filtered ($_POST, $_GET, $_REQUEST, or any array with values);

    Note: This is only to filter XSS

Usage for RestrictCSRF Class

  1. Simply add value attribute to your input tag similar to

    value=""

    in the form for which you want the CSRF Protection to be implemented

  2. And on POST on the action page check

    if(!RestrictCSRF::checkToken(form_name_value, $array_to_be_checked)) { redirect('index.php'); }

    In above:

    a. form_name_value: name of the form on the design page b. $array_to_be_checked: the array which contains the CSRF token ($_POST, $_GET, $_REQUEST) as per the implementation.

securityclass's People

Contributors

ksaurabhsinha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.