Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL][PHP]Problem z logowaniem
Forum PHP.pl > Forum > Przedszkole
Age1869
Otóż, po wpisaniu poprawnych danych nie przechodzi z index.php do index1.php. Poniżej wszystkie pliki:

index.php:
  1. <?php
  2. session_register("zalogowany");
  3. require_once('../INCs/config.php');
  4. ?>
  5. <!DOCTYPE html
  6. PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
  7. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  11. <meta name="Description" content="xxx" />
  12. <meta name="Keywords" content="xxx" />
  13. <meta name="Author" content="xxx" />
  14. <title>xxx</title>
  15. <link rel="stylesheet" type="text/css" href="style/css.css" />
  16. </head><body bgcolor="#a2a2a2"><br /><center>
  17. <div id="calosc">
  18. <div id="gora"><div id="gorne">xxx</div>
  19. <div id="header"></div><div id="stats"></div></div>
  20.  
  21.  
  22. <div id="links">
  23. xxx
  24. </div>
  25. <div id="top">
  26. <div id="center">
  27.  
  28.  
  29. <div id="screens"></div>
  30. <div id="newslogowanie">
  31. <div id="logowanie">
  32. <div style="align: justify; width: 250px; font-family: tahoma;">
  33. <?php include('includes/logowanie.php'); ?></div>
  34. </div>
  35. <div id="news"><?php include('news.php'); ?>
  36. </div>
  37. </div>
  38. </div>
  39.  
  40. <div id="footer"></div>
  41. </div></div><br /></center>
  42. </html>
  43.  


logowanie.php:
  1. <?php
  2.  
  3.  
  4. if(empty($_SESSION["zalogowany"]))$_SESSION["zalogowany"]=0;
  5.  
  6.  
  7. function ShowLogin($komunikat=""){
  8. echo "$komunikat<br>";
  9. echo "<form action='index1.php' method=post>";
  10. echo "login:<input type=text name=login id=loginform><br>";
  11. echo "hasԯ:<input type=password name=haslo id=loginform><br>";
  12. echo "<input type=submit name=submit value=zaloguj id=loginform1></form>";
  13. }
  14.  
  15. ?>
  16.  
  17. <?php
  18. $login = htmlspecialchars($_POST["login"]);
  19. if($_GET["wyloguj"]=="tak"){$_SESSION["zalogowany"]=0;echo "Zostales wylogowany z serwisu";}
  20. if($_SESSION["zalogowany"]!=1){
  21. if(!empty($_POST["login"]) && !empty($_POST["haslo"])){
  22. $query = mysql_query("select * from users where login = '".htmlspecialchars($_POST["login"])."' AND pass = '".htmlspecialchars($_POST["haslo"])."'", $connect);
  23. if(mysql_num_rows( $query )){
  24. $_SESSION["zalogowany"]=1;
  25. $results = mysql_fetch_assoc( $query );
  26. $_SESSION["user_id"] = $_POST['login'];
  27. }
  28. else echo ShowLogin("Podano zle dane!!!");
  29. }
  30. else ShowLogin();
  31. }
  32.  
  33.  
  34.  
  35.  


oraz index1.php:
  1. <?php
  2. session_register("zalogowany");
  3.  
  4. if($_SESSION["zalogowany"] != 1){
  5. header("Location: index.php");
  6. }
  7. ?>
  8. <!DOCTYPE html
  9. PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
  10. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  11. <html>
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  14. <meta name="Description" content="xxx" />
  15. <meta name="Keywords" content="xxx" />
  16. <meta name="Author" content="xxx" />
  17. <title>xxx</title>
  18. <link rel="stylesheet" type="text/css" href="style/css.css" />
  19. </head><body bgcolor="#a2a2a2"><br /><center>
  20. <div id="calosc">
  21. <div id="gora"><div id="gorne">xxx</div>
  22. <div id="header"></div><div id="stats"></div></div>
  23.  
  24.  
  25. <div id="links">
  26. xxx
  27. </div>
  28. <div id="top">
  29. <div id="center1">
  30. <?php
  31. if($_SESSION["zalogowany"] == 1){
  32. include('podstrony.php');
  33. }
  34. ?>
  35. </div>
  36.  
  37. <div id="footer"></div>
  38. </div></div><br /></center>
  39. </html>
  40.  
Szadow
w logowanie.php nie masz session start.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.