Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] gubi sesje, potrzebna pomoc...
Balon
post
Post #1





Grupa: Zarejestrowani
Postów: 422
Pomógł: 0
Dołączył: 14.12.2005
Skąd: Wałbrzych

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


Prosze znowu o pomoc. Robie wlasnie formularz logowania ktory mozna zobaczyc tutaj www.sl.scx.pl (login: user pass: user) i logowanie itd dziala ale sesja jakby znika bo wystarczy odswiezyc i znowu widac formularz logowania....

kod index.php:

  1. <?
  2. ob_start();//Tworzenie sesji i sprawdzanie czy user zalogowal sie
  3. session_cache_limiter('nocache'); ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <? require('inc/func.php'); ?>
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Language" content="pl">
  9. <title>Smieszne linki</title>
  10. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  11. <link href="style.css" rel="stylesheet" type="text/css">
  12. </head>
  13. <body bgcolor="#FFFFFF" topmargin="0">
  14.  
  15. <table border="0" cellpadding="0" cellspacing="0" width="760">
  16. <tr>
  17. <td width="100%" align="center">
  18. &nbsp;</td>
  19. </tr>
  20. <tr>
  21. <td width="100%" align="center">
  22. <table border="0" cellpadding="0" cellspacing="0" width="719">
  23. <tr>
  24. <td width="350">
  25. <table border="0" cellpadding="0" cellspacing="0" width="350">
  26. <tr>
  27. <td colspan="7" width="350">
  28. <a href="index.html">
  29. <img id="img_03" src="images/img_03.gif" width="104" height="46" alt="" border="0" /><img id="img_04" src="images/img_04.gif" width="101" height="46" alt="" border="0" /></a></td>
  30. </tr>
  31. <tr>
  32. <td width="350" colspan="7">&nbsp;</td>
  33. </tr>
  34. <tr>
  35. <table border="0" cellpadding="0" cellspacing="0">
  36. <tr>
  37. <td>
  38. <a href="wyslij_link.html"><img border="0" src="images/img_08.gif" width="77" height="20" alt="" /></a></td>
  39. <td>
  40. &nbsp;</td>
  41. <td>
  42. <a href="top50.html"><img border="0" src="images/img_10.gif" width="77" height="20" alt="" /></a></td>
  43. <td>
  44. &nbsp;</td>
  45. <td>
  46. <a href="statystyki.html"><img border="0" src="images/img_12.gif" width="77" height="20" alt="" /></a></td>
  47. <td>
  48. &nbsp;</td>
  49. <td>
  50. <a href="kontakt.html">
  51. <img id="img_14" src="images/img_14.gif" width="77" height="20" border="0" /></a></td>
  52. </tr> </tr>
  53. </table>
  54. </td>
  55. <td valign="top" width="369">
  56. <? include "inc/login_form.php" ?>
  57. </td>
  58. </tr>
  59. </table>
  60.  
  61.  
  62. <table border="0" cellpadding="0" cellspacing="0" width="100%" height="390">
  63. <tr>
  64. <td width="394" height="390" valign="top" align="left">
  65. <?
  66.  
  67. if($co=="reklama") { include "inc/reklama.php"; }
  68. elseif($co=="kontakt") { include "inc/kontakt.php"; }
  69. elseif($co=="statystyki") { include "inc/statystyki.php"; }
  70. elseif($co=="top") { include "inc/top.php"; }
  71. elseif($co=="wyslij") { include "inc/wyslij.php"; }
  72. elseif($co=="wspolpraca") { include "inc/wspolpraca.php"; }
  73. elseif($co=="linki_kat") { include "inc/linki_kat.php"; }
  74. else { include "inc/linki.php"; }
  75.  
  76. ?>
  77.  
  78. </td>
  79. <td width="353" height="390" valign="top" align="center">
  80. <? include('inc/news.php'); ?>
  81.  
  82. <table border="0" cellpadding="0" cellspacing="0">
  83. <tr>
  84. <td>
  85. <a href="wspolpraca.html">
  86. <img border="0" src="images/wspolpraca.gif" width="77" height="20" alt="" /></a></td>
  87. <td>
  88. &nbsp;</td>
  89. <td>
  90. <a href="reklama.html">
  91. <img border="0" src="images/reklama.gif" width="77" height="20" alt="" /></a></td>
  92. <td>
  93. &nbsp;</td>
  94. <td>
  95. <a href="redakcja.html">
  96. <img border="0" src="images/redakcja.gif" width="77" height="20" alt="" /></a></td>
  97. <td>
  98. &nbsp;</td>
  99. <td>
  100. <a href="kontakt.html">
  101. <img src="images/kontakt_2.gif" width="77" height="20" border="0" /></a></td>
  102. </tr>
  103. </table>
  104. </td>
  105. </tr>
  106. </table>
  107.  
  108. <table width="640" height="20" border="0" cellpadding="0" cellspacing="0">
  109. <tr>
  110. <td>&nbsp;</td>
  111. </tr>
  112. </table>
  113.  
  114. <table width="640" height="30" border="0" cellpadding="0" cellspacing="0">
  115. <tr>
  116. <td>
  117. <img src="images/stopka_01.gif" width="6" height="30" alt=""></td>
  118. <td width="628" background="images/stopka_tlo.gif" align="center">
  119.  <font face="Tahoma" size="1"><font color="#D5F0FB">Copyright 2003-2005 <b>śmieszne linki</b>. All rights reserved. 
  120.  Project: </font> <a href="http://www.scx.pl"><font color="#D5F0FB">Scx.pl</font></a></font></td>
  121. <td>
  122. <img src="images/stopka_03.gif" width="6" height="30" alt=""></td>
  123. </tr>
  124. </table>
  125. </td>
  126. </tr>
  127. </table>
  128. </body>
  129. </html>
  130. <? ob_end_flush(); ?>


plik z formularzem

  1. <?
  2.  
  3. lacz();
  4. ?>
  5.  
  6. <table border="0" cellpadding="0" cellspacing="0" height="61">
  7. <tr>
  8. <td width="172" rowspan="3" height="61">
  9. &nbsp;</td>
  10. <td height="29">
  11. <a href="index.html"><img src="images/home.gif" width="63" height="29" alt="" border="0"></a></td>
  12. <td height="29">
  13. <img src="images/archiwum.gif" alt="" width="81" height="29"></td>
  14. <td height="29">
  15. <a href="kontakt.html"><img src="images/kontakt.gif" width="71" height="29" alt="" border="0"></td>
  16. </tr>
  17.  
  18. <!-- formularz logowania -->
  19. <?
  20.  
  21. if(isset($HTTP_POST_VARS['login']) && isset($HTTP_POST_VARS['pass']))
  22. {
  23. // Skrypt sprawdzajacy prawdziwosc danych podczas logowania
  24. $user = $HTTP_POST_VARS['login'];
  25. $pass = $HTTP_POST_VARS['pass'];
  26.  
  27. $zapytanie = 'select * from users '
  28.  ."where name='$user' "
  29.  ." and pass='$pass'";
  30. $wynik = mysql_query($zapytanie);
  31. if(mysql_num_rows($wynik) > 0)
  32. {
  33. // Jezeli dane sa prawdziwe nastepuje zarejestrowanie identyfikatora usera
  34. $HTTP_SESSION_VARS['prawid_uzyt'] = $user;
  35. echo '<tr>
  36. <td colspan="3" align="center" height="32">
  37. Zalogowany jako: <b>'.$user.'</b>.
  38. </td>
  39. </tr>
  40. </table>';
  41.  
  42. } else {
  43. echo '<tr>
  44. <td colspan="3" align="center" height="32">
  45. <b>Nieprawidłowe dane.</b>
  46. </td>
  47. </tr>
  48. </table>';
  49. }
  50. } elseif(isset($HTTP_SESSION_VARS['prawid_uzyt'])) {
  51.  
  52.  
  53. menu_user();
  54.  
  55. }
  56. ?>



  1. <?
  2. // Tworzenie linkow dla zalogowanego usera
  3. function menu_user() {
  4. if (isset($user))
  5. {
  6.  
  7. echo '<tr>
  8. <td colspan="3" align="center" height="32">
  9. Zalogowany jako: <b>'.$user.'</b>.
  10. </td>
  11. </tr>
  12. </table>';
  13.  
  14. } else {
  15. echo'<td colspan="3" align="center" height="32">
  16. <form action="index.html" method="post">
  17. <input type="text" name="login" size="10" class="t1">&nbsp;&nbsp;
  18. <input type="password" name="pass" size="10" class="t1"></td>
  19. </tr>
  20. <tr>
  21. <td colspan="3" align="center">
  22. <input type="image" src="images/zaloguj.gif"></form>&nbsp;&nbsp;<a href="rejestracja.html"><img src="images/zarejestruj.gif" alt="" width="67" height="16" border="0"></a></td>
  23. </tr>
  24. </table>';
  25. }
  26. }
  27. ?>


Czy ktos wie w czym tkwi blad? Prosze o pomoc (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
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 - 13:03