-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfeedadd.php
More file actions
42 lines (39 loc) · 1.03 KB
/
feedadd.php
File metadata and controls
42 lines (39 loc) · 1.03 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
<?php
session_start();
include("config.php");
if(isset($_SESSION["username"])){
echo "hiii";
//echo NOW();
function test($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$t = date('Y-d-m H:i:s',time());
echo "$t";
//$query = "INSERT INTO time VALUES('$t')";
$user = test ($_SESSION["username"]);
$po= test ($_POST["feed"]);
/*function test($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}*/
if(isset($po)){
$query = "INSERT INTO shivansh_feed(username,comment,time)";
$query .= " VALUES ('$user', '$po','$t')";
$result1=$con->query($query);
echo "query added";}
echo "<hr> <br>";
$query2 ="select * from shivansh_feed";
$res=$con->query($query2);
if($res->num_rows>0){
while ($row=$res -> fetch_assoc()){
echo "feed: ".$row['comment']."<br>". $row['time']." ". $row['username']."<br><br>";
}}
header("location:./feedpage.php");}
else
echo "logged out";
?>