$query = "SELECT id_country FROM record_country WHERE id_historial_pais = " . $ultimoRegistro . " AND total_user is not null AND total_female is not null AND total_male is not null;"; $que2 = mysql_query($query, $conexion) or die(mysql_error()); if ($fila2 = mysql_fetch_assoc($que2)) { $ban = 1; } else { $sql = "DELETE FROM record_country WHERE id_historial_pais = " . $ultimoRegistro . ";"; $res2 = mysql_query($sql, $conexion) or die(mysql_error()); } } } /***************************************** FIN GET TOTALES ********************************************************/ /********************************** Verificación de finalización *************************************************/ //Cantidad total de países $query = "SELECT COUNT(*) cantidad FROM country;"; $que = mysql_query($query, $conexion) or die(mysql_error()); $cantidadPais = 0; if ($fila = mysql_fetch_assoc($que)) { $cantidadPais = $fila['cantidad']; } //Cantidad de filas insertadas $query = "SELECT COUNT(*) cantidad FROM `record_country` WHERE date = DATE_FORMAT(now(), '%Y-%m-%d');"; $que = mysql_query($query, $conexion) or die(mysql_error()); if ($fila = mysql_fetch_assoc($que)) { if ($fila['cantidad'] == $cantidadPais) { informarExito(); } else { informarError(); } } /******************************* FIN - Verificación de finalización **********************************************/ mysql_close($conexion);
$qry = $qry . " '" . Date("Y-m-d") . "')"; mysql_query($qry); $ban_success = true; $cont++; } } } else { $informe_errores .= "\n \t\t\t\tERROR: " . $fetch_cntr["owloo_screen_name"] . " - " . $cont; //echo '<br/>ERROR: '.$fetch_cntr["owloo_screen_name"].' - '.$cont; $ban_success = true; $cont++; } } } $informe_errores .= "\n \tFIN! " . date("H:i:s"); //echo '<br/>FIN!'.date("H:i:s"); //echo $informe_errores; function informarExito($text) { //Enviar aviso por email $para = '*****@*****.**'; $titulo = 'Owloo - Twitter seguidores'; $mensaje = 'El script de captura de seguidores en el twitter se ha ejecutado exitosamente!!!<br><br>' . $text; $cabeceras = 'From: dev@owloo.com' . "\r\n"; mail($para, $titulo, $mensaje, $cabeceras); } informarExito($informe_errores); /*$f = fopen('xxx.txt', 'w+'); fwrite($f, $informe_errores); fclose($f);*/ error_log(' Twitter cronjob (f): ' . date('d m Y H:i:s'));