Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 05:10

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Disable XSS(Script execution from input)

Discussion on Disable XSS(Script execution from input) within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
Angellinho's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 102
Received Thanks: 25
Disable XSS(Script execution from input)

I saw a lot of old search scripts and some register pages that get XSS so easy.
So, to disable in script the tags that can be added, sended from GET or POST, you can use the following code into your PHP Code.
PHP Code:
    if(isset($_GET)) $_GET array_map("strip_tags"$_GET);
    if(isset(
$_POST)) $_POST array_map("strip_tags"$_POST); 
Angellinho is offline  
Old 12/23/2011, 14:57   #2


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,974
I use this:

Code:
function cleanUp($data) { 
    $data = stripslashes($data); 
    $data = strip_tags($data); 
    // $data = mysql_real_escape_string($data); 
    return $data; 
}

if(isset($_GET)) $_GET = array_map("cleanUp", $_GET); 
if(isset($_POST)) $_POST = array_map("cleanUp", $_POST);
Whoknowsit is offline  
Old 04/14/2012, 23:50   #3
 
Angellinho's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 102
Received Thanks: 25
Hmm, now I use other one:
Code:
<?php

function mssql_escape($str){ 
    $str = htmlentities($str); 
    if (ctype_alnum($str))  
        return $str; 
    else 
        return str_ireplace(array(';', '%', "'", "--", "<", ">", "&"), "", $str);    
} 

?>
And I`m including it to the php scripts.
Angellinho is offline  
Reply




All times are GMT +1. The time now is 05:11.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.