-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecho.php
More file actions
83 lines (77 loc) · 2.14 KB
/
Copy pathecho.php
File metadata and controls
83 lines (77 loc) · 2.14 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<!-- Sample PHP program that echoes all parameters sent by a form to the server.
Alan Riggins
CS545, Fall 2012
-->
<title>Processing Form Data</title>
<style type="text/css">
body { background-color: #DDE; }
h1 { text-align: center; }
table { border: solid 2px black; padding: 10px; margin-left: auto; margin-right: auto; }
td { border: solid 1px black; padding: 5px; background-color: white; }
th { background-color: #CCCCCC; padding: 10px; border: solid 2px black; }
</style>
</head>
<body>
<h1>Parameters Received by the Server</h1>
<table>
<tr>
<th>Field Name</th>
<th>Value(s)</th>
</tr>
<?php
if (!empty($_POST)) {
foreach ($_POST as $key => $value) {
if (get_magic_quotes_gpc())
$value=stripslashes($value);
if (is_array($value)) {
print "<tr><td><code>$key</code></td><td>";
//foreach ($entry as $value) {
for($i=0; $i < count($value); $i++) {
print "<i>$value[$i]</i><br />";
}
print "</td></tr>";
}
else {
print "<tr><td><code>$key</code></td><td><i>$value</i></td></tr>\n";
}
} // end foreach
} // end else
else if(!empty($_GET)) {
foreach ($_GET as $key => $value) {
if (get_magic_quotes_gpc())
$value=stripslashes($value);
if (is_array($value)) {
print "<tr><td><code>$key</code></td><td>";
//foreach ($entry as $value) {
for($i=0; $i < count($value); $i++) {
print "<i>$value[$i]</i><br />";
}
print "</td></tr>";
}
else {
print "<tr><td><code>$key</code></td><td><i>$value</i></td></tr>\n";
}
} // end foreach
} // end else
else {
print "No data was submitted.";
}
?>
</table>
<?php
print '<p />';
print "The information on this request is: <br />";
foreach($_SERVER as $key => $value) {
print "$key $value";
print "<br />\n";
}
?>
</body>
</html>