<?php include("config.php"); switch ($_GET['load']) { default: echo '<html> <head> <meta http-equiv="Content-Language" content="pl"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1250"> <title>Nowa strona 1</title> </head> <body> <div align="center"> <form method="POST" action="admin.php?load=login"> <table border="0" width="200" cellspacing="0" cellpadding="0" bgcolor="#C0C0C0"> <tr> <td> <p style="margin-left: 4px"><font face="Arial" size="1">Login:</font></p></td> <td><input type="text" name="user" size="20"></td> </tr> <tr> <td><p style="margin-left: 4px"><font face="Arial" size="1">Hasło:</font></p></td> <td><input type="password" name="pass" size="20"></td> </tr> <tr> <td colspan="2" align="center"><p style="margin-left: 4px"> <input type="submit" value="Zaloguj" name="a1"></p></td> </tr> </table> </form> </div> </body> </html>'; break; //Logowanie case 'login': $users = $_POST['user']; $_SESSION['user'] = $users; $_SESSION['pass'] = $passs; break; } function login_ok() { $user = $_SESSION['user']; $pass = $_SESSION['pass']; $query = mysql_query("SELECT * FROM users WHERE users_login ='$user' AND users_password ='$pass';"); if($login_ok==0) { $ret=FALSE; } else { $ret=TRUE; }return $ret; } switch ($_GET['modul']) { case 'index': if( login_ok() ) { } else { } break; } ?>
Co jest źle, że nie działa mi logowanie? TZN. Nie wiem czy sesji nie zapamiętuje, czy co, bo zawsze funkcja login_ok() zwraca else.