Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,171 members, 7,815,099 topics. Date: Thursday, 02 May 2024 at 07:16 AM

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 (353 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)

Benefits Of Having A Website As A Business Owner / Germany Reseller Hosting - 100% SSD / Cpanel Control Panel / 99.9% Uptime / P2P Script Needed

(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. 38
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.