-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
136 lines (57 loc) · 2.84 KB
/
index.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<html>
<head>
<title>
Libro de visitas
</title>
</head>
<body bgcolor="#220000">
<font color="#ffffff">
<?php
$this_file = "index.php";
if (!isset($PHP_SELF) || $PHP_SELF == "") { $PHP_SELF = $this_file; }
if (isset($_POST['texto_enviado'])) { $texto_enviado = $_POST['texto_enviado']; }
if (!isset($REMOTE_ADDR)) { $REMOTE_ADDR = $HTTP_SERVER_VARS['REMOTE_ADDR']; }
//si el archivo enviados.txt no existe, se crea:
if (!file_exists("enviados.txt")) {
//echo "EL ARCHIVO NOOOOOOO EXISTE Y SE CREARA";
$archivo = fopen("enviados.txt", "a+");
fwrite($archivo,"\n");
}
else {
$archivo = fopen("enviados.txt", "a+");
//echo "EL ARCHIVO EXISTE";
}
?>
<h1>Libro de visitas de pruebita tita</h1>
<h3>by A-Kristo</h3>
<br>
<br>
<h4>Escribe aqui tu texto que pasará a la posteridad:</h4>
<form action="<? echo $PHP_SELF ?>" method="POST">
<textarea cols="60" rows="5" name="texto_enviado"></textarea> <!-- wrap="virtual" */ -->
<input type="submit" value =" Enviar ">
</form>
<?php
if (isset($texto_enviado) && ($texto_enviado != null)) {
$fecha_pre = getdate();
$fecha = $fecha_pre['mday'] . "/" . $fecha_pre['mon'] . "/" . $fecha_pre['year'];
$hora = $fecha_pre['hours'] . ":" . $fecha_pre['minutes'];
// fwrite($archivo,"<p>Texto desde <b>" . $REMOTE_ADDR . "</b> (<b>" . gethostbyaddr($REMOTE_ADDR) . "</b>) el $fecha a las $hora >>><br><font color='#aaaaaa'>".nl2br(wordwrap($texto_enviado, 180, " <br>", 1))."</font><br>--- fin de texto enviado</p>\n");
fwrite($archivo,"\n\n<p>Texto desde <b>" . $REMOTE_ADDR . "</b> (<b>" . gethostbyaddr($REMOTE_ADDR) . "</b>) el $fecha a las $hora >>><br><font color=\"#aaaaaa\">\n".str_replace("\\\"", "\"", str_replace("<br />", "<br>", nl2br(wordwrap(htmlspecialchars($texto_enviado), 180, " <br>", 1))))."</font><br>\n--- fin de texto enviado</p>\n");
}
// else { echo "<h2><b>TEXTO ENVIADO NULO... ¡¡¡ESCRIBE ALGO!!!</b></h2>"; }
?>
<br>
<br>
<br>
<br>
<br>
<p><b><u>Comentarios enviados</u>:</b></p>
<br>
<?php
readfile("enviados.txt");
fclose($archivo);
?>
</font>
</body>
</html>