Log in

View Full Version : php cookie error received - included file paswords.php



leonidassavvides
04-05-2009, 01:21 PM
setcookie("countNumVisitor", $countNumVisitor, time()+60*60*24*365*3,"/");
or

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


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(); ???


<?
$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" ;
?>

JasonDFR
04-05-2009, 07:37 PM
This:

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.

leonidassavvides
04-05-2009, 08:34 PM
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


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

leonidassavvides
04-05-2009, 08:38 PM
may include files prior setcookie() (not output) ?

JasonDFR
04-06-2009, 05:30 AM
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

// Data base code

// NO ?>