-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.cgi
More file actions
executable file
·41 lines (37 loc) · 1.08 KB
/
Copy pathpost.cgi
File metadata and controls
executable file
·41 lines (37 loc) · 1.08 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
#!/usr/bin/python
import cgi, cgitb, os
software = os.environ.get("SERVER_SOFTWARE", '')
if os.environ.get("REQUEST_METHOD") == 'POST':
form = cgi.FieldStorage()
nombre = cgi.escape(form.getvalue('nombre'))
html = """
<html>
<head>
<title>Metodo POST</title>
</head>
<body style="color:yellow;background-color:blue;margin-top:50px;">
<center>
<h1>Hola %s</h1>
<img src="https://melbournechapter.net/images/kitten-transparent-white-5.png" width="800px;"/>
</center>
<p style="color:white;">Servidor %s</p>
</body>
</html>
"""
print html % (nombre, software)
elif os.environ.get("REQUEST_METHOD") == 'GET':
print "Content-Type: text/html\n"
html = """<html>
<head>
<title>Metodo GET</title>
</head>
<body style="color:yellow;background-color:blue;margin-top:50px;">
<form method="POST" action="">
Ingresa tu nombre: <input name="nombre" type="text" />
<input type="submit" value="Enviar"/>
</form>
<p style="color:white;">Servidor %s</p>
</body>
</html>
"""
print html % (software)