-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeed.php
81 lines (60 loc) · 2.46 KB
/
feed.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
<?php
session_start();
include 'database.php';
include 'common.php';
?>
<?php
if(isset($_POST['addImage'])){
//store image
$title = $_POST['title'];
$filename = $_FILES["image"]["name"];
$tempname = $_FILES["image"]["tmp_name"];
$folder = "images/post/".$filename;
$user = $_SESSION['logUserId'];
move_uploaded_file($tempname, $folder);
mysqli_query($con,"INSERT INTO feed(title,image,user) VALUES ('$title','$filename','$user')");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Friends</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
<div style='' class='navigation nav' >
<a href='index.php'>Home</a>
<?php if(!isset($_SESSION['friendslogin'])){ ?> <a class='' href='registration.php'>Registration</a> <?php } ?>
<a class='' href='members.php'>Members</a>
<?php if(isset($_SESSION['friendslogin'])){ ?>
<a class='selected' href='feed.php'>Feed</a>
<a class='' href='friends.php'>Friend List</a>
<a class='' href='chat.php'>Messages</a>
<a class='' href='profile.php'>Profile</a>
<a class='' href='?logout=true'>Logout</a> <?php } ?>
</div>
<div class="container col-lg-8 col-offset-2" style="border:solid 2px #3345;margin-top: 60px;padding: 20px;">
<h5>Add Image</h5>
<div class="col-lg-6">
<form method="post" action="" enctype="multipart/form-data">
<input required name="image" class="form-control" type="file">
<input required placeholder="Image Caption" name="title" class="form-control" type="text"><br>
<button type="submit" name="addImage" class="btn btn-success">Upload</button>
</form>
</div>
<hr>
<h2>Feed</h2>
<?php
include 'get-feed.php';
?>
</div>
<div class="footer col-lg-12" style="margin-top: 100px;text-align: left;;width: 100%;">
<div class="col-lg-12">
</div>
<div class="col-lg-12">
</div>
</div>
</body>
</html>