CatchTube + Lavalair

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CatchTube + Lavalair

    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.

    Code:
    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

    Code:
    <?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??
    Last edited by phoenix90; 17.12.10, 19:37.

    #2
    is your original tube script working? lol
    header already sent means there is 2 headers
    Quick Fix:
    PHP Code:
    if(action!="ctubedownload"){
    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\">";
    }
    and the readfile() error is because the varible $link isnt set

    Comment


      #3
      Hey. thanks i sorted the problem. just dumped the code into another clean php file. It just fetches the download link so the "user" doesn't actually go to the page>

      Comment


        #4
        Problem isn't two headers. This happens when stuff has been sent to the browser already.

        The echo functions at the beginning of the file eg after the first header statement are interfering with the header fuctuons in the video download section ie after the division of the script.

        Glad you solved it, but just wanted you to know the cause so next time you'd know the problem.

        Don't send headers after an echo statement.
        Perfection comes at a cost



        I accept liberty!

        Comment


          #5
          Originally posted by frostymarvelous View Post
          Problem isn't two headers. This happens when stuff has been sent to the browser already.

          The echo functions at the beginning of the file eg after the first header statement are interfering with the header fuctuons in the video download section ie after the division of the script.

          Glad you solved it, but just wanted you to know the cause so next time you'd know the problem.

          Don't send headers after an echo statement.
          so this is ok?
          header("Content-type: text/html; charset=ISO-8859-1");
          header("Content-Type: video/3gp");

          Comment


            #6
            Mate if you succeed in merging can you share that here? Thanx

            Comment


              #7
              share if u made it work..thanks..u can resolve that header inf error but i don't think so on readfile..get_video of youtube isn't working now i think..that's why readfile will be emptied..
              My Blog: http://jhommark.blogspot.com
              My Facebook: http://www.facebook.com/jhommark
              My Official Site: http://www.undergroundweb.tk
              My Community Site: http://undergroundwap.xtreemhost.com

              Comment


                #8
                Originally posted by kiLLeR-eyEd_14 View Post
                share if u made it work..thanks..u can resolve that header inf error but i don't think so on readfile..get_video of youtube isn't working now i think..that's why readfile will be emptied..
                Hey, it's working great but haven't finnished it yet completely yet, still some pages that needs conerting. will share if 100% finnished. the download function works perfectly, in all formatts, think only problem is direct streaming. will check it out..

                Comment


                  #9
                  @ something else: frostymarvelous is not making lessons. He explained the first user where is his problem, so the message is correct, dont try to overwrite him.
                  mysterio.al - programming is a functional art

                  Comment

                  Working...
                  X