$avatarusu = avatar($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $dato[1]); $nombreusers = nombreusus($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $dato[1]); if ($dato[5] == $_SESSION["iduser"]) { $usus = 2; } else { $usus = 1; } if ($dato[3] == 6) { $userr = $dato[5]; } else { $userr = $dato[1]; } $idalbum = vercoment($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $dato[1], $dato[6]); $verfoto = verfotocoment($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $idalbum[1]); $confirmarusuado = usuconfir($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $dato[1]); $fechaagregado = fechaagregado($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $dato[1]); if ($confirmarusuado == 0 && $dato[5] == $_SESSION["iduser"] && ($dato[3] == 1 || $dato[3] == 6) || $confirmarusuado == 1 && $fechaagregado <= $dato[7] && $dato[5] == $_SESSION["iduser"]) { $h .= '<a class="list-group-item" id="' . $userr . ',' . $dato[3] . ',' . $usus . "," . $dato[4] . ',' . $idalbum[0] . '" role="menuitem"> <div class="media"> <div class="media-left padding-right-10"> <span class="avatar avatar-sm avatar-online" style="height:50px;width:50px"> <img src="' . $avatarusu . '" style="height:50px;width:50px" /> </span> </div> <div class="media-body"> <h6 class="media-heading">' . $nombreusers . '</h6> <div class="media-meta"> <time datetime="2015-06-17T20:22:05+08:00">' . $dato[2] . '</time> </div> <div class="media-detail">' . $dato[0] . '</div> </div>';
} else { $usus = 1; } if ($row["tipoNotif"] == 5 || $row["tipoNotif"] == 6) { $userr = $row["iduserAct"]; if ($row["tipoNotif"] == 6) { $idalbum = vercoment($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $row["iduserMov"], $row["idcomentario"]); $avatarusus = verfotocoment($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $idalbum[1]); } } else { $userr = $row["iduserMov"]; $nombreuserse = ""; $avatarusus = ""; } $confirmarusuado = usuconfir($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $row["iduserMov"]); $fechaagregado = fechaagregado($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $row["iduserMov"]); if ($confirmarusuado == 0 && $row["iduserAct"] == $_SESSION["iduser"] && ($row["tipoNotif"] == 1 || $row["tipoNotif"] == 6) || $confirmarusuado == 1 && $fechaagregado <= $row["fechaHrNotif"] && $row["iduserAct"] == $_SESSION["iduser"]) { ?> <a class="list-group-item" id="<?php echo $userr . "," . $row["tipoNotif"] . "," . $usus . "," . $row["idnotif"] . "," . $idalbum[0]; ?> " role="menuitem"> <div class="media"> <div class="media-left padding-right-10"> <span class="avatar avatar-sm avatar-online"> <img src="<?php echo $avatarusu; ?> " style="height:50px;width:50px" /> </span> </div>
function notificaciones($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL) { $link = mysql_connect($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL); mysql_select_db($strDBMYSQL, $link); if (mysql_errno() > 0) { $strResultOp = "No fue posible validar el usuario."; $strInfoTec = "No fue posible localizar el host[" . mysql_errno() . "-" . mysql_error() . "]"; $strModulo = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . basename($_SERVER['PHP_SELF']); $strParameters = "host:" . $strHostMYSQL . "~-user:"******"~PWD:" . $strPWDMYSQL . "bd:" . $strDBMYSQL; } else { /*$str ="select count(idnotif) as total from notificaciones n, tiponotificacion t where n.tipoNotif=t.idtipoNotif and ((iduserMov!=".$_SESSION["iduser"]." and iduserAct=".$_SESSION["iduser"].") or (iduserMov!=".$_SESSION["iduser"]." and iduserAct!=".$_SESSION["iduser"].")) and estatusNotif=0 group by idnotif order by fechaHrNotif desc"; $Resu = mysql_query($str);*/ $strS = "select tipoNotif, descripcion, iduserMov, iduserAct, fechaHrNotif, idnotif, idcomentario from notificaciones n, tiponotificacion t where n.tipoNotif=t.idtipoNotif\n\t\t\t\tand ((iduserMov!=" . $_SESSION["iduser"] . " and iduserAct=" . $_SESSION["iduser"] . ") or (iduserMov!=" . $_SESSION["iduser"] . " and iduserAct!=" . $_SESSION["iduser"] . ")) and estatusNotif=0 group by idnotif order by fechaHrNotif desc"; $Res = mysql_query($strS); if (mysql_errno() > 0) { $strResultOp = "No fue posible validar el usuario."; $strInfoTec = "No fue posible ejecutar la consulta[" . mysql_errno() . "-" . mysql_error() . "]"; $strModulo = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/" . basename($_SERVER['PHP_SELF']); $strParameters = $str; $notif = ""; } else { $total = 0; while ($row = mysql_fetch_array($Res)) { $hoy = date("Y-m-d H:i:s"); $datetime1 = new DateTime($row["fechaHrNotif"]); $datetime2 = new DateTime($hoy); $interval = date_diff($datetime1, $datetime2); $dia = $interval->format('%a'); $horas = $interval->format('%H:%I'); $hrs = explode(":", $horas); $hr = $hrs[0]; $min = $hrs[1]; if ($dia < 1) { if ($hr > 1) { $time = $hr . " Horas"; } else { if ($hr == 1) { $time = $hr . " Hora"; } else { if ($min == "00") { $time = "Ahora"; } else { $time = $min . " min"; } } } } else { if ($dia == 1) { $time = $dia . " Dia"; } else { $time = $dia . " Dias"; } } $desc .= $row["descripcion"] . "," . $row["iduserMov"] . "," . $time . "," . $row["tipoNotif"] . "," . $row["idnotif"] . "," . $row["iduserAct"] . "," . $row["idcomentario"] . "," . $row["fechaHrNotif"] . "&"; $confirmarusuado = usuconfir($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $row["iduserMov"]); $fechaagregado = fechaagregado($strHostMYSQL, $strUserMYSQL, $strPWDMYSQL, $strDBMYSQL, $row["iduserMov"]); if ($confirmarusuado == 0 && ($row["tipoNotif"] == 1 || $row["tipoNotif"] == 6) || $confirmarusuado == 1 && $fechaagregado < $row["fechaHrNotif"]) { $total++; } } $notif = $total . ";" . $desc; } } return $notif; }