GetStreams(); parse_str($_SERVER['QUERY_STRING']); if (isset($admin)) $dcam->AuthenticateAdmin('Administrator'); if (isset($view)) { if (!array_key_exists($view, $streams)) unset($view); else { $title = strlen($streams[$view]['title']) ? $streams[$view]['title'] : $streams[$view]['name']; if (!isset($admin) && strlen($streams[$view]['passwd'])) $dcam->AuthenticateStream($title, $streams[$view]); } } else if (isset($feed)) { // $log = fopen("/tmp/feed.log", "a+"); // fprintf($log, "feed log start\n"); if (array_key_exists($feed, $streams) && array_key_exists('stream', $streams[$feed])) { $title = strlen($streams[$feed]['title']) ? $streams[$feed]['title'] : $streams[$feed]['name']; // fprintf($log, "feed title: %s\n", $title); if (!isset($admin) && strlen($streams[$feed]['passwd'])) { // fprintf($log, "do auth: %s\n", $streams[$feed]['passwd']); $dcam->AuthenticateStream($title, $streams[$feed]); } $stream = $streams[$feed]['stream']; // fprintf($log, "stream: %s\n", $streams[$feed]['stream']); $fh = fopen($stream, 'r'); if (!is_resource($fh)) $fh = fopen($dcam->GetErrorStreamUrl()); if (!is_resource($fh)) exit(1); // fprintf($log, "stream opened\n"); header("Pragma: no-cache"); header("Content-Type: application/x-shockwave-flash"); //fpassthru($fh); // $chunk = 1; while (!feof($fh) && connection_status() == 0) { // fprintf($log, "reading/writing chunk #%d\n", $chunk); print(fread($fh, 4096)); // fprintf($log, "flush chunk #%d\n", $chunk); flush(); // $chunk++; } // fprintf($log, "feed log end\n"); // fclose($log); exit(0); } } else if (isset($admin) && isset($stats)) { if (array_key_exists($stats, $streams) && array_key_exists('stream', $streams[$stats])) { $stream = preg_replace('/stream\.swf$/', 'stat.html', $streams[$stats]['stream']); $fh = fopen($stream, 'r'); if (!is_resource($fh)) exit(1); header("Pragma: no-cache"); header("Content-Type: text/html"); fpassthru($fh); exit(0); } } else if (isset($status)) { $id = 0; if (array_key_exists($status, $streams) && array_key_exists('server', $streams[$status])) $id = $streams[$status]['server']; if ($id == -1) $id = 0; header('Content-Type: application/xml'); echo "\n"; printf("\n\t%d\n\n", $id); exit(0); } if (!isset($view)) { $dcam->DisplayHeader('k0r3dump.net: Live Video'); $dcam->DisplayBanner('Live Video'); $dcam->DisplayStreams(isset($admin)); $dcam->DisplayFooter(); } else { $dcam->DisplayHeader(sprintf('k0r3dump.net: %s', $title), $view); $dcam->DisplayStreamView($view, $title, $streams[$view]); $dcam->DisplayStreams(isset($admin)); $dcam->DisplayFooter($view); } // vi: ts=4 ?>