-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile.php
116 lines (109 loc) · 3.87 KB
/
profile.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
include 'db.php';
include 'auth.php'
?>
<?php
session_start();
$query ='SELECT * FROM messages ORDER BY create_date DESC';
$messages =mysqli_query($con,$query);
if(isset($_GET['action']) ){
if($_GET['action'] == 'lo'){
session_destroy();
}
}
if(isset($_GET['action']) && isset($_GET['id'])){
if($_GET['action'] == 'delete'){
$id = $_GET['id'];
$query = "DELETE FROM messages WHERE id = $id";
if(!mysqli_query($con, $query)){
die(mysqli_error($con));
} else {
header("Location: profile.php?success=Message%20Removed");
}
}
}
if(isset($_GET['success'])){
$success = $_GET['success'];
}
?>
<!Doctype html>
<html>
<head>
<title>Confession Box</title>
<link rel="stylesheet" href="css/pi.css">
</head>
<body oncopy="return false" oncut="return false" onpaste="return false">
<center>
<div class="navbar">
<a href="profile.php" id="demo"></a>
<a class="si" id="demo1" href="login.php?action=lo">(Log Out)</a>
<a class="arm" id="demo2">HEY  <?php echo $_SESSION['uname']; ?></a>
</div>
</center>
<div class="container">
<header>
<?php if(isset($success)):?>
<div class="alert"><?php echo $success; ?></div>
<?php endif;?>
</header><br>
<div class="main">
<form method="post" action="process.php">
<textarea rows="15" cols="45" name="text" oncopy="return false" onpaste="return false" placeholder="Type your Confession No-One Can See your Identity" required></textarea><br><br>
<button class="bu"><span>CONFESSED</span></button>
</form>
</div>
<div class="aside">
<?php while($row = mysqli_fetch_assoc($messages)) : ?>
<div class="article-card-container">
<div class="article-card">
<div class="author">                                        <?php if($_SESSION['use']==$row['username']):?><a class="cr" href="profile.php?action=delete&id=<?php echo $row['id'];?>">X</a><?php endif; ?>
<div class="user-avatar">
<div class="user-name">
<?php echo $row['user'];?>
</div>
<div class="written-date"><?php echo $row['create_date'];?></div>
</div>           
<div class="content-image">
<img src="http://lorempixel.com/400/200"/>
</div>
<div class="content-text">
<?php echo $row['text']; ?>
</div>
<div class="article-footer">
<div class="views part">
<ion-icon name="eye"></ion-icon>
<span class="count-text">150</span>
</div>
<div class="likes part">
<ion-icon name="heart-empty"></ion-icon>
<span class="count-text">
124
</span>
</div>
<div class="comments part">
<ion-icon name="share"></ion-icon></ion-icon>
<span class="count-text">245</span>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
</ul>
</div>
<script src="https://unpkg.com/ionicons@4.5.5/dist/ionicons.js"></script>
<script>
var i = 0;
var txt = 'Confession Box';
var speed = 300;
window.onload = function(){
if (i < txt.length) {
document.getElementById("demo").innerHTML += txt.charAt(i);
i++;
setTimeout(window.onload,speed);
}
}
</script>
</body>
</html>
</!Doctype>