Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] dziwny problem z cookies + geoip
dopelganger
post
Post #1





Grupa: Zarejestrowani
Postów: 236
Pomógł: 0
Dołączył: 27.10.2012

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


Witajcie
pomóżcie bo zwariuję :[

mam taki kod:

  1. <?php
  2.  
  3. if (!isset($_COOKIE["verlang"])) {
  4.  
  5. require_once 'geoip2/vendor/autoload.php';
  6. use GeoIp2\Database\Reader;
  7.  
  8. $reader = new Reader('/usr/local/geolite/GeoLite2-Country.mmdb');
  9. $record = $reader->country($_SERVER['REMOTE_ADDR']);
  10.  
  11. $codeCountry = $record->country->isoCode;
  12. setcookie("verlang",$codeCountry,time()+(60*60*24*365));
  13. echo $codeCountry;
  14.  
  15. } else {
  16.  
  17. echo 'Dlaczego tego nie wyświetla jak jest ciasteczko?(IMG:style_emoticons/default/questionmark.gif) (IMG:style_emoticons/default/questionmark.gif) ?';
  18.  
  19. }
  20.  
  21. ?>


Nie wyświetla mi treści po } else { a ciasteczko jest bo jak daje echo $_COOKIE ... to pokazuje zawartość ,,,
zgłupiałem , o co kaman (IMG:style_emoticons/default/questionmark.gif) (IMG:style_emoticons/default/questionmark.gif) ?

Jeśli opatrze komentarzami część if else to wyświetli mi PL (czyli skrypt geoip działa OK (IMG:style_emoticons/default/exclamation.gif) !):

  1. // if (!isset($_COOKIE["verlang"])) {
  2.  
  3. ... dalej skrypt geoip
  4.  
  5. /*
  6. } else {
  7. }
  8. */


Prosze o pomoc
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 14:25