php5 header ERROR!

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

    php5 header ERROR!

    IM USE THIS SCRIPT FOR DOWNLOAD
    <?php
    include("config.php");
    include("core.php");
    connectdb();

    $id = $_GET['id'];
    $action = $_GET["action"];
    $sid = $_GET["sid"];

    $downloads = mysql_fetch_array(mysql_query("SELECT downloads FROM ibwf_vault WHERE id='".$id."'"));
    $incresedownload = $downloads[0] + 1;
    mysql_query("UPDATE ibwf_vault SET downloads='".$incresedownload."' WHERE id='".$id."'");
    $link = mysql_fetch_array(mysql_query("SELECT itemurl FROM ibwf_vault WHERE id='".$id."'"));
    header("Location:$link[0]");

    ?>


    more when access the page to download the file shows the following error
    Warning: Cannot modify header information -headers already sent by (output started at /home/....

    how to solve this problem? What could I pass the correct script I use php5 on pages

    #2
    in config php check the start <?php change it to <? do this also on corephp i found thats why i couldnt get my page to vallidate i think the <?php is sending the headers









    Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer..
    Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free

    Comment


      #3
      ive seen this problem before, give us the whole warning message. It usually happens when your page header("Location:....."); is set above all your code. you r then running your script executing code below this and outputing to a location. This being said you are sending header info once and then trying to send it again.

      im not sure if this would work but try and put your location near the code you want to execute. also clean up on white space.
      sigpic

      |~~Dont forget to say thanx~~|

      Comment


        #4
        Code:
        header("Location:$link[0]");
        should be place above youre header or after <?php

        Code:
        <?php
        header("Location:$link[0]");
        ?>
        <-- HEADER -->
        <?xml version="1.0"?>
        <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head><title>Some Title Here</title>
        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
        <style type="text/css">
        #some css here
        </style></head><body>

        Comment


          #5
          To remove this error follow this
          <?php
          ob_start();
          ///php code and html code

          ob_end_flush();
          ?>

          Comment


            #6
            Originally posted by doriann View Post
            IM USE THIS SCRIPT FOR DOWNLOAD
            <?php
            include("config.php");
            include("core.php");
            connectdb();

            $id = $_GET['id'];
            $action = $_GET["action"];
            $sid = $_GET["sid"];

            $downloads = mysql_fetch_array(mysql_query("SELECT downloads FROM ibwf_vault WHERE id='".$id."'"));
            $incresedownload = $downloads[0] + 1;
            mysql_query("UPDATE ibwf_vault SET downloads='".$incresedownload."' WHERE id='".$id."'");
            $link = mysql_fetch_array(mysql_query("SELECT itemurl FROM ibwf_vault WHERE id='".$id."'"));
            header("Location:$link[0]");

            ?>


            more when access the page to download the file shows the following error
            Warning: Cannot modify header information -headers already sent by (output started at /home/....

            how to solve this problem? What could I pass the correct script I use php5 on pages
            try this

            PHP Code:

            <?
            $SERVERmysql = "localhost";
            $DB = "";
            $DB_USER = "";
            $DB_PASS = "";
            $link = mysql_connect($SERVERmysql, $DB_USER, $DB_PASS) or die("Could not connect");
            $db_id = mysql_select_db($DB, $link) or die("Could not db");

            $id = $_GET['id'];

            $d = mysql_fetch_assoc(mysql_query("SELECT itemurl FROM `ibwf_vault` WHERE `id` = '".$id."'"));

            if(file_exists($d['itemurl']))
            {
                $load_write = mysql_query("UPDATE ibwf_vault SET downloads=`downloads` + 1  WHERE id='".$id."'");
                $dpath = trim($d['itemurl']);
                header('Location: '.$dpath.'');
            }

            ?>

            Comment


              #7
              tankyou rukiya

              this your code func ok tankyou

              Comment


                #8
                i also had the same problem but....

                i wanted 2 add some our letters 2 my script (šđčćž) but without entering it as HTML characters.... so 2 do tht i had 2 save tht *.php file as UTF-8 encoding... soon as i did tht i had error Cannot modify header information -headers already sent by bla bla bla bla

                sooooo i gave up LoL

                i just enter those letters as HTML characters.... f#$k it was a job 2 do but i WOULD still want 2 know how 2 avoid tht bcuz i use hangman script without šđčćž letters and its sumkind confusing 2 play without those letters...
                sigpiceeeeerrr....

                Comment


                  #9
                  Hmm post it coding here

                  Comment

                  Working...
                  X