-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathposts.php
More file actions
executable file
·40 lines (35 loc) · 901 Bytes
/
Copy pathposts.php
File metadata and controls
executable file
·40 lines (35 loc) · 901 Bytes
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
<?php
include_once 'config.php';
if(isset($_POST['btn-postadd'])){
$title = trim($_POST['title']);
$text = trim($_POST['text']);
$author = $_SESSION['activeuser'];
$image = $_FILES['image']['name'];
$image = "/images/$image";
move_uploaded_file($_FILES['image']['tmp_name'],$image);
$post->AddPost($title,$text,$author,$image);
header('location:home.php');
}
?>
<html>
<head>
<?php $template->bootstrap(); ?>
</head>
<body>
<nav class="navbar navbar-default navbar-static-top">
<div class="container-fluid">
<?php $template->menu(); ?>
</div>
</nav>
<h3>Add Post</h3>
<div class="form">
<form method="post" enctype="multipart/form-data">
Image: <input type="file" name="image"><br>
Title: <input type="text" name="title"><br>
Text: <input type="text" name="text"><br>
<button type="submit" name="btn-postadd">Submit</button>
</form>
</div>
</body>
<?php $template->bootstrap_footer(); ?>
</html>