PHP - Actualizar formulario a php 7,2

 
Vista:

Actualizar formulario a php 7,2

Publicado por Patricia (3 intervenciones) el 04/04/2018 07:02:57
Hola! Hice una página web hace tiempo, y al actualizar el hosting me piden que actualice el código a 7.2, la verdad es que lo hice todo con tutoriales y no sé programar con php, entiendo lo que dice el código, pero no sé crear cosas nuevas. He estado intentando mirar tutoriales pero no consigo aclararme con qué cosas tengo que actualizar exactamente para que el código siga funcionando con la actualización. Os dejo aquí el código y estaría super agradecida si alguien me pudiese orientar! Gracias!

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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<?php
 
if (empty($_POST['nombre'])) {
  exit ("El campo nombre esta vacio");
}
 
 
 
/* AQUI INICIALIZAS LAS VARIABLES A VACIO*/
 
$empresa = $_POST['empresa'];
 
$direccion = $_POST['direccion'];
 
$localidad = $_POST['localidad'];
 
$telefono = $_POST['telefono'];
 
$movil = $_POST['movil'];
 
$email = $_POST['email'];
 
$nombre = $_POST['nombre'];
 
$observaciones = $_POST['observaciones'];
 
/*AQUI LE ASIGNAS EL CONTENIDO DEL POST A LA VARIABLE */
 
 if (empty($_POST['empresa'])) {
    $empresa = "-";
}
else
$empresa = $_POST['empresa'];
 
 if (empty($_POST['email'])) {
 
    $email = "-";
}
else
$email = $_POST['email'];
 
 if (empty($_POST['nombre'])) {
 
    $nombre = "-";
}
else
$nombre = $_POST['nombre'];
 
 
 if (empty($_POST['localidad'])) {
 
    $localidad = "-";
}
else
$localidad = $_POST['localidad'];
 
 
 if (empty($_POST['direccion'])) {
 
    $direccion = "-";
}
else
$direccion = $_POST['direccion'];
 
 if (empty($_POST['telefono'])) {
 
    $telefono = "-";
}
else
$telefono = $_POST['telefono'];
 
 if (empty($_POST['movil'])) {
 
    $movil = "-";
}
else
$movil = $_POST['movil'];
 
 if (empty($_POST['observaciones'])) {
 
    $observaciones = "-";
}
else
$observaciones = $_POST['observaciones'];
 
$captcha = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=CLAVE='.$_POST['g-recaptcha-response'].'&remoteip='.$_SERVER['REMOTE_ADDR']),TRUE);
    if($captcha['success']=== FALSE){
        error;
		//Nuestro mensaje de error 
    } else {
 
{
$asunto = $_POST[asunto];
$fecha = date("d-M-y H:i");
$remitente = $_POST[email];
$content='
<html>
<head>
<title> TITULO DE LA WEB </title>
</head>
<body link="/* CCCCCC" vlink="/* FFFFFF" alink="/* CC0033"><font face="tahoma"><font size="+1">
<table width="250" border="0" align="left"> 
 
  
    
      <td style="font-size:13pt">Empresa:</td>
  </tr>
  <tr>
    <td style="font-size:13pt">Dirección:</td>
  </tr>
  <tr>
    <td style="font-size:13pt">Localidad / CP:</td>
  </tr>

  <tr> 
    <td style="font-size:13pt">Tel. fijo:</td>
  </tr>
  
    <tr>
    
    <td style="font-size:13pt">Movil:</td>
  </tr>
  
  <tr>
    <td style="font-size:13pt">E-mail:</td>
  </tr>
  <tr>
    
    <td style="font-size:13pt">Persona de contacto:</td>
  </tr>
  <tr>

    <td style="font-size:13pt">Observaciones</td>
  </tr>
</table>

<table width="250" border="0" align="left">
 
  
    
    <td align="left" style="font-size:13pt">'.$empresa.'</td>
  </tr>
  <tr>
    <td align="left" style="font-size:13pt">'.$direccion.'</td>
  </tr>
  <tr>
    <td align="left" style="font-size:13pt">'.$localidad.'</td>
	  </tr>
  <tr>
    
    <td align="left" style="font-size:13pt">'.$telefono.'</td>
  </tr>
    <tr>
    
    <td align="left" style="font-size:13pt">'.$movil. '</td>
  </tr>
  
  <tr>
    
    <td align="left" style="font-size:13pt">'.$email.'</td>
  </tr>
  
  <tr>
   
    <td align="left" style="font-size:13pt">'.$nombre.'</td>
  </tr>
  
  <tr>

    <td align="left" style="font-size:13pt">'.$observaciones.'</td>
  </tr>
</table>
</body>
</html>
';
ini_set(sendmail_from,'email-al-que-quiero-que-se-mande@email.com,');
 
   //Aca envias el email
    }
 
 
 
mail('email-al-que-quiero-que-se-mande@email.com', 'ASUNTO', $content,"MIME-Version: 1.0\nContent-type: text/html; charset=UTF-8\nFrom: $_POST[nombre] < $_POST[email] >");
 
$confirmacion='
<html>
<head>
<title>TITULO</title>
</head>
<body link="/* 666666" vlink="/* 999999" alink="/* CCCCCC">
<table width="495" height="320" align="center" >
  <tr>
    <td width="494" height="320" align="center" valign="top"> 
      <table width="495" height="69" border="0">
        <tr>
          <td width="495" height="65"><div align="center"><img src="enlace web cabecera" width="253" height="88" align="absmiddle"></div></td>
        </tr>
      </table> 
      <table width="550" height="228" border="0">
        <tr><br />
          <td width="48" height="201">&nbsp;</td>
          <td width="432" height="201"><p><font color="/* 0099CC" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>'.$_POST[nombre].'</b>,
              gracias por su confianza.</font><br>
              <br> 
              <font color="/* 999999" size="1" face="Verdana, Arial, Helvetica, sans-serif">Su 
              correo ha sido recibido y ser&aacute; respondido con la mayor brevedad 
              posible.<br>
              <br>
              Este correo confirma su env&iacute;o efectuado desde nuestro formulario 
              de contacto. </font><br>
			  <br />
           
              
            <p align="right"><br>              
              <font color="/* 999999" size="1" face="Verdana, Arial, Helvetica, sans-serif">Este 
                formulario ha sido enviado el '.$fecha.'.<br>
              </font></p></td>
        </tr>
        <tr>
          <td height="27" colspan="2"><table width="90%" align="center">
            <tr>
              <td width="50%"><font color="/* 999999" size="1" face="Verdana, Arial, Helvetica, sans-serif">IITULO<br>
              Calle Daganzo, 19. Madrid.</font></td>
              <td width="50%"><div align="right"><font color="/* #000" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Tel: 91 413 03 15</strong><br>
                </font></div></td>
            </tr>
          </table></td>
        </tr>
      </table> 
    </td>
  </tr>
</table>
</body>
</html>';
ini_set(sendmail_from,'email-de-contacto@email.com');
 
 
 
 
mail($remitente, 'Hemos recibido su correo', $confirmacion,"MIME-Version: 1.0\nContent-type: text/html; charset=UTF-8\nFrom: WEB >");
 
$userpart='
<html>
<head>
<title>Gracias por su solicitud</title>



<META HTTP-EQUIV="REFRESH" CONTENT="4;URL=pagina a la que redirige">
<style type="text/css">
<!--
.Estilo1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: small;
}
.Estilo2 {font-family: Arial, Helvetica, sans-serif; font-size: small; font-weight: bold; }
-->
</style>

</head>
<body>
 <p align="center" class="Estilo2">&nbsp;</p>
 <p align="center" class="Estilo2">'.$_POST[nombre].', gracias por tu solicitud.</p>
 <p align="center" class="Estilo1">Nos pondremos en contacto contigo en la mayor brevedad posible.</p>
 <p align="center" class="Estilo1">En 5 segundos ser&aacute; redirigido a la p&aacute;gina anterior.</p>
</body>
</html>';
}
 
echo $userpart;
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Actualizar formulario a php 7,2

Publicado por xve (6935 intervenciones) el 04/04/2018 11:32:21
Hola Patricia, a simple vista, no te se decir... yo diría que te tiene que seguir funcionando... lo has probado haber si te da algún error?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Actualizar formulario a php 7,2

Publicado por Patricia (3 intervenciones) el 05/04/2018 09:26:20
No me da ningun error concreto. Simplemente al darle a enviar entra como en el php (sale en la barra de url que estás en él) pero que se queda la página en blanco y no pasa nada, y no llega ningún correo ni el de los datos ni el de confirmación a cliente =S
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Actualizar formulario a php 7,2

Publicado por Patricia (3 intervenciones) el 05/04/2018 10:36:44
Ya está, era esta parte la que daba error, la he borrado y si funciona. gracias.

1
2
3
4
5
$captcha = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=CLAVE='.$_POST['g-recaptcha-response'].'&remoteip='.$_SERVER['REMOTE_ADDR']),TRUE);
    if($captcha['success']=== FALSE){
        error;
		//Nuestro mensaje de error 
    } else {
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar