2018-11-27 18:56:59 +01:00
|
|
|
|
<?php
|
|
|
|
|
session_start();
|
|
|
|
|
|
2018-12-30 01:29:37 +01:00
|
|
|
|
include 'sql/db_login.php';
|
2018-12-28 20:12:00 +01:00
|
|
|
|
|
2018-11-27 18:56:59 +01:00
|
|
|
|
mysql_connect("$db_servername", "$db_login", "$db_password");
|
|
|
|
|
mysql_select_db("$db_name");
|
|
|
|
|
|
2018-12-28 20:12:00 +01:00
|
|
|
|
$db = mysqli_connect("$db_servername", "$db_login_tasks", "$db_password_tasks", "$db_name_tasks");
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
2018-11-27 18:56:59 +01:00
|
|
|
|
function filter($variable)
|
|
|
|
|
{
|
|
|
|
|
if(get_magic_quotes_gpc())
|
|
|
|
|
$variable = stripslashes($variable);
|
|
|
|
|
|
|
|
|
|
return mysql_real_escape_string(htmlspecialchars(trim($variable)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['wyloguj'])==1)
|
|
|
|
|
{
|
|
|
|
|
$_SESSION['zalogowany'] = false;
|
|
|
|
|
session_destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['loguj']))
|
|
|
|
|
{
|
2018-12-28 20:57:43 +01:00
|
|
|
|
$login = filter($_POST['login']);
|
|
|
|
|
$password = filter($_POST['password']);
|
2018-11-27 18:56:59 +01:00
|
|
|
|
if (mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `user_login`='$login' && `user_pass`='$password' && `aktywne`='1'")) > 0)
|
|
|
|
|
{
|
|
|
|
|
$_SESSION['zalogowany'] = true;
|
2018-12-28 20:23:07 +01:00
|
|
|
|
$_SESSION['login'] = strtolower($login);
|
2018-11-27 18:56:59 +01:00
|
|
|
|
}
|
|
|
|
|
else { echo "Wpisano zle dane lub konto nieaktywne."; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_SESSION['zalogowany']==true)
|
|
|
|
|
{
|
|
|
|
|
echo "Zalogowano jako <b>".$_SESSION['login']."</b>"; echo '<a href="?wyloguj=1"> [Wyloguj]</a>';
|
2018-12-28 20:57:43 +01:00
|
|
|
|
?>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
|
2018-12-30 01:32:43 +01:00
|
|
|
|
<form method="POST" action="add.php">
|
2018-12-30 02:04:06 +01:00
|
|
|
|
<input type="text" name="task" class="task_input" required>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
<input type="submit" value="Dodaj zadanie" name="submit">
|
|
|
|
|
</form>
|
|
|
|
|
<?php
|
|
|
|
|
$login = $_SESSION['login'];
|
2018-12-30 01:32:43 +01:00
|
|
|
|
|
|
|
|
|
$query = "SELECT * FROM `tasks_$login` WHERE done = 0";
|
|
|
|
|
$tasks = mysqli_query($db, $query);
|
|
|
|
|
|
|
|
|
|
$query_done = "SELECT * FROM `tasks_$login` WHERE done = 1";
|
|
|
|
|
$tasks_done = mysqli_query($db, $query_done);
|
2018-12-28 20:12:00 +01:00
|
|
|
|
?>
|
2018-12-30 01:32:43 +01:00
|
|
|
|
<table>Do zrobienia
|
2018-12-28 20:12:00 +01:00
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<td>Nr</td>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
<td>Zadanie</td>
|
|
|
|
|
<td>Akcja</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<?php $i=1; while ($row = mysqli_fetch_array($tasks)) { ?>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
|
|
|
|
|
<tr>
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<td><?php echo $i; ?></td>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
<td class="task"><?php echo $row['task']; ?></td>
|
2018-12-30 01:32:43 +01:00
|
|
|
|
<td class="action">
|
|
|
|
|
<a href="delete.php?del_task=<?php echo $row['ID'];?>">x</a>
|
|
|
|
|
<a href="mark.php?mark_task=<?php echo $row['ID'];?>">v</a>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<?php i++; } ?>
|
2018-12-30 01:32:43 +01:00
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<table>Zrobione
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<td>Nr</td>
|
2018-12-30 01:32:43 +01:00
|
|
|
|
<td>Zadanie</td>
|
|
|
|
|
<td>Akcja</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<?php $i=1; while ($row = mysqli_fetch_array($tasks_done)) { ?>
|
2018-12-30 01:32:43 +01:00
|
|
|
|
|
|
|
|
|
<tr>
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<td><?php echo $i; ?></td>
|
2018-12-30 01:32:43 +01:00
|
|
|
|
<td class="task"><?php echo $row['task']; ?></td>
|
|
|
|
|
<td class="action">
|
|
|
|
|
<a href="delete.php?del_task=<?php echo $row['ID'];?>">x</a>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
2018-12-30 02:09:12 +01:00
|
|
|
|
<?php $i++; } ?>
|
2018-12-28 20:12:00 +01:00
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<?php
|
2018-11-27 18:56:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_SESSION['zalogowany']==false): ?>
|
|
|
|
|
|
|
|
|
|
<form method="POST" action="index.php">
|
|
|
|
|
<b>Login:</b> <input type="text" name="login"><br>
|
2018-12-28 20:57:43 +01:00
|
|
|
|
<b>Hasło:</b> <input type="password" name="password"><br>
|
2018-11-27 18:56:59 +01:00
|
|
|
|
<input type="submit" value="Zaloguj" name="loguj">
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------
|
|
|
|
|
|
2018-12-30 16:28:22 +01:00
|
|
|
|
<form method="POST" action="nowe_konto.php">
|
2018-11-27 18:56:59 +01:00
|
|
|
|
<input type="submit" value="Rejestracja nowego konta">
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
endif;
|
|
|
|
|
mysql_close();
|
|
|
|
|
?>
|