Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,372 members, 7,954,507 topics. Date: Friday, 20 September 2024 at 08:46 PM

What Is The Right Way To Escape User Input And Output Data Against Xss And Sql I - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / What Is The Right Way To Escape User Input And Output Data Against Xss And Sql I (373 Views)

The Right Way To Blog / Please Is This Script Free From Sql Injection And Xss Attacks (2) (3) (4)

(1) (Reply)

What Is The Right Way To Escape User Input And Output Data Against Xss And Sql I by Nobody: 9:57am On Jan 21, 2017
What is the right way to escape user input and output data's against xss and sql injection?
This is the one i wanted to use, i don't know if it is secured.

**This below as input**

function check_input($data) {
$data = trim($data);
$data = strip_tags($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
$data = filter_var($data, FILTER_SANITIZE_STRING);
return $data;
}


**Then use this below as the output**

echo htmlspecialchars($data, ENT_QUOTES, 'UTF-8');

or



echo htmlentities($data, ENT_COMPAT, 'UTF-8', false);

(1) (Reply)

Enterprise-class Wordpress Web Hosting Services / Generate Free Backlinks With Reputable Site To Boost Your SEO / Start Making $7,898 Monthly Online Google Adsense/ Simple Method

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 4
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.