-
Notifications
You must be signed in to change notification settings - Fork 0
/
logowanie.php
62 lines (59 loc) · 1.75 KB
/
logowanie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html lang="pl">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main-welcome">
<h1>Witaj na blogu!</h1>
<p style="text-align:center;">Zalogowano jako: <?php
include 'config.php';
echo $_SESSION['user'];
?></p>
</div>
<a href="wyloguj.php"><div id="wyl">
<p style="color: white; text-align: center;">Wyloguj się</p>
</div></a>
<a href="add.php" id="a1">
<div id="block">
<p id="block1" >Kliknij aby dodać wpis.</p>
</div>
</a>
<h1>WPISY</h1>
<p id="old_nr" style="display:none"></p>
<p id="new_nr" style="display:none"></p>
<?php
class Wpisy
{
public function wypisz(){
global $conn;
$q='SELECT * FROM wpisy';
$result=$conn->query($q);
echo '<div id="m-table"><table>';
while($obj=$result->fetch_object())
{
echo '<tr><td>'.$obj->Nick.'</td><td>'.$obj->temat.'</td><td>'.$obj->text.'</td><td>'.$this->sprawdz($obj->Nick,$_SESSION['user'],$obj->id).'</td></tr>';
}
echo '</table></div>';
}
public function sprawdz($nick1,$nick2,$id)
{
$id1=$id;
if($nick1==$nick2){
return "<form action='usun.php' method='post'><input name='usun1' type='hidden' value=".$id1."><input type='submit' name='usun' value='Usuń'></form>";
}
else{
return '';
}
}
}
$w1=new Wpisy();
$w1->wypisz();
?>
<br/>
<footer>
<a href="https://github.com/zdinozi" target="_blank"><img src="github-ww.png" style="width: 50px; height: 50px;"></a>
<a href="https://www.linkedin.com/in/wiktor-banasiak-672425222/" target="_blank"><img src="linkedin.png" style="width: 50px; height: 50px;"></a>
</footer>
</body>
</html>