-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
65 lines (61 loc) · 2.21 KB
/
home.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
<!DOCTYPE html>
<?php
include('firebase.php');
include_once('includes.php');
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
session_start();
if(!isset($_SESSION["user"])){
$_SESSION["user"] = "invalid";
header("Location: index.php");
}
$user = stripper($_SESSION["user"]);
if($user == "invalid" || $user == "" || isset($_POST["logout"])) {
$_SESSION["user"] = "invalid";
header("Location: index.php");
}
?>
<html>
<head>
<link href="posting.css" rel="stylesheet">
<link href="general.css" rel="stylesheet">
</head>
<body>
<?php
include('navbar.php');
?>
<h4 class="alert alert-info alert-dismissible fade show" role="alert">
Welcome, <strong><?php echo readByKey("displayName", getUserData($firebase, $user), $user); ?></strong>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
</h4>
<div class="content">
<form action="home.php" method="POST">
<h3 class="full-width">New Post:</h3>
<textarea class="full-width" name="post" placeholder="Post here:"></textarea>
<input class='butt btn btn-primary btn-sm btn-block' type="submit" value="Post!" name="submit"/>
</form>
<?php
if(isset($_POST["submit"])) {
$post = $_POST["post"];
submitPost($firebase, $user, $post);
}
?>
<h3 class="full-width">Your Posts:</h3>
<div class="posting-container grid">
<?php
if(isset($_POST["remove"])) {
$num = preg_replace('/[^0-9]/', '', $_POST["whichpost"]);
removePost($firebase, $num, $user);
}
include("feed.php");
include("posting.php");
$posts = feed($firebase, $user);
#echo json_encode($posts);
postings($posts, $user, $firebase);
if(empty($posts)){
echo "Your feed is empty";
}
?>
</div>
</div>
<body>
<html>