Tema: ejecutar php
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/11/2020, 07:28
xoceunder
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
Respuesta: ejecutar php

estoy usando esto en cron.php

con esto require_once("../cron.php"); y include("../cron.php");

Código PHP:
Ver original
  1. $mysqli = new mysqli($DB_HOST,$DB_USER,$DB_PASS,$DB_NAME);
  2. $fecha = time();
  3. $result = $mysqli->query("SELECT * FROM epg") or die($mysqli->error);
  4. while ($rEPG = $result->fetch_array(MYSQLI_ASSOC)) {
  5.  
  6.   $fecha_update = $rEPG['last_updated'];
  7.   $fecha_limit  = strtotime("- ".$rEPG['days_keep']." days");
  8.   if($fecha_update < $fecha_limit) {
  9.     // si se ha superado la fecha de entrega
  10.     echo "Ya no tiene garantia";
  11.     $mysqli->query("DELETE FROM epg_data WHERE epg_id='".$rEPG['id']."'") or die($mysqli->error);
  12.     $mysqli->query("UPDATE epg SET last_updated='$fecha' WHERE id='".$rEPG['id']."'") or die($mysqli->error);
  13.     $xml = LoadEpg($rEPG['epg_file']);
  14.     foreach ($xml->programme as $item) {
  15.             $channel_id = (string) $item->attributes()->channel;
  16.             $start = strtotime(strval($item->attributes()->start));
  17.             $stop = strtotime(strval($item->attributes()->stop));
  18.             $title = base64_encode($item->title);
  19.             $description = base64_encode($item->desc);
  20.             $channel_id = addslashes($channel_id);
  21.             $date_start = date('Y-m-d H:i:s', $start);
  22.             $date_stop = date('Y-m-d H:i:s', $stop);
  23.             $list[] = '(\'' . $rEPG['id'] . '\', \'' . $channel_id . '\', \'' . $date_start . '\', \'' . $date_stop . '\', \'' . $title . '\', \'' . $description . '\')';
  24.     }
  25.     $values =  implode(',',$list);
  26.     $mysqli->query("INSERT INTO epg_data (epg_id, channel_id, start, end, title, description) VALUES $values") or die($mysqli->error);
  27.   }
  28.    
  29. }
  30.  
  31. $mysqli->close();

y lo quiere ejecutarlo