Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [MySQL][PHP]COOKIE nie dziala?
Raven1122
post
Post #1





Grupa: Zarejestrowani
Postów: 369
Pomógł: 2
Dołączył: 1.11.2010

Ostrzeżenie: (0%)
-----


Witam, mam problem z headers already sent, choc jeszcze nie zostaly wyslane. Oto kod:

  1. <?php
  2. if (!isset($_COOKIE['glosowal'])) {
  3. if (isset($_GET['pool'])) {
  4. $link = mysql_connect("localhost", "bassplay_website", "ceowwyso12") or die(mysql_error());
  5. mysql_select_db('bassplay_website') or die(mysql_error());
  6. $dj = mysql_real_escape_string($_GET['pool'], $link);
  7. $query = sprintf('UPDATE djpool SET votes = votes + 1 WHERE dj = "%s"', $dj);
  8. mysql_query($query, $link) or die(mysql_error());
  9. setcookie('glosowal', 'oddalglos', time()+60*60*24);
  10. $komunikat = "Twój głos został poprawnie oddany na " . $dj;
  11. } else {
  12. $komunikat = "Proszę zaznaczyć 1 z DJ'ów";
  13. }
  14. } else {
  15. $komunikat = "Już oddałeś/aś swój głos";
  16. }
  17. ?>
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  19. <html>
  20. <head>
  21. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  22. <meta http-equiv="Content-Language" content="pl" />
  23. <meta name="Robots" content="ALL" />
  24. <link rel="stylesheet" href="/css/style.css" type="text/css" />
  25. <link rel="stylesheet" type="text/css" href="/css/menu.css" />
  26. <script src="js/stuHover.js" type="text/javascript"></script>
  27. <title>Bassplay - Najlepsza Muzyka</title>
  28. </head>
  29. <body>
  30. <div id="container">
  31. <div id="menu"><?php include("../includes/menu.php"); ?></div>
  32. <div id="contenttop"></div>
  33. <div id="content">
  34. <center><?php echo $komunikat; ?></center>
  35. </div>
  36. <div id="contentbottom"><div class="floatend"></div></div>
  37. <div id="logo"></div>
  38. </div>
  39. </body>
  40. </html>
Go to the top of the page
+Quote Post
cycofiasz
post
Post #2





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

Ostrzeżenie: (0%)
-----


A właśnie że zostały. Zacznij od usunięcia tej pustej przestrzeni przed <?php
Go to the top of the page
+Quote Post
nospor
post
Post #3





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




1) Masz już jeden temat o cookie
2) Miałeś poszukać rozwiązania. To wszystko było już wiele razy omawiane.


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 05:32