Sanitizing email user inputs


Data verification is an essential part of web development, especially when working with forms where users start to enter their information and send it to the database. Data sent in invalid format may cause DBMS security issues. Hackers often use SQL injections to insert malicious SQL commands into the database, and SQL injections can destroy a database once installed. Therefore, to protect the database from hackers, it is necessary to clean and filter the data entered by the user before sending it to the database.

Let's look at some of the types of checks and their examples: String Sanitization - FILTER_SANITIZE_STRING: This removes all HTML tags from the thread. This will clean up the input thread and prevent any HTML tag from entering the database.

<? php $ geeks = "<h1> Geek </h1>" site; $ newgeeks = filter_var ($ geeks, FILTER_SANITIZE_STRING); write $ newgeeks; ?>

Release:

Geek Portal
Code Description:
In the example above, the 'geek' variable ends in the 'Geek Portal' heading. This 'geek' variant is filtered using FILTER_SANITIZE_STRING. The thread is filtered and stored in the 'new geeks' variable. After echoing, the output comes out in the 'Geek Portal.' There was no HTML tag on the first thread, so there was nothing to filter.
IP Address Verification - FILTER_VALIDATE_IP: This filter checks whether the IP address is valid or not.

<? php $ ipaddr = "126.0.0.5"; if (! filter_var ($ ipaddr, FILTER_VALIDATE_IP) === false) { echo ("Valid IP Address"); } more { echo ("Invalid IP address"); } ?>

Release:

Invalid IP address
Code Description:
The IP address stored in the $ ipaddr variable is active. If '126.2.5 'were kept with a $ ipaddr variable, the result would be' Invalid IP Address.' This is because it does not follow the protocol for IP addresses.