Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] session_start()
karlkar
post
Post #1





Grupa: Zarejestrowani
Postów: 52
Pomógł: 0
Dołączył: 28.03.2007

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


Dobra Panowie Wielkie Głowy powiedzta mnie dlaczego ten skrypt wyświetla mi napis "Nie jesteś zalogowany!"?

  1. <?php
  2. if (isset($authorized)) { 
  3. echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
  7. <title>Marsjańsjki formularz rekrutacyjny</title>
  8. <meta http-equiv="Content-Style-Type" content="text/css">
  9. <link rel="stylesheet" href="Solaris.css" type="text/css">
  10. </head>
  11. <body>
  12.  
  13. <table width="750" border="0" cellpadding="0" cellspacing="0" align="center">
  14. <tr>
  15. <td valign="top" class="maintable">
  16. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  17. <tr>
  18. <td width="50%" valign="top"><a href="http://marsgw.fora.pl" class="nav"><img src="images/forumlogo.jpg" width="253" height="98" border="0" /></a></td>
  19. <td width="50%" valign="top"></td></tr><tr>
  20. <td colspan="2"><img src="images/bg_top_border.jpg" width="750" height="51" /></td>
  21. </tr>
  22. </table>
  23. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  24. <tr>
  25. <td class="tableborder">
  26. <table width="100%" border="0" cellspacing="1">
  27. <tr>
  28. <td colspan="4" class="categorybar">
  29.  
  30. <table border="0" width="100%">
  31. <tr>
  32. <td><img src="images/category_icon.gif"></td>
  33. <td><font class="cattitle">Rekrutacja do MARSa - Głosowanie</font></td>
  34. </tr>
  35. </table>
  36.  
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="row1">
  41.  
  42. <table border="0" width="100%">";
  43. echo "Działa!";}
  44. else echo "Nie jestes zalogowany! <a href="glosuj.php"> Logowanie </a>";
  45. ?>


Oczywiście jak na tą chwile sprawa wydaje sie wam oczywista - nie ma pliku, który przesyła do tego pliku informacje o sesji, ale plik jest i wszystko działa, gdy w skrypcie przeprowadze małą - wręcz kosmetyczną zmianę. Oto ona(zwróćcie uwage na położenie polecenia session_start()):

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
  5. <title>Marsjańsjki formularz rekrutacyjny</title>
  6. <meta http-equiv="Content-Style-Type" content="text/css">
  7. <link rel="stylesheet" href="Solaris.css" type="text/css">
  8. </head>
  9. <body>
  10.  
  11. <table width="750" border="0" cellpadding="0" cellspacing="0" align="center">
  12. <tr>
  13. <td valign="top" class="maintable">
  14. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  15. <tr>
  16. <td width="50%" valign="top"><a href="http://marsgw.fora.pl" class="nav"><img src="images/forumlogo.jpg" width="253" height="98" border="0" /></a></td>
  17. <td width="50%" valign="top"></td></tr><tr>
  18. <td colspan="2"><img src="images/bg_top_border.jpg" width="750" height="51" /></td>
  19. </tr>
  20. </table>
  21. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  22. <tr>
  23. <td class="tableborder">
  24. <table width="100%" border="0" cellspacing="1">
  25. <tr>
  26. <td colspan="4" class="categorybar">
  27.  
  28. <table border="0" width="100%">
  29. <tr>
  30. <td><img src="images/category_icon.gif"></td>
  31. <td><font class="cattitle">Rekrutacja do MARSa - Głosowanie</font></td>
  32. </tr>
  33. </table>
  34.  
  35. </td>
  36. </tr>
  37. <tr>
  38. <td class="row1">
  39.  
  40. <table border="0" width="100%">
  41. <?php
  42. if (isset($authorized)) {
  43. echo "dziala!";}
  44. else echo "Nie jestes zalogowany! <a href="glosuj.php"> Logowanie </a>";
  45. ?>


z kolei przy tym drugim skrypcie wywala mi błąd, że session_start musi być na początku strony, ale poza tym wyświetla tabelkę i tekst Działa. Co tu jest nie tak?
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: 23.08.2025 - 23:32