Zaktualizuj 'index.php'
This commit is contained in:
parent
713e38b120
commit
2adfbb6752
48
index.php
48
index.php
@ -8,13 +8,6 @@ mysql_select_db("$db_name");
|
|||||||
|
|
||||||
$db = mysqli_connect("$db_servername", "$db_login_tasks", "$db_password_tasks", "$db_name_tasks");
|
$db = mysqli_connect("$db_servername", "$db_login_tasks", "$db_password_tasks", "$db_name_tasks");
|
||||||
|
|
||||||
if (isset($_POST["submit"]) && $_SESSION['zalogowany'] = true) {
|
|
||||||
$task = $_POST["task"];
|
|
||||||
$login = $_SESSION['login'];
|
|
||||||
mysqli_query($db, "INSERT INTO `tasks_$login` (task) VALUES ('$task')");
|
|
||||||
header('location: index.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
@ -52,16 +45,20 @@ if ($_SESSION['zalogowany']==true)
|
|||||||
echo "Zalogowano jako <b>".$_SESSION['login']."</b>"; echo '<a href="?wyloguj=1"> [Wyloguj]</a>';
|
echo "Zalogowano jako <b>".$_SESSION['login']."</b>"; echo '<a href="?wyloguj=1"> [Wyloguj]</a>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form method="POST" action="index.php">
|
<form method="POST" action="add.php">
|
||||||
<input type="text" name="task" class="task_input">
|
<input type="text" name="task" class="task_input">
|
||||||
<input type="submit" value="Dodaj zadanie" name="submit">
|
<input type="submit" value="Dodaj zadanie" name="submit">
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
$login = $_SESSION['login'];
|
$login = $_SESSION['login'];
|
||||||
$zapytanie = "SELECT * FROM `tasks_$login` ";
|
|
||||||
$tasks = mysqli_query($db, $zapytanie);
|
$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);
|
||||||
?>
|
?>
|
||||||
<table>
|
<table>Do zrobienia
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Numer</td>
|
<td>Numer</td>
|
||||||
@ -75,8 +72,33 @@ if ($_SESSION['zalogowany']==true)
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row['ID']; ?></td>
|
<td><?php echo $row['ID']; ?></td>
|
||||||
<td class="task"><?php echo $row['task']; ?></td>
|
<td class="task"><?php echo $row['task']; ?></td>
|
||||||
<td class="delete">
|
<td class="action">
|
||||||
<a href=#>USUN</a>
|
<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>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table>Zrobione
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Numer</td>
|
||||||
|
<td>Zadanie</td>
|
||||||
|
<td>Akcja</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php while ($row = mysqli_fetch_array($tasks_done)) { ?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $row['ID']; ?></td>
|
||||||
|
<td class="task"><?php echo $row['task']; ?></td>
|
||||||
|
<td class="action">
|
||||||
|
<a href="delete.php?del_task=<?php echo $row['ID'];?>">x</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user