Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z sesjami
mk83
post 29.09.2005, 12:55:46
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 0
Dołączył: 17.02.2005

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


Witam
Mam nastepujacy przykladowy skrypt ktory bez problemu dziala w PHP4:

  1. <?
  2. if($_GET['mod']==logowanie) { $login=$_GET['login']; session_register("login"); }
  3. if(isset($_SESSION['login']))
  4. {
  5. print("witaj:".$_SESSION['login']);
  6. }
  7. else {
  8. ?>
  9. <form action=test.php method=GET>
  10. <input type=hidden name=mod value=logowanie>
  11. <input type=text name=login>
  12. <br><input type=submit value=go></form>
  13. <?}?>


Natomiast pod PHP5, pojawia sie problem. Minowicie w momecie w ktorym urzywam session_register("login"); , sesja nie jest rejestrowana odrazu a dopiero po odswierzeniu przgladarki.
Dostaj rowniez nastepujace ostrzezenie:

Kod
Warning: Unknown: Your script possibly relies on a session side-effect which existed until php 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0


Moze ktos wie jak sobie z tym poradzic . Od razu wspomne ze nie mam dostepu do konfigoracji serwera.
Go to the top of the page
+Quote Post
czachor
post 29.09.2005, 12:59:56
Post #2





Grupa: Zarejestrowani
Postów: 897
Pomógł: 40
Dołączył: 16.12.2003
Skąd: Warszawa

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


session_register" title="Zobacz w manualu php" target="_manual, trzecia uwaga od góry.


--------------------
how many SEO experts does it take to change a light bulb,lightbulb,light,bulb,lamp,lighting,switch,sex,xxx
5-Reasons-why-you-should-NEVER-fix-a-computer-for-free
Go to the top of the page
+Quote Post
Apo
post 4.10.2005, 19:26:08
Post #3





Grupa: Zarejestrowani
Postów: 426
Pomógł: 1
Dołączył: 2.10.2005

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


A nie może być tak:
  1. <?
  2. $_SESSION['login'] = false;
  3. if($_GET['mod']==logowanie) { $login=$_GET['login']; $_SESSION['login'] = true;; }
  4. if($_SESSION['login'] == true)
  5. {
  6. print("witaj:".$_SESSION['login']);
  7. }
  8. else {
  9. ?>
  10. <form action="test.php" method="GET">
  11. <input type="hidden" name="mod" value="logowanie" />
  12. <input type="text" name="login" />
  13. <br><input type="submit" value="go" /></form>
  14. <?}?>

Dostosuj do włąsnych potrzeb.
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 26.04.2024 - 15:45