Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]błąd session nie loguje
bartek4175
post 14.04.2015, 19:01:02
Post #1





Grupa: Zarejestrowani
Postów: 284
Pomógł: 1
Dołączył: 15.08.2013

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


  1. <?php
  2. ?>
  3. <!DOCTYPE html>
  4. <!DOCTYPE html>
  5. <html lang="pl">
  6. <head>
  7. <meta charset="utf-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <title>Panel Administratora</title>
  10. <link href="assets/css/bootstrap.css" rel="stylesheet">
  11. <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
  12. <link href="assets/css/style.css" rel="stylesheet">
  13. <link href="assets/css/style-responsive.css" rel="stylesheet">
  14. </head>
  15.  
  16. <body onload="getTime()">
  17. <div class="container">
  18.  
  19. <?php
  20. if(isset($_GET['logout'])) {
  21. header('Location: index.php');
  22. }
  23. if(isset($_POST['username']) && ($_POST['username'] == 'test') && isset($_POST['password']) && ($_POST['password'] == 'test')) {
  24. $_SESSION['Authenticated'] = 1;
  25. }else{
  26. $_SESSION['Authenticated'] = 0;
  27. }
  28.  
  29. if(isset($_SESSION['Authenticated']) && ($_SESSION['Authenticated'] == 0)) {
  30. ?>
  31.  
  32. <div id="showtime"></div>
  33. <div class="col-lg-4 col-lg-offset-4">
  34. <div class="lock-screen">
  35. <h2><a data-toggle="modal" href="#myModal"><i class="fa fa-lock"></i></a></h2>
  36. <p>Odblokuj</p>
  37.  
  38. <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
  39. <form action="auth.php" method="post">
  40. <div class="modal-dialog">
  41. <div class="modal-content">
  42. <div class="modal-header">
  43. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  44. <h4 class="modal-title">Witamy!</h4>
  45. </div>
  46. <div class="modal-body">
  47. <p class="centered"><img class="img-circle" width="80" src="assets/img/ui-sam.jpg"></p>
  48. <input type="text" name="username" id="username" placeholder="Nazwa użytkownika" autocomplete="off" class="form-control placeholder-no-fix">
  49. <br />
  50. <input type="password" name="password" id="password" placeholder="Hasło" autocomplete="off" class="form-control placeholder-no-fix">
  51. <input type="hidden" name="login">
  52. </div>
  53. <div class="modal-footer centered">
  54. <button data-dismiss="modal" class="btn btn-theme04" type="button">Anuluj</button>
  55. <button class="btn btn-theme03" type="submit">Zaloguj</button>
  56. </div>
  57. </div>
  58. </div>
  59. </form>
  60. </div>
  61. </div>
  62. </div>
  63. <?php
  64. }else{
  65. header('Location: index.php');
  66. }
  67. ?>
  68. </div>
  69. <script src="assets/js/jquery.js"></script>
  70. <script src="assets/js/bootstrap.min.js"></script>
  71. <script type="text/javascript" src="assets/js/jquery.backstretch.min.js"></script>
  72. <script>
  73. $.backstretch("assets/img/login-bg.jpg", {speed: 500});
  74. </script>
  75.  
  76. <script>
  77. function getTime()
  78. {
  79. var today=new Date();
  80. var h=today.getHours();
  81. var m=today.getMinutes();
  82. var s=today.getSeconds();
  83. // add a zero in front of numbers<10
  84. m=checkTime(m);
  85. s=checkTime(s);
  86. document.getElementById('showtime').innerHTML=h+":"+m+":"+s;
  87. t=setTimeout(function(){getTime()},500);
  88. }
  89.  
  90. function checkTime(i)
  91. {
  92. if (i<10)
  93. {
  94. i="0" + i;
  95. }
  96. return i;
  97. }
  98. </script>
  99.  
  100. </body>
  101. </html>

nie loguje mi sad.gif

wpisuje dobre dane to mam pustą stronę z tłem sad.gif
Go to the top of the page
+Quote Post
viking
post 15.04.2015, 06:38:17
Post #2





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

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


W twoim kodzie przekierowuje do index.php jeżeli jest zalogowany.


--------------------
Go to the top of the page
+Quote Post
nospor
post 15.04.2015, 06:39:37
Post #3





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




@viking wlasnie o to chodzi ze nie przekierowuje, bo koles wali przed header całą mase smieci...

@bartek włącz wyswietlanie wszystkich błędów a zobaczysz o czym mowie


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 6.07.2025 - 23:58