-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditcomment.php
More file actions
153 lines (143 loc) · 3.93 KB
/
editcomment.php
File metadata and controls
153 lines (143 loc) · 3.93 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<?php
session_start();
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: avlogin.php");
exit;
}
date_default_timezone_set('Europe/Copenhagen');
include 'dbh.inc.php';
include 'comment.inc.php';
?>
<!--responsive navbar-->
<script type="text/javascript">
function myfun(){
var x= document.getElementById("topnav");
if(x.className==="topnav"){
x.className+="responsive";
} else{
x.className="topnav";
}
}
</script>
<link rel="stylesheet" type="text/css" href="signupCSS.html">
<style type="text/css">
body{
background-color: #ddd;
}
textarea {
width: 500px;
height: 50px;
background-color: #fff;
resize: none;
}
button{
width: 80px;
height: 25px;
background-color: #282828;
border:none;
color: #fff;
cursor: pointer;
margin-bottom: 60px;
}
.comment-box{
width: 815px;
padding:20px;
margin-bottom: 4px;
background: white;
border-radius:4px;
position: relative;
}
.comment-box p{
font-family: arial;
font-size: 14px;
line-height: 16px;
color: #282828;
font-weight:100;
}
.edit-form{
position:absolute;
top:0px;
right:0px;
}
.edit-form button{
width: 40px;
height: 20px;
color: #282828;
background-color: #fff;
opacity: 0.7;
}
.edit-form button:hover{
opacity:1;
}
.delete-form{
position:absolute;
top: 0px;
left:750px;
}
.delete-form button{
width: 40px;
height: 20px;
color: #282828;
background-color: #fff;
opacity: 0.7;
}
.delete-form button:hover{
opacity:1;
}
</style>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<!--Nav bar-->
<div class='container-fluid'>
<div id='topnav' class='topnav'>
<label id='titl' class='logo'>AllAsk</label>
<div class='topnav'>
<a href='logout.php'>Log Out</a>
<a href='myindex.php'>Profile</a>
<a href='index.php'>Home</a>
<a href='#' onclick='myfun()' class='icon'><i class='fa fa-bars'></i></a>
</div>
</div><br>
<?php
//information of user and comment to be editted
$cid=$_POST['cid'];
$uid=$_SESSION['username'];
$date=$_POST['date'];
$message=$_POST['message'];
//profile picture and username section
$id=$_SESSION['username'];
$sql="SELECT * FROM users WHERE username='$id'";
$result=mysqli_query($conn,$sql);
if($row=$result->fetch_assoc()){
echo "<div class='usercontainer row'>";
if ($row['status']==0) {
echo "<div class='col-md-75'><img src='uploads/profile".$id.".jpg' alt='avatar' class='avatar'>";
}
else {
echo "<div class='col-md-75'><img src='uploads/profiledefault.jpg'>";
}
echo "</div><div class='col-md-25'><p>".$id."</p></div>";
echo "</div>";
}
//edit comment text area to edit and submit the comment
echo "<div class='ask'>Edit Question?</div>";
echo " <form method='POST' action='".editcomments($conn,$uid)."'>
<input type='hidden' name='cid' value='".$cid."'>
<input type='hidden' name='uid' value='".$uid."'>
<input type='hidden' name='date' value='".$date."'>
<textarea name='message'>".$message."</textarea><br>
<button type='submit' name='editSubmit'>Edit</button>
</form>" ;
?>
<hr>
<center>
<footer class='foot'>Designed & Developed By Backlog_69</footer>
</center>
</body>
</html>