PHP exit help

The code -

$price = mysqli_real_escape_string($connect,trim($results['price']));

the price is retrieved from the database and then repeated using -

echo $price; 

Question. How safe is it for XSS or SQL Injection? It just includes numbers.

thank

+3
source share
5 answers

Validation should probably be performed during data entry, but you can be safe and also validate on exit. I would just use is_numericor something similar to ensure that the output is really a number.

+4
source

htmlspecialchars() htmlentities() XSS. , , , . .

0

, , $results['price'] .

/ SQL.

0

db, mysqli_real_escape_string(). , db.

0

mysqli_real_escape_string() , , SQL. XSS.

htmlentities(), , . is_numeric .

0

Source: https://habr.com/ru/post/1795335/


All Articles