Created
June 4, 2019 02:27
-
-
Save CeoFred/eb1be27db8d7953540c3e6542e0e9090 to your computer and use it in GitHub Desktop.
Filter Request Data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sanitize($data){ | |
| trim($data); | |
| htmlspecialchars($data); | |
| htmlentities($data); | |
| strip_tags($data); | |
| return $data; | |
| } | |
| foreach ($_REQUEST as $key => $value) { | |
| sanitize($value); | |
| } | |
| //use them as normal | |
| $facebook_link = isset($_REQUEST['facebook_url']) ? $_REQUEST['facebook_url'] : null; | |
| $twitter_link = isset($_REQUEST['twitter_url']) ? $_REQUEST['twitter_url'] : null; | |
| $linkedin = isset($_REQUEST['linkedin_url']) ? $_REQUEST['linkedin_url'] : null; | |
| $website = isset($_REQUEST['website_url']) ? $_REQUEST['website_url'] : null; | |
| $fax = isset($_REQUEST['fax']) ? $_REQUEST['fax'] : null; | |
| $logo = isset($_FILES['logo']) ? $_FILES['logo'] : null; | |
| $rcc = isset($_REQUEST['reg_no']) ? $_REQUEST['reg_no'] : null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment