Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: ciasteczka
Forum PHP.pl > Forum > Przedszkole
darkowski
Witam w poniższym kodzieto jest sonda) jest najprawdopodobniej kod który wysyła ciasteczka tylko ja się za bardzo nie orientuje w którym miejscu to jest bo potrzebuje to tak zmienić żeby można było głosować raz na dobę czyli musze to ustawić na 24h

  1. <?php
  2. //sondy
  3. SQLvalidate($_GET['id']);
  4. if(!perms_check('polls', 'results'))
  5. {
  6. redirect('index.php?module=error&error=auth_error');
  7. }
  8.  
  9. $db = new dbquery;
  10.  
  11. $db->query("SELECT * FROM $conf[prefix]polls_defs ORDER BY id DESC LIMIT 1") or $db->err(__FILE__, __LINE__);
  12. $poll = $db->fetch_object();
  13.  
  14. if(!$_GET['id'])
  15. $id_ = $poll->id;
  16. else
  17. $id_ = $_GET['id'];
  18.  
  19. $db->query("SELECT * FROM $conf[prefix]polls_defs WHERE id = $id_") or $db->err(__FILE__, __LINE__);
  20. $poll = $db->fetch_array();
  21.  
  22. //template dla itemu
  23. $tmp=read_file($theme_path."poll_results_item.php");
  24. $content='';
  25.  
  26. $db->query("SELECT * FROM $conf[prefix]polls_opts WHERE poll = $id_ ORDER BY top ASC") or $db->err(__FILE__, __LINE__);
  27. while($item = $db->fetch_array())
  28. {
  29. if($poll[votes] == 0)
  30. $perc = 0;
  31. else
  32. $perc = round(((100*$item['votes'])/$poll['votes']), 0);
  33.  
  34. $content .= string_template($tmp, array("title" => read_text_rest($item['title_'.$_SESSION['lang_short']]), "bar_width" => ($conf['poll_bar_module_width']+10), "perc" => $perc, "votes" => $item['votes']));
  35. }
  36.  
  37. //wczytywanie template
  38. $content=string_template(read_file($theme_path."poll.php"), array('content' => $content, 'title' => read_text_rest($poll['title_'.$_SESSION['lang_short']]), 'lang_voted' => $lang['poll_voted'], 'votes' => $poll['votes'], 'id' => $poll['id'], 'lang_comments' => $lang['poll_comments'], 'comments' => $poll['comments']));
  39. //
  40.  
  41. $db->query("SELECT * FROM $conf[prefix]polls_defs WHERE id < $poll[id] ORDER BY id DESC LIMIT 0,1") or $db->err(__FILE__, __LINE__);
  42. if($db->num_rows() == 0)
  43. $previous = '';
  44. else
  45. {
  46. $prev = $db->fetch_array();
  47. $previous = '<a href="index.php?module=poll&id='.$prev['id'].'"><< '.$lang['poll_previous'].'</a>';
  48. }
  49.  
  50. $db->query("SELECT * FROM $conf[prefix]polls_defs WHERE id > $poll[id] ORDER BY id ASC LIMIT 0,1") or $db->err(__FILE__, __LINE__);
  51. if($db->num_rows() == 0)
  52. $next = '';
  53. else
  54. {
  55. $n = $db->fetch_array();
  56. $next = '<a href="index.php?module=poll&id='.$n['id'].'">'.$lang['poll_next'].' >></a>';
  57. }
  58.  
  59. $content=string_template(read_file($theme_path."poll_main.php"), array('content' => $content, 'next'=>$next, 'prev'=>$previous));
  60.  
  61. //generating content of page - start
  62. $description = $lang['poll'];
  63. $content = string_template(read_file($theme_path.'middle.php'), array('theme_path' => $theme_path, 'content' => $content, 'description' => $description));
  64. if($_GET['comments'] == 1) {
  65.  require_once("includes/functions/comments.php");
  66.  $content .= comments('poll', $id_, 'polls_defs');
  67. }
  68. //end
  69.  
  70. //generating menu_left blocks
  71. $menu_left=menu('left', 'left');
  72. //
  73.  
  74. //generating menu_right blocks
  75. $menu_right=menu('right', 'right');
  76. //
  77.  
  78. //gen both - left
  79. //$menu_both_left=menu('left', 'left');
  80. //$menu_both_left.=menu('right', 'left');
  81.  
  82. //gen both - right
  83. //$menu_both_right=menu('left', 'right');
  84. //$menu_both_right.=menu('right', 'right');
  85.  
  86. //generating menu_top menu
  87. $menu_top=menu('top', 'top');
  88. //
  89.  
  90. template($theme_path.'body.php', array('theme_path' => $theme_path, 'menu_top' => $menu_top, 'menu_left' => $menu_left, 'menu_right' => $menu_right, "menu_left_right"=>$menu_left_right, 'menu_both_right'=>$menu_both_right, 'menu_both_left'=>$menu_both_left, 'content' => $content));
  91. ?>
webdice
Proszę uzupełnić temat o brakujący tag, w przeciwnym wypadku temat zostanie zamknięty.
maniekl2
ja tutaj nie widze żadnych ciasteczek
darkowski
jaki tak tag bo nie rozumiem?
Cezar708
do ustawiania ciasteczek służy set_cookie() a w Twoim kodzie nie ma tej funkcji, więc tu nigdzie się nie ustawia ciastek

Pozdrawiam
darkowski
to może w tym kodzie nie ma mam jeszcze kilka plików poll.php tylko nie wiem w którym to może być
webdice
~Cezar708 nie set_cookie, tylko setcookie" title="Zobacz w manualu PHP" target="_manual, nie wprowadzaj ludzi w błąd.

~darkowski to sobie przeczytaj zasady panujące na subforum przedszkole. Jeśli już będziesz wiedział jaki tag napisz do mnie PW z poprawnym tytułem, a temat otworze.

Zamykam.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.