Last active
December 30, 2019 12:05
-
-
Save alanef/4eba8d8374a60338d3eaa18147328467 to your computer and use it in GitHub Desktop.
Santized input php example
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
| <?php | |
| if ( | |
| isset( $_GET['id'] ) && | |
| isset( $_GET['name'] ) && | |
| isset( $_GET['phone'] ) && | |
| isset( $_GET['email'] ) && | |
| ( ( $id = filter_var( $_GET['id'], FILTER_SANITIZE_NUMBER_INT ) ) == '01' ) && | |
| ( ( $name = filter_var( $_GET['name'], FILTER_SANITIZE_STRING ) ) == 'robi' ) && | |
| ( ( $phone = filter_var( $_GET['phone'], FILTER_SANITIZE_STRING ) ) == '61' ) && | |
| ( ( $email = filter_var( $_GET['email'], FILTER_SANITIZE_EMAIL ) ) == 'afs' ) | |
| ) { | |
| echo "<h2>${id}</h2><br/>"; | |
| echo "<h2>${name}</h2><br/>"; | |
| echo "<h2>${phone}</h2><br/>"; | |
| echo "<h2>${email}</h2><br/>"; | |
| } else { | |
| echo '<h2>Hello World...! </h2><br/>'; | |
| echo '<a href="http://localhost:8080/?id=01&name=robi&phone=61&email=afs">link</a>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment