<?php

$found = array();
$not_found = array();

$db =  new mysqli ( "SPBX-DB002.SpherePBX.com", "tuve", "5558585", "tuve" );

$query = "SELECT file,vid FROM videos";

$res = $db->query($query);

while ($qData = $res->fetch_row()) {
    if (file_exists("/red5/webapps/oflaDemo/streams/" . $qData[0]))
      $found[] = $qData[0];
    else {
      $query = "UPDATE videos SET status = -1 WHERE vid = " . $qData[1];
      $db->query($query);
      $not_found[] = $qData[0];
    }
}




print "STATS<br />\n";
print "Matched: " . count($found) . "<br />\n";
print "Not Matched: " . count($not_found) . "<br />\n";
print "END STATS<br />\n<br />\n";

foreach ($not_found as $file)
  print $file . "<br />\n";
?>
