Hey guys,
Im trying to convert the catchtube so it merges with lavalair script. Im doing great sofar, but struggling with the "download" function.
I get the following error when i click on download.
Warning: Cannot modify header information - headers already sent by (output started at /home/cyberoxx/public_html/wap/ctubedownload.php:9) in /home/domain/public_html/wap/ctubedownload.php on line 146
Warning: Cannot modify header information - headers already sent by (output started at /home/cyberoxx/public_html/wap/ctubedownload.php:9) in /home/cyberoxx/public_html/wap/ctubedownload.php on line 147
Warning: readfile() [function.readfile]: Filename cannot be empty in /home/cyberoxx/public_html/wap/ctubedownload.php on line 158
the file contents is
<?php
include("config.php");
include("core.php");
include("xhtmlfunctions.php");
include("themecs.php");
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>
<?php
$bcon = connectdb();
if (!$bcon)
{
echo xhtmlheadnotheme("$sitetitle (DB Error!)");
echo "<p align=\"center\">";
echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
echo "ERROR! cannot connect to database<br/><br/>";
echo "This error happens usually when backing up the database, please be patient, The site will be up any minute<br/><br/>";
echo "<b>THANK YOU VERY MUCH</b><br/><br/>";
echo "</p>";
echo xhtmlfoot($sid);
exit();
}
$brws = explode("/",$_SERVER['HTTP_USER_AGENT']);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$uid = getuid_sid($sid);
$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");
include("flag.php");
$popuppm = mysql_fetch_array(mysql_query("SELECT popuppm FROM ibwf_users WHERE id='".$uid."'"));
cleardata();
if(isipbanned($uip,$ubr))
{
if(!isshield(getuid_sid($sid)))
{
echo xhtmlheadnotheme("$sitetitle (IP BLOCK!)");
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
echo "This IP address is blocked<br/>";
echo "<br/>";
echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_metpenaltiespl WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
$remain = $banto[0] - time() ;
$rmsg = gettimemsg($remain);
echo "Time to unblock the IP: $rmsg<br/><br/>";
echo "</p>";
echo xhtmlfoot($sid);
exit();
}
}
if(($action != "") && ($action!="terms"))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo xhtmlheadnotheme("$sitetitle (Not Logged In!)");
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "</p>";
echo "<p align=\"center\">";
echo "<form action=\"login.php\" method=\"get\">";
echo "Username:<input name=\"loguid\" size=\"8\" maxlength=\"30\"/><br/>";
echo "Password:<input name=\"logpwd\" size=\"8\" maxlength=\"30\" type=\"password\" /><br/>";
echo "<input type=\"submit\" value=\"Login\"/>";
echo "</form>";
echo "</p>";
echo xhtmlfoot($sid);
exit();
}
}
if(isbanned($uid))
{
echo xhtmlheadnotheme("$sitetitle (BANNED!)");
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
echo "You are <b>Banned</b><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_metpenaltiespl WHERE uid='".$uid."' AND penalty='1'"));
$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
$remain = $banto[0]- time() ;
$rmsg = gettimemsg($remain);
echo "Time to finish your penalty: $rmsg<br/><br/>";
echo "Ban Reason: $banres[0]";
echo "</p>";
echo xhtmlfoot($sid);
exit();
}
////////////////////////////// Download stuff
if ($action=="ctubedownload")
{
// File: phpyoutube.php
// Version: 2.2
// Date: 06/04/2009
// Web: http://blog.unijimpe.net
$videoItem = trim($_GET['item']);
$videoType = "";
$videoPath = "http://www.youtube.com/get_video";
if ($_GET['type'] != "0") {
$videoType = "&fmt=".$_GET['type'];
}
if ($videoItem != "") {
$videoTokn = getYoutubeToken($videoItem);
$videoURL = $videoPath."?video_id=".$videoItem."&t=".$videoTokn.$videoType."&asv=";
$headers = fetch_headers($videoURL);
for ($i=0; $i<count($headers); $i++) {
if (strstr($headers[$i], "ocation:")) {
$str1 = explode("ocation:", $headers[$i]);
$link = trim($str1[1]);
break;
}
}
$vn=rand(0,9999);
if($_GET['type']==17){
header("Content-Type: video/3gp");
header("Content-Disposition: attachment; filename=\"$vn-(CyberScene.co.za).3gp\"");
}
else if($_GET['type']==18){
header("Content-Type: video/mp4");
header("Content-Disposition: attachment; filename=\"$vn-(CyberScene.co.za).mp4\"");
}
else{
header("Content-Type: video/x-flv");
header("Content-Disposition: attachment; filename=\"$vn-(CyberScene.co.za).flv\"");
}
readfile($link);
flush();
echo xhtmlfoot($sid);
}
}
/////////////End of download stuff
?>
Can someone please help me??