index.php:
Kod
<html>
<head>
<title>UploadTest</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jQuery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
</head>
<body>
<?php if ($_SESSION["logowanie"] == "ok")
{
echo 'Jestes zalogowany';
}
else
{
?>
<form method='Post' action='login.php'>
<b>Login: </b> <input type='text' name='login'>
<b>Hasło: </b> <input type='password' name='passwd'></br>
<input type='submit' value='Wyślij' name='wyslij'>
</form>
<?php } ?>
</body>
</html>
<head>
<title>UploadTest</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jQuery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
</head>
<body>
<?php if ($_SESSION["logowanie"] == "ok")
{
echo 'Jestes zalogowany';
}
else
{
?>
<form method='Post' action='login.php'>
<b>Login: </b> <input type='text' name='login'>
<b>Hasło: </b> <input type='password' name='passwd'></br>
<input type='submit' value='Wyślij' name='wyslij'>
</form>
<?php } ?>
</body>
</html>
login.php
Kod
<html>
<head>
</head>
<body>
<?php
include('conf/pass.php');
$login = $_POST['login'];
$password = $_POST['passwd'];
if ($password == $poprawne && $login == $poprawny);
{
session_start();
$_SESSION['logowanie'] = "ok";
echo 'zalogowales sie poprawnie';
//Tu dodam przekierowanie
}
else
{
echo 'blad';
}
?>
</body>
</html>
<head>
</head>
<body>
<?php
include('conf/pass.php');
$login = $_POST['login'];
$password = $_POST['passwd'];
if ($password == $poprawne && $login == $poprawny);
{
session_start();
$_SESSION['logowanie'] = "ok";
echo 'zalogowales sie poprawnie';
//Tu dodam przekierowanie
}
else
{
echo 'blad';
}
?>
</body>
</html>
Tylko, że na razie po przeniesieniu z formularza na login.php dostaje pustą stronę, ani blad anie zalogowales sie poprawnie.