Piszę właśnie skrypt logowania. Używam najnowszego Krasnala. Po wypełnieniu i wysłaniu formularza nie następuje żadna akcja zapisana w skrypcie. Czy mój kod jest poprawny, czy to wina Krasnala? Oto kod:
<?php #formularz
if($show_form)
{
echo '<form method=\"post\" action=\"login.php\">'.\"n\"; echo '<fieldset>'.\"n\"; echo 'Login: <input type=\"text\" maxlength=\"20\" name=\"login\" /><br />'.\"n\"; echo 'Hasło: <input type=\"password\" maxlength=\"20\" name=\"password\" /><br />'.\"n\"; echo '<input type=\"submit\" value=\"Zaloguj się\" />';
function remove_slashes($data)
{
{
}
return $data;
}
if(isset($_POST['submit'])) {
if(empty($_POST['username'])) {
echo '<p style=\"color: #F00; font-weight: bold;\">Proszę podać poprawny login</p>'.\"n\"; $username = FALSE;
}
else
{
$username = remove_slashes($_POST['username']);
}
if(empty($_POST['password'])) {
echo '<p style=\"color: #F00; font-weight: bold;\">Proszę podać poprawne hasło</p>'.\"n\"; $password = FALSE;
}
else
{
$password = remove_slashes($_POST['password']);
}
if($username && $password)
{
require_once('mysql_connect_level0');
$query = \"SELECT `username`, `password`, `access_level` FROM `users` WHERE `username`
'$username' AND `password` = PASSWORD('$password');\";
$result = @mysql_query($query);
$row = mysql_fetch_assoc($result);
if($row)
{
$_SESSION['authorized'] = TRUE;
$_SESSION['access_level'] = $row['access_level'];
$_SESSION['username'] = $row['username'];
header(\"Location: http://localhost/~usr/\");
}
else
{
echo '<p style=\"color: #F00; font-weight: bold;\">Podane dane są nieprawidłowe</p>'.\"n\"; }
}
}
else
{
'<p style=\"color: #F00; font-weight: bold;\">Wystąpiły problemy. Proszę spróbować ponownie</p>'.\"n\";
}
echo '</fieldset>'.\"n\"; echo '</form>'.\"n\"; }
?>