PHP Classes

Anti XSS Atacks: Clean request values to avoid security attacks

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 839 All time: 4,139 This week: 41Up
Version License PHP version Categories
antixss-attacks 1.0GNU General Publi...5.0E-Commerce, Text processing, Validation, S...
Description 

Author

This class can clean request values to avoid security attacks.

It can take the current request values and filter them to avoid character sequences that can cause security problems.

Currently it can strip HTML tags, encode special HTML characters, sanitize string values, filter email addresses, remove letters with accents and cedillas, replace symbol characters, replace special JavaScript characters, etc.

Picture of Evert Ulises German Soto
  Performance   Level  
Name: Evert Ulises German Soto <contact>
Classes: 3 packages by
Country: Mexico Mexico
Age: 39
All time rank: 5817 in Mexico Mexico
Week rank: 164 Up4 in Mexico Mexico Up

Example

<?php
//First of all, must be include the file class
require("antixss.class.php");

//Creating instance
$xss = new wArLeY_AntiXSS();

//If you need clean your $_GET array you cant test something like this
foreach($_GET AS $key=>$value){
    echo
"<div style='border:1px solid #FE0000;margin-top:5px;'>". $xss->clean($_GET[$key], array('prevent_basic_xss', 'filter_sanitize')) ."</div>";
}

/*
Note:
    The unique method "clean" in the class need 2 params
    1.- The STRING that you need clean
    2.- An array with the clean methods, the methods are execute in the relative order provided.
   
    Existant methods:
    * prevent_basic_xss
    * html_special_character
    * stripe_tags
    * stripe_slashes
    * filter_sanitize
    * filter_email
    * rare_accent
    * special_character
    * allowed_by_os

    The array can content one or more methods to execute.
   
    Protect you and enjoy!
*/
?>


  Files folder image Files (2)  
File Role Description
Plain text file antixss.class.php Class Class file Anti XSS Atacks
Accessible without login Plain text file example.php Example How to use anti xss class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:839
This week:0
All time:4,139
This week:41Up
User Ratings User Comments (1)
 All time
Utility:87%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:-
Examples:81%StarStarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1207
 
clean, well written; thanks
10 years ago (Jack Rowe)
67%StarStarStarStar