mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 21:43:06 +05:30
(refactor): improved search security by filtering input keyword given by the user
This commit is contained in:
@@ -2,9 +2,17 @@
|
||||
require 'connection.php';
|
||||
require 'query_functions.php';
|
||||
|
||||
function input_filter($data){
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (isset($_POST['keyword'])) {
|
||||
$keyword = $_POST['keyword'];
|
||||
$keyword = input_filter($keyword);
|
||||
$results_array = [
|
||||
$results_projects = fetch_search_results_projects($conn, $keyword),
|
||||
$results_socials = fetch_search_results_socials($conn, $keyword),
|
||||
|
||||
Reference in New Issue
Block a user