Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Logowanie
KasztanPL
post
Post #1





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 30.07.2007

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


Witam mam taki mały problem z moim scriptem niby nie pokazuje zadnego błedu ale nie moge sie zalogować lub wylogowac wogole nic sie nie dzieje :/ register_globals mam "On"

Link do strony www.kasztan.cal.pl/nsquad

Testowe konto:
login: Fido
pass: 1234


  1. <?php
  2.  
  3. include("config.inc");  
  4.  
  5.  
  6.  
  7.  
  8. if($action=="login" && empty($_SESSION['login']) && empty($_SESSION['pass'])){
  9. if (!$_POST['login']) {
  10. echo "Wypełnij pole z loginem! (<a href=index.php>Odśwież</a>)";
  11. } elseif (!$_POST['pass']) {
  12. echo "Wypełnij pole z hasłem! (<a href=index.php>Odśwież</a>)";
  13. } else {
  14. $_POST[login]=addslashes($_POST[login]);
  15. $_POST[pass]=addslashes($_POST[pass]);
  16. $logres = mysql_num_rows(mysql_query("select * from user where login='$_POST[login]' and pass='$_POST[pass]'"));
  17. if ($logres <= 0) {
  18. echo "Logowanie nieudane. Sprawdź pisownie loginu oraz hasła. (<a href=index.php>Odśwież</a>)<br>";
  19. } else {
  20. $ban = mysql_fetch_array(mysql_query("select * from user order by login desc limit 1"));
  21. if ($ban[ban]==1) {
  22. print ("Twoje konto zostało zoblokowane! Cos narozrabiales ;)");
  23. print"<br><b>Powód:</b>";
  24. print ("$ban[powod]");
  25. print "<br><a href=index.php>Powrót</a>";
  26. }else{
  27. $_SESSION['login'] = $_POST['login'];
  28. $_SESSION['pass'] = $_POST['pass']; 
  29.  
  30. echo"Zalogowany (<a href=index.php>Odśwież</a>)";
  31.  
  32. }
  33. }
  34. }
  35. }
  36. elseif($_SESSION['login'] && $_SESSION['pass']){
  37. ?>
  38. Witaj <? echo"$_SESSION[login]"; ?> 
  39.  
  40.  
  41.  
  42. <form action="index.php?action=login" method="post"><input type="submit" value="Wyloguj">
  43.  
  44. <?
  45. }elseif($_GET['action']=="login" && !empty($_SESSION['login']) && !empty($_SESSION['pass'])){
  46.  
  47. unset($_SESSION['login']);  
  48. unset($_SESSION['pass']);  
  49.  
  50.  
  51. }else{
  52.  
  53.  
  54. ?>
  55.  
  56.  
  57. <form action="index.php?action=login" method="POST">
  58. login <input type="text" name="login" /> <br/>
  59. pass <input type="password" name="pass" /> 
  60. <input type="submit" value="zaloguj" /></form>
  61.  
  62. <?php
  63. }
  64.  
  65. ?>



Z góry dzieki za pomoc :-) i Wesołych Świąt

Ten post edytował KasztanPL 22.03.2008, 23:57:06
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 - 08:37