From 2eed7b082f83630301e51f57ca8394de228a8605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 18 Aug 2019 21:14:58 -0500 Subject: first commit --- public/system/library/request.php | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 public/system/library/request.php (limited to 'public/system/library/request.php') diff --git a/public/system/library/request.php b/public/system/library/request.php new file mode 100644 index 0000000..9b63a31 --- /dev/null +++ b/public/system/library/request.php @@ -0,0 +1,51 @@ +get = $this->clean($_GET); + $this->post = $this->clean($_POST); + $this->request = $this->clean($_REQUEST); + $this->cookie = $this->clean($_COOKIE); + $this->files = $this->clean($_FILES); + $this->server = $this->clean($_SERVER); + } + + /** + * + * @param array $data + * + * @return array + */ + public function clean($data) { + if (is_array($data)) { + foreach ($data as $key => $value) { + unset($data[$key]); + + $data[$this->clean($key)] = $this->clean($value); + } + } else { + $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8'); + } + + return $data; + } +} \ No newline at end of file -- cgit v1.2.3