Ocultar datos en un email
Publicado por Antonio (39 intervenciones) el 22/11/2016 07:49:59
Hola, buenas. Estoy trabajando con un código para enviar un correo electrónico a las personas que se inscriben a una página, este:
Lo que no he podido solucionar por más sencillo que parezca es cómo ocultar datos,osea, cuando el asistente es aceptado se envía:
Cursos Seleccionados
Cursos donde obtuvo cupo
Cursos donde NO obtuvo cupo
Pero en caso de que sea Rechazado ($verificacion==2 && $row[10]=0 Y $verificacion==2 && $row[10]=1) quiero que sólo muestre los Cursos Seleccionados, que no aparezcan donde obtuvo cupo y donde no porque realmente no mostraría nada en esos campos, he batallado para ocultar eso :v
Alguna sugerencia?, saludos !!
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
<?php
$id = $_POST["id"];
$verificacion = $_POST["verificacion"];
$fecha=$_POST["fecha"];
include 'conexion.php';
//**************************************** Verificacion 1 ok, 2 no aprobado, 0 espera de verificacion, 4 sin movimientos ****************************
//echo '<script language="javascript">alert("El valor de id es = '.$id.' ");</script>';
if($verificacion==3){
//$tabla=$mysqli->query("update asistente set verificacion=".$verificacion." where id=".$id);
$tabla=$mysqli->query("select c.idCurso, c.cupo, c.nombreCurso, c.claveCurso from curso c inner join curso_asistente ca
on c.idCurso=ca.idCurso where ca.idUsuario='".$id."'");
//checar cupo del grupo!!!
$cursosLlenos ="";
$cursosIns ="";
//agregar asistente al curso!!!
while($row = $tabla->fetch_array()) {
//Versiòn 2: Se calcula la capacidad
/*$inscritos = $mysqli->query("select verificacion from asistente inner join curso_asistente on curso_asistente.idUsuario = asistente.folio && curso_asistente.idCurso = '".$row[0]."' && asistente.verificacion=3");*/
$inscritos = $mysqli->query("select inscrito from curso_asistente where idCurso = '".$row[0]."' && inscrito=1 ");
$NumInscritos = mysqli_num_rows($inscritos);
$capacidad = $row[1] - $NumInscritos; //cupo menos inscritos
if($capacidad>0){
$inscribir = $mysqli->query("update curso_asistente set inscrito=1 where (idUsuario='".$id."' && idCurso='".$row[0]."')");
$cursosIns .= " + ".htmlentities($row[2])."<br>";
}else{
$cursosLlenos .= " - ".htmlentities($row[2])."<br>";
//$mysqli->query("delete from curso_asistente where nomCurso='".$row[0]."' and idUsuario='".$id."'");
/*$mysqli->query("update curso set claveCurso='".$row[3]."_X' where
claveCurso='".$row[3]."' and year ='".$fecha."'");*/
}
}
$tabla=$mysqli->query("update asistente set verificacion=".$verificacion." where folio='".$id."'");
$tabla=$mysqli->query("update factura set verificacion=1 where idUsuario='".$id."'");
}else if($verificacion==2){ //SI ES RECHAZADO
$tabla3=$mysqli->query("update asistente set verificacion=".$verificacion." where folio='".$id."'");
$tabla3=$mysqli->query("update factura set verificacion=0 where idUsuario='".$id."'");
}
//////////////////Se agrega nuevo codigo para enviar correo electronico de confirmacion
include "config.php";
require 'class.phpmailer.php';
$mail = new PHPMailer();
//Luego tenemos que iniciar la validación por SMTP:
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $host; // SMTP a utilizar. Por ej. smtp.elserver.com
$mail->Username = $Username; // Correo completo a utilizar
$mail->Password = $password; // Contraseña
$mail->Port = $port; // Puerto a utilizar
$mail->SMTPSecure = $smtpSecure;
//Con estas pocas líneas iniciamos una conexión con el SMTP. Lo que ahora deberíamos
//hacer, es configurar el mensaje a enviar, el //From, etc.
//$mail->From = "adan.sandez21@live.com.mx"; // Desde donde enviamos (Para mostrar)
$mail->FromName = $fromName;
//$tabla=$mysqli->query("Select * from asistente where id='".$id."'");
$tabla=$mysqli->query("Select * from asistente where folio='".$id."'");
//Estas dos líneas, cumplirían la función de encabezado (En mail() usado de esta forma: “From: Nombre <correo@dominio.com>”) de //correo.
while($row = $tabla->fetch_array()){
$mail->AddAddress($row[6]); // Esta es la dirección a donde enviamos //SE cambio row 7 por row 6.
// $mail->AddBCC("adrianvo@mat.uson.mx", $name = "Adrian Vazquez"); // Esta es la copia oculta que se envia.
$mail->IsHTML(true); // El correo se envía como HTML
$mail->Subject = "Inscripcion CONFIRMADA a la SNIDM - Universidad de Sonora"; // Este es el titulo del email.
if($verificacion==3){
$body = "<strong> Hola ".$row[0].",<br><br>
Este correo es para confirmar que tu inscripción a la Semana Nacional de Investigación y
Docencia en Matemáticas ha sido registrada EXITOSAMENTE. </strong><br><br>";
}else if($verificacion==2 && $row[10]=0 ){ //si NO es becado
$mail->Subject = "Inscripcion DENEGADA a la SNIDM - Universidad de Sonora"; // Este es el titulo del email.
$body = "<strong> Hola ".$row[0].",<br><br>
Este correo es para informar que tu inscripción a la Semana Nacional de Investigación y
Docencia en Matemáticas NO está COMPLETA. Lamentablemente no se pudo visualizar bien la imagen del comprobante de pago. Te invitamos a subir de nuevo dicha imagen. </strong><br><br>";
}else if($verificacion==2 && $row[10]=1){//si es becado
$mail->Subject = "Inscripcion DENEGADA a la SNIDM - Universidad de Sonora"; // Este es el titulo del email.
$body = "<strong> Hola ".$row[0].",<br><br>
Este correo es para informar que tu inscripción a la Semana Nacional de Investigación y
Docencia en Matemáticas NO está COMPLETA. Lamentablemente no se pudo visualizar bien la imagen de tu credencial. Te invitamos a subir de nuevo dicha imagen. </strong><br><br>";
}
$body .= "<span><strong>Cursos Seleccionados:</strong></span><br>";
$cursoSelec = $mysqli->query("select curso.nombreCurso from curso
inner join curso_asistente on curso.idCurso = curso_asistente.idCurso
where idUsuario='".$id."'"); //Solo los cursos seleccionados.
/*$tabla = $mysqli->query("select curso.nombreCurso from curso_asistente
inner join curso on curso.idCurso = curso_asistente.idCurso
where idUsuario='".$id."'");
*/
while($curso=$cursoSelec->fetch_array()){
$body .= " + ".htmlentities($curso[0])."<br>";
}
$body .= "<span><strong>Cursos donde obtuvo cupo:</strong></span><br>" .$cursosIns;
$body .="<span><strong>Cursos donde NO obtuvo cupo:</strong></span><br>" .$cursosLlenos;
/*if( $tabla->num_rows > 0 ){
$tabla = $mysqli->query("select curso.nombreCurso from curso
inner join curso_asistente on curso.idCurso = curso_asistente.idCurso
where idUsuario='".$id."' && inscrito=1"); //Aqui se consideran las materias en las que fue aceptado.
while($row=$tabla->fetch_array()){
$body .= " + ".htmlentities($row[0])."<br>";
}
//else{
//$body .="Desafortunadamente no pudo inscribirse en los siguientes cursos:<br>" .$cursosLlenos;
//}
}*/
$body .= "<strong>Datos De registro:</strong><br>";
$body .= "<strong>Folio</strong>:".$row[5]."<br>";
$body .= "<strong>Nombre:</strong>".$row[0]." ".$row[1]." ".$row[2]."<br>";
$body .= "<strong>Registrado como:</strong>".$row[4]."<br>";
$body .= "<strong>Institución</strong>:".$row[3]."<br><br>";
if($row[11]=='1'){
//$body.= "<strong>Datos de facturación:</strong><br>";
$fac=$mysqli->query("Select * from factura where idUsuario='".$id."'");
while($fact = $fac->fetch_array()){
$body .= "<strong>Datos De Facturación:</strong><br>";
$body .= "<strong>Nombre</strong>:".$fact[0]."<br>";
$body .= "<strong>Calle</strong>:".$fact[1]."<br>";
$body .= "<strong>Número</strong>:".$fact[2]."<br>";
$body .= "<strong>Colonia</strong>:".$fact[3]."<br>";
$body .= "<strong>C.P.</strong>:".$fact[4]."<br>";
$body .= "<strong>Municipio</strong>:".$fact[5]."<br>";
$body .= "<strong>Estado</strong>:".$fact[6]."<br>";
$body .= "<strong>País</strong>:".$fact[11]."<br>";
$body .= "<strong>R.F.C</strong>:".$fact[7]."<br>";
if($fact[10]==1) $fact[10]="Si";
else $fact[10]="No";
$body .= "<strong>Iva desglosado: </strong>".$fact[10]."<br>";//quedo un 1 o un 0. Deberia mandarse un si o un no.
$body .= "<strong>E-mail</strong>:".$fact[9]."<br><br>";
}
}
$body .= "<span><br><br>Para cualquier consulta o correción, favor de comunicarse a semana@mat.uson.mx</span><br><br>";
$body.="<br><br>";
//$body .= "<span>Para cualquier consulta o correción comunicarse a semana@mat.uson.mx</span><br><br>";
$body .= "<span style='color:rgb(68,68,68);font-size:22px;line-height:31px;' >Considera el medio ambiente antes de imprimir este correo</span><br><br><br><br>";
$body .="<b style='line-height:26px;font-weight:bold'>AVISO DE CONFIDENCIALIDAD Y ALCANCE LEGAL</b><br>";
$body .= "<hr color='#214984' style='line-height:31px'>";
$body .= "<p style='font-size:10px;'>Este correo electrónico es confidencial y para uso exclusivo de la(s) persona(s) a quien(es) se dirige. Si el lector de esta transmisión electrónica no es el destinatario, se le notifica que cualquier distribución o copia de la misma está estrictamente prohibida. Si ha recibido este correo por error le solicitamos notificar inmediatamente a la persona que lo envió y borrarlo definitivamente de su sistema.</p>
<p style='font-size:10px;'>Los correos electrónicos no son necesariamente seguros, por lo que el remitente no será responsable en ningún momento por los cambios que se sufra en su transferencia. Aún cuando se hayan revisado los archivos adjuntos existe siempre la posibilidad de que puedan contener virus o códigos maliciosos que dañen los sistemas del destinatario, por lo que tampoco se asume ninguna responsabilidad en caso de mutaciones en su transferencia y será siempre necesario revisarlos antes de abrirlos.</p>
<p style='font-size:10px;'>Las opiniones expresadas en este correo electrónico deberán ser confirmadas por escrito y firmadas por el remitente para tener validez legal, por lo que el correo electrónico no es el medio apropiado para emitir opiniones o recomendaciones formales.</p><br>";
$body .="<b style='line-height:26px;font-weight:bold'>CONFIDENTIALITY AND LEGAL NOTICE</b><br>";
$body .="<p style='font-size:10px;'>This electronic mail transmission is confidential, may be privileged and should be read or retained only by the intended recipient. If the reader of this transmission is not the intended recipient, you are hereby notified that any distribution or copying hereof is strictly prohibited. If you have received this transmission in error, please immediately notify the sender and erase it from your system.
</p>
<p style='font-size:10px;'>E-mail as are not necessarily secure, for which reason the sender shall not be responsible at any moment for any changes suffered during its transfer. Also, the files attached to this e-mail may contain viruses that could harm the systems of the recipient, even though it has been reviewed for viruses. The sender will not be responsible for any distortions that occur during its transfer, for which reason they must be reviewed before they are opened.</p>
<p style='font-size:10px;'>The opinions expressed in this email must be confirmed in writing and signed by the sender to have legal validity, so the email is not the appropriate mean to express opinions or formal recommendations.</p>";
$mail->Body = $body; // Mensaje a enviar
$exito = $mail->Send(); // Envía el correo.
//Enviar copia
//También podríamos agregar simples verificaciones para saber si se envió:
if($exito){
echo true;
echo "Se envio";
}else{
echo $mail->ErrorInfo;
}
}
$mysqli->close();
header("Location:panelC.php?view=A1&fecha=".$fecha."");
?>
Cursos Seleccionados
Cursos donde obtuvo cupo
Cursos donde NO obtuvo cupo
Pero en caso de que sea Rechazado ($verificacion==2 && $row[10]=0 Y $verificacion==2 && $row[10]=1) quiero que sólo muestre los Cursos Seleccionados, que no aparezcan donde obtuvo cupo y donde no porque realmente no mostraría nada en esos campos, he batallado para ocultar eso :v
Alguna sugerencia?, saludos !!
Valora esta pregunta


0