-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_post.php
48 lines (46 loc) · 1.03 KB
/
get_post.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
if(isset($_GET['name'])) {
# We use htmlentities function to prevent XSS attacks
$name = htmlentities($_GET['name']);
// echo $name;
}
/*
if(isset($_POST['name'])) {
# We use htmlentities function to prevent XSS attacks
$name = htmlentities($_POST['name']);
print_r($_POST);
echo nl2br("\n$name");
}
if(isset($_REQUEST['name'])) {
# We use htmlentities function to prevent XSS attacks
$name = htmlentities($_REQUEST['name']);
// print_r($_REQUEST);
echo $name;
}
echo $_SERVER['QUERY_STRING'];
*/
?>
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<form action="get_post.php" method="GET">
<div>
<label>Name</label><br>
<input type="text" name="name">
</div>
<div>
<label>Email</label><br>
<input type="text" name="email">
</div>
<input type="submit" value="Submit">
</form>
<ul>
<li><a href="get_post.php?name=Brad">Brad</a></li>
<li><a href="get_post.php?name=Steve">Steve</a></li>
</ul>
<h1><?php echo "{$name}'s Profile"; ?></h1>
</body>
</html>