Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z logowaniem
-Gość_adam-
post
Post #1





Goście







Nie wiem co sie dzieje, niby wszystko jest dobrze ale nie chce działac, skrypt logowania wydaje mi sie ze wywala sie w tym momencie
Kod
$sql = "SELECT * FROM `uzytkownicy` WHERE `login` = '$login_user' AND `haslo` = md5('$haslo_user') LIMIT 1";
$result = mysql_query($sql);
$wynik = mysql_fetch_array($result);
if(mysql_num_rows($result) > 0):

tzn nie wchodzi do tego if'a na koncu.. Prosze Was o pomoc.. (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
-Gość_Adam-
post
Post #2





Goście







Sorki.. (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
  1. <?php
  2. extract($_GET);
  3. extract($_POST);
  4. $db=mysql_connect(&#092;"localhost\", \"root\", \"\");
  5. mysql_select_db(&#092;"mirek1\", $db);
  6. ?>
  7.  
  8. <HTML>
  9. <HEAD>
  10. <META http-equiv=Content-Type content=\"text/html; charset=iso-8859-2\">
  11. <META NAME=\"Language\" CONTENT=\"pl\">
  12. </HEAD>
  13. <BODY background=\"tlo.gif\">
  14.  
  15. <p align=\"center\">
  16. <font color=\"#FFFFFF\" size=\"1\" face=\"Verdana\">
  17. <img src=\"news_g.gif\" width=\"300\" height=\"10\"><br></font>
  18. <font color=\"#000000\" size=\"1\" face=\"Verdana\"><strong>Logowanie</strong></font>
  19. <font color=\"#FFFFFF\" size=\"1\" face=\"Verdana\"><br>
  20. <img src=\"news_s.gif\" width=\"300\" height=\"10\"><br><br>
  21. </p>
  22.  
  23. <?
  24. if($opcja == &#092;"wyloguj\"):
  25. session_unregister(&#092;"username\");
  26. header(&#092;"Location: index.php\");
  27. endif;
  28.  
  29. $inc = 0;
  30. if(!session_is_registered(&#092;"username\")):
  31. if(isset($submit)):
  32. $sql = &#092;"SELECT count(*) FROM uzytkownicy WHERE login = '$login_user' AND haslo = md5('$haslo_user') LIMIT 1\";
  33. $wynik = mysql_query($sql);
  34. $result = mysql_fetch_row($wynik);
  35. if(mysql_num_rows($wynik) > 0):
  36. session_register(&#092;"username\");
  37. $_SESSION[&#092;"username\"] = $login_user;
  38. else:
  39. ?>
  40. Nieprawidłowe dane<BR>
  41. <form method=post>
  42. <TABLE BORDER=\"0\">
  43. <TR>
  44. <TD>Login: </TD> <TD><input type=\"text\" name=\"login_user\"></TD></TR>
  45. <TR>
  46. <TD>Hasło: </TD> <TD><input type=\"password\" name=\"haslo_user\"></TD></TR>
  47. </TABLE>
  48. <input type=submit name=submit value=\"Zaloguj\">
  49. </form>
  50. <?
  51. endif;
  52. else:
  53. ?>
  54. <form method=post>
  55. <TABLE BORDER=\"0\">
  56. <TR>
  57. <TD>Login: </TD> <TD><input type=\"text\" name=\"login_user\"></TD></TR>
  58. <TR>
  59. <TD>Hasło: </TD> <TD><input type=\"password\" name=\"haslo_user\"></TD></TR>
  60. </TABLE>
  61. <input type=submit name=submit value=\"Zaloguj\">
  62. </form>
  63. <?
  64. exit();
  65. endif;
  66. endif;
  67.  
  68. if(!session_is_registered(&#092;"username\")):
  69. exit();
  70. endif;
  71.  
  72. echo &#092;"<A HREF=\"?opcja=wyloguj\">Wyloguj</A><BR><BR>\";
  73. ?>
  74.  
  75. Zalogowany...
  76. </BODY>
  77. </HTML>
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: 28.12.2025 - 13:04