![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 24 Pomógł: 0 Dołączył: 5.11.2007 Ostrzeżenie: (0%) ![]() ![]() |
Witam wszystkich
Właśnie zabrałem sie za skrypt logowania na moją stronę z wykorzystaniem sesji, niestety kiedy się loguję - to pomimo wpisania dobrego hasła i loginu wyskakuje błąd, że haslo albo login są niepoprawne. Bardzo proszę o pomoc ! Oto pliki : index.php <?php session_start();?> <?php if(!empty($_GET['page'])) $file = 'include/'.$_GET['page'].'.php'; else $file = 'include/witam.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Programowanie aplikacji internetowych</title> <link href="style/tło.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" border="1"> <tfoot><tr><td colspan="2"></td></tr></tfoot> <tr> <td width="15%" height="190"><img src="images/dominik.jpg" width="243" height="211" /></td> <td width="85%"> <form id="form1" name="form1" method="post" action="index.php?page=loguj_script"> <table width="11%" border="1" align="right" cellpadding="0" cellspacing="0"> <tr> <td><label>Logowanie: <input name="login_check" type="text" size="25" class="textarea" /> </label></td> </tr> <tr> <td><label>Haslo: <input name="pass_check" type="password" size="25" class="textarea" /> </label></td> </tr> <tr> <td><div align="center"> <input type="submit" name="submit" value="Login" /> </div></td> </tr> <tr> <td><div align="center"><a href="index.php?page=rejestracja_form1">Rejestracja</a></div><div align="center">Zapomniałeś hasła -<a href="login/zapomniane_form.php"> KLIKNIJ </a></div></td> </tr> </table> </form> <div align="center"> <p><strong>POLITECHNIKA ŁÓDZKA</strong></p> <p>Instytut informatyki </p> </div></td> </tr> <tr> <td align="top" height="663"><?php include('include/menu.php');?></td> <td> <?php if(file_exists($file)) include($file); else include('include/error.php'); ?> </td> </tr> </table> </body> </html> loguj_script.php <?php session_start(); ?> <?php $login_check = $_POST['login_check']; $pass_check = $_POST['pass_check']; if (!file_exists("users/$login_check.dat")): echo("Błędne dane"); elseif (file_exists("users/$login_check.dat")): include("users/$login_check.dat"); if(($_SESSION['login'] == $login_check) && ($_SESSION['password'] == $pass_check)): // cos tutaj chyba jest nie tak ? echo ("witamy"); echo $_SESSION['login']; echo("Zalogowałeś się!!"); else: echo("niepoprawny login lub/i hasło"); endif; endif; ?> Bardzo proszę o rodę |
|
|
![]()
Post
#2
|
|
![]() Grupa: Przyjaciele php.pl Postów: 1 595 Pomógł: 282 Dołączył: 24.09.2007 Skąd: Reda, Pomorskie. Ostrzeżenie: (0%) ![]() ![]() |
Witaj.
W kodzie który pokazałeś nigdzie nie inicjujesz $_SESSION['login'] oraz $_SESSION['password']. Można domniemać, że są cały czas puste... Wtedy warunek się nie sprawdzi... -------------------- - Oh no, my young coder. You will find that it is you who are mistaken, about a great many things... - |
|
|
![]()
Post
#3
|
|
![]() Grupa: Moderatorzy Postów: 4 465 Pomógł: 137 Dołączył: 26.03.2004 Skąd: Gorzów Wlkp. ![]() |
Popraw proszę tytuł topiku na zgodny z zasadami forum Przedszkole o dodaj bbcode
-------------------- To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness; chaotic, confused, vulnerability, to inform yourself. Think for yourself. Question authority. |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 2 291 Pomógł: 156 Dołączył: 23.09.2007 Skąd: ITALY-MILAN Ostrzeżenie: (10%) ![]() ![]() |
sorki za offtop bo nie chce czytac calego kodu ale czy to nie jest poinson null byte jesli tak to popraw
OMG usunelo mi sie przez przypadek sorki a wiec napisze jeszcze raz ten kod wedlug mnie nie jest poprawny:
mozna to tak wykorzystac
i kod sie zmienia na taki po dodaniu
uzyj przynajmniej basename() z przyrostkiem php i wtedy w url nie bedzie rozszerzenia pliku ![]() Ten post edytował marcio 5.11.2007, 19:00:13 -------------------- Zainteresowania: XML | PHP | MY(SQL)| C# for .NET | PYTHON
http://code.google.com/p/form-builider/ Moj blog |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 13.06.2025 - 20:09 |