Results 1 to 5 of 5

Thread: php cookie error received - included file paswords.php

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default php cookie error received - included file paswords.php

    Code:
    setcookie("countNumVisitor", $countNumVisitor, time()+60*60*24*365*3,"/");
    or
    Code:
    if (isset($_COOKIE['countNumVisitor'])) {  
    		$countNumVisitor=$_COOKIE['countNumVisitor'];
    These statements(all ?) must appear prior any output ? and second one ?

    well I get following error

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/p/o/l/polisch123/html/dbinfo.php:22) in /home/content/p/o/l/polisch123/html/indexaffv.php on line 150

    the line 150 is

    Code:
    	setcookie("countNumVisitor", $countNumVisitor, time()+60*60*24*365*3,"/");
    well in dbinfo.php I do NOT INLUDE any output , where is the error ????
    may include files prior setcookie(); ???

    Code:
    <?
    $username="";
    $password="";
    $database="";
    $hostname="";
    $NewslettersTable="newslettersemails";
    $PricesTable="prices42b";     //  prices4   prices42
    $CarsTable="cars22";   //cars1     cars2
    $CustomersTable="customers2";  // customers      customers2
    $CanceledCustomersTable="canceledcustomers3";  
    $BookingsTable="bookings2bigint3";    //  bookings2      
    $AffiliatesTable="affiliates";
    $notifyAff="naff";
    $mobilesite="mobileWebsite";
    $eujspsite="eujspWebsite";
    $customer_bookings_both="customer_bookings_both2";
    $ACancelTable="affCancelCustomers";
    $ATable="affCustomers" ;
    $AEarningsTable="affEarnings" ;
    $AVisitorsTable="affVisitorsNew2" ; 
    $affEarningsView="affEarningsJoinCustomerBookingsView" ;
    ?>

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    This:
    PHP Code:
    if (isset($_COOKIE['countNumVisitor'])) {  
            
    $countNumVisitor=$_COOKIE['countNumVisitor']; 
    Can be called anwyhere. No problem.

    As far as you headers already sent error, there is output prior to line 150.

    Post your code, including any included files called before line 150.

  3. #3
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    I removed blank lines[the only included file dbinfo.php] but same thing, well ?
    if I include twice is error ?

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/p/o/l/polisch123/html/dbinfo.php:21) in /home/content/p/o/l/polisch123/html/indexaffv.php on line 150

    Code:
    $affEarningsView="affEarningsJoinCustomerBookingsView"; $affEarningsViewAdmin="affEarningsJoinCustomerBookingsView2Admin";?>
    last line is 21

  4. #4
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    may include files prior setcookie() (not output) ?

  5. #5
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    You can include files prior to calling setcookie, but if those files cause any output then you are going to get the same error.

    Your dbinfo file is causing output.

    Make sure there are no spaces before the opening <?php tag and DO NOT use a closing tag.

    PHP Code:
    <?php

    // Data base code

    // NO 
    ?>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •