-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.php
38 lines (37 loc) · 1.19 KB
/
server.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
<?php
include_once ("DB.php");
$reqest=$_REQUEST['req'];
$user=$_REQUEST["u"];
$post=$_REQUEST['P'];
$id =$_REQUEST['id'];
if ($reqest!= ''){
if ($reqest=="add"){
$ins="INSERT INTO posts(user,PostText) VALUES('$user','$post')";
$run=mysqli_query($con,$ins);
}
elseif ($reqest=="del"){
$del="DELETE FROM posts WHERE ID=$id";
$run=mysqli_query($con,$del);
}
elseif ($reqest=="edit"){
$upd="UPDATE posts SET PostText='$post' WHERE ID='$id'";
$run=mysqli_query($con,$upd);
}
}
$sel="SELECT * FROM posts ORDER BY ID DESC";
$run=mysqli_query($con,$sel);
while ($row=mysqli_fetch_assoc($run)) {
?>
<div class="card-panel post">
<i class="small material-icons right " onclick="post('del',<?php echo $row["ID"]?>)">delete</i>
<!--Custom Atribute -->
<i class="small material-icons right action" data-id="<?php echo $row["ID"]?>">edit</i>
<h5><?php echo $row["user"];?></h5>
<small><i class="tiny material-icons">query_builder</i><?php echo $row["time"];?></small>
<p>
<?php echo $row["PostText"];?>
</p>
</div>
<?php
}
?>