Forum Moderators: coopster
<?php
echo "a";
print("a");
setcookie("a", "a", 0);//your error!
<?php
setcookie(...);//your error!
Cookies, headers and session_start must be set before anything is sent to the client!
Hope this helps
<?php
$a = 2 + 2 * 2;
setcookie("a", $a, 0);//works fine!
Best regards
Michal Cibor
<html><head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
</head><body><?php
setcookie("aaa", "bbb", time()+86400*100, "/", "");
$deneme = $_COOKIE["aaa"];
echo $deneme;
?>
</body></html>
problem is same..
Warning: Cannot modify header information - headers already sent by ...
<?php
setcookie("aaa", "bbb", time()+86400*100, "/", "");
$deneme = $_COOKIE["aaa"];
?><html><head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
</head><body><?php
echo $deneme;
?></body></html>
dc
<?
include "admin/config.php";
$Sql = @mysql_query("SELECT * FROM table WHERE number='1'");
$id = @mysql_result($Sql, 0, 'id');
$quest = @mysql_result($Sql, 0, 'quest');
$asec = @$_POST["asec"];
setcookie("aaa", $id, time()+86400*100, "/", "");
mysql_query("UPDATE table SET qqq = qqq + 1 WHERE id='$asec'");
}
$kuukie = @$_COOKIE["aaa"];
if ($kuukie==.....
....
....
?>
<html><head>....
but problem is same still...
Try this to make sure, that you don't echo anything:
<?
include "admin/config.php";$Sql = @mysql_query("SELECT * FROM table WHERE number='1'");
$id = @mysql_result($Sql, 0, 'id');
$quest = @mysql_result($Sql, 0, 'quest');$asec = @$_POST["asec"];
die("Only this should show. Nothing else!");
setcookie("aaa", $id, time()+86400*100, "/", "");
If only the text "Only this should show. Nothing else!" shows, then the problem lies somewhere else. If there's abything in there, it shouldn't be there!
See the source code to see the details!
Michal Cibor
$host = 'aaa';
$user = 'aaa';
$pass = 'aaa';
$dbname = 'aaa';
$mysql = mysql_connect($host,$user,$pass);
$db = mysql_select_db($dbname,$mysql);$Sqlm =@mysql_query("SELECT * FROM table WHERE number='1'");
$id = @mysql_result($Sqlm, 0, 'id');
$Soru = @mysql_result($Sqlm, 0, 'Soru');// Eğer oy gönderildiyse hit arttiriyoruz
$asec = @$_POST["asec"];
if (@$_GET["h"]=="s" && $asec<>"") {
setcookie("Cook", $id, time()+86400*100, "/", "");
mysql_query("UPDATE tablo SET qqq = qqq + 1 WHERE id='$asec'");
}