Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Nie kontyułuje sesi
nightspirit
post
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 31.08.2004
Skąd: Bydgoszcz, Polska

Ostrzeżenie: (10%)
X----


Moje logowanie
  1. <?php
  2. include('c.php');
  3. $_SESSION['username'] = $_POST['username'];
  4. $_SESSION['password'] = $_POST['password'];
  5.  
  6. if((!$_SESSION['username']) || (!$_SESSION['password']))
  7. {
  8. header(&#092;"Location: http://localhost/~logowanie/login.html\");
  9. }
  10. $sql_result = mysql_query(&#092;"SELECT user_id FROM users WHERE username='\".$username.\"' AND password='\".$password.\"'\");
  11. $num = mysql_num_rows($sql_result);
  12. $username = $_SESSION['username'];
  13. $password = $_SESSION['password'];
  14. if($num == 1)
  15. {
  16. if ($cmd==''){
  17. echo 'zalogowany<br />';
  18. echo '<a href=\"?cmd=off\">Wyloguj ['.$_SESSION['username'].']</a>';
  19. }
  20. if ($cmd=='off'){
  21. }
  22. }
  23. else if($num == 0)
  24. {
  25. echo(&#092;"<B>Nie masz autoryzacji!!!</B>\");
  26. }
  27. ?>

SQL
  1. CREATE TABLE `users` (
  2. `user_id` int(11) NOT NULL DEFAULT '0',
  3. `real_name` char(30) NOT NULL DEFAULT '',
  4. `username` char(10) NOT NULL DEFAULT '',
  5. `password` char(10) NOT NULL DEFAULT '',
  6. PRIMARY KEY (`user_id`)
  7. ) TYPE=MyISAM;
  8.  
  9. INSERT
  10. INTO `users` VALUES (1, 'Jan Kowalski', 'admin', 'aaa');


Pytanie...........

czemu po wyłączeniu Strony i ponownym wejśćiu czemu już nie ma sei .... i dlaczeko nie kontynułujke... ? jak zrobić by Kontynułowało ...
PS. login.html
  1. <form method=post action="login.php">
  2. <table border=1 align=center cellspacing=3 cellpadding=3>
  3. <tr>
  4. <td align=center>
  5. <B>LOGIN: </B>
  6. </td>
  7. <td align=center>
  8. <input type="text" name="username">
  9. </td>
  10. </tr>
  11. <tr>
  12. <td align=center>
  13. <B>HASŁO: </B>
  14. </td>
  15. <td align=center>
  16. <input type=password name="password">
  17. </td>
  18. </tr>
  19. <tr>
  20. <td align=center colspan=2>
  21. <input type=submit value="LOGIN">
  22. </td>
  23. </tr>


--------------------
<span style="font-weight: bold;">"Bo ja wolno myślę."</span> <span style="font-style: italic;">Albert Einstein</span>
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 20.08.2025 - 06:41