Skip to content

Commit a94beaa

Browse files
Add files via upload
1 parent 4d0ec57 commit a94beaa

File tree

95 files changed

+4157
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4157
-0
lines changed

admin/add_album.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
include "header.php";
3+
4+
if (isset($_POST['add'])) {
5+
$title = $_POST['title'];
6+
7+
$add_sql = mysqli_query($connect, "INSERT INTO albums (title) VALUES ('$title')");
8+
echo '<meta http-equiv="refresh" content="0; url=albums.php">';
9+
}
10+
?>
11+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
12+
<h3 class="h3"><i class="fas fa-list-ol"></i> Albums</h3>
13+
</div>
14+
15+
<div class="card">
16+
<h6 class="card-header">Add Album</h6>
17+
<div class="card-body">
18+
<form action="" method="post">
19+
<p>
20+
<label>Title</label>
21+
<input class="form-control" name="title" value="" type="text" required>
22+
</p>
23+
<div class="form-actions">
24+
<input type="submit" name="add" class="btn btn-primary col-12" value="Add" />
25+
</div>
26+
</form>
27+
</div>
28+
</div>
29+
30+
<?php
31+
include "footer.php";
32+
?>

admin/add_category.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
include "header.php";
3+
4+
if (isset($_POST['add'])) {
5+
$category = $_POST['category'];
6+
7+
$add_sql = mysqli_query($connect, "INSERT INTO categories (category) VALUES ('$category')");
8+
echo '<meta http-equiv="refresh" content="0; url=categories.php">';
9+
}
10+
?>
11+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
12+
<h3 class="h3"><i class="fas fa-list-ol"></i> Categories</h3>
13+
</div>
14+
15+
<div class="card">
16+
<h6 class="card-header">Add Category</h6>
17+
<div class="card-body">
18+
<form action="" method="post">
19+
<p>
20+
<label>Title</label>
21+
<input class="form-control" name="category" value="" type="text" required>
22+
</p>
23+
<div class="form-actions">
24+
<input type="submit" name="add" class="btn btn-primary col-12" value="Add" />
25+
</div>
26+
</form>
27+
</div>
28+
</div>
29+
30+
<?php
31+
include "footer.php";
32+
?>

admin/add_image.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
include "header.php";
3+
4+
if (isset($_POST['add'])) {
5+
$title = addslashes($_POST['title']);
6+
$active = addslashes($_POST['active']);
7+
$album_id = addslashes($_POST['album_id']);
8+
$description = htmlspecialchars($_POST['description']);
9+
10+
$image = '';
11+
12+
if (@$_FILES['avafile']['name'] != '') {
13+
$target_dir = "uploads/gallery/";
14+
$target_file = $target_dir . basename($_FILES["avafile"]["name"]);
15+
$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
16+
17+
$uploadOk = 1;
18+
19+
// Check if image file is a actual image or fake image
20+
$check = getimagesize($_FILES["avafile"]["tmp_name"]);
21+
if ($check !== false) {
22+
$uploadOk = 1;
23+
} else {
24+
echo '<div class="alert alert-danger">The file is not an image.</div>';
25+
$uploadOk = 0;
26+
}
27+
28+
// Check file size
29+
if ($_FILES["avafile"]["size"] > 10000000) {
30+
echo '<div class="alert alert-warning">Sorry, your file is too large.</div>';
31+
$uploadOk = 0;
32+
}
33+
34+
if ($uploadOk == 1) {
35+
$string = "0123456789wsderfgtyhjuk";
36+
$new_string = str_shuffle($string);
37+
$location = "../uploads/gallery/image_$new_string.$imageFileType";
38+
move_uploaded_file($_FILES["avafile"]["tmp_name"], $location);
39+
$image = 'uploads/gallery/image_' . $new_string . '.' . $imageFileType . '';
40+
}
41+
}
42+
43+
$add = mysqli_query($connect, "INSERT INTO `gallery` (album_id, title, image, description, active) VALUES ('$album_id', '$title', '$image', '$description', '$active')");
44+
echo '<meta http-equiv="refresh" content="0; url=gallery.php">';
45+
}
46+
?>
47+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
48+
<h3 class="h3"><i class="fas fa-images"></i> Gallery</h3>
49+
</div>
50+
51+
<div class="card">
52+
<h6 class="card-header">Add Image</h6>
53+
<div class="card-body">
54+
<form action="" method="post" enctype="multipart/form-data">
55+
<p>
56+
<label>Title</label>
57+
<input class="form-control" name="title" value="" type="text" required>
58+
</p>
59+
<p>
60+
<label>Image</label>
61+
<input type="file" name="avafile" class="form-control" required />
62+
</p>
63+
<p>
64+
<label>Active</label><br />
65+
<select name="active" class="form-select" required>
66+
<option value="Yes" selected>Yes</option>
67+
<option value="No">No</option>
68+
</select>
69+
</p>
70+
<p>
71+
<label>Album</label><br />
72+
<select name="album_id" class="form-select" required>
73+
<?php
74+
$crun = mysqli_query($connect, "SELECT * FROM `albums`");
75+
while ($rw = mysqli_fetch_assoc($crun)) {
76+
echo '
77+
<option value="' . $rw['id'] . '">' . $rw['title'] . '</option>
78+
';
79+
}
80+
?>
81+
</select>
82+
</p>
83+
<p>
84+
<label>Description</label>
85+
<textarea class="form-control" name="description"></textarea>
86+
</p>
87+
88+
<input type="submit" name="add" class="btn btn-primary col-12" value="Add" />
89+
</form>
90+
</div>
91+
</div>
92+
93+
<script>
94+
CKEDITOR.replace( 'description' );
95+
</script>
96+
<?php
97+
include "footer.php";
98+
?>

admin/add_menu.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
include "header.php";
3+
4+
if (isset($_POST['add'])) {
5+
$page = $_POST['page'];
6+
$path = $_POST['path'];
7+
$fa_icon = $_POST['fa_icon'];
8+
9+
$add_sql = mysqli_query($connect, "INSERT INTO menu (page, path, fa_icon) VALUES ('$page', '$path', '$fa_icon')");
10+
11+
echo '<meta http-equiv="refresh" content="0;url=menu_editor.php">';
12+
}
13+
?>
14+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
15+
<h3 class="h3"><i class="fas fa-bars"></i> Menu Editor</h3>
16+
</div>
17+
18+
<div class="card">
19+
<h6 class="card-header">Add Menu</h6>
20+
<div class="card-body">
21+
<form action="" method="post">
22+
<p>
23+
<label>Title</label>
24+
<input class="form-control" name="page" value="" type="text" required>
25+
</p>
26+
<p>
27+
<label>Path (Link)</label>
28+
<input class="form-control" name="path" value="" type="text" required>
29+
</p>
30+
<p>
31+
<label>Font Awesome 5 Icon</label>
32+
<input class="form-control" name="fa_icon" value="" type="text">
33+
</p>
34+
<div class="form-actions">
35+
<input type="submit" name="add" class="btn btn-primary col-12" value="Add" />
36+
</div>
37+
</form>
38+
</div>
39+
</div>
40+
<?php
41+
include "footer.php";
42+
?>

admin/add_page.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
include "header.php";
3+
4+
if (isset($_POST['add'])) {
5+
$title = addslashes($_POST['title']);
6+
$content = htmlspecialchars($_POST['content']);
7+
8+
$add = mysqli_query($connect, "INSERT INTO pages (title, content) VALUES ('$title', '$content')");
9+
10+
$sql2 = "SELECT * FROM pages WHERE title='$title'";
11+
$result2 = mysqli_query($connect, $sql2);
12+
$row = mysqli_fetch_assoc($result2);
13+
$id = $row['id'];
14+
$add2 = mysqli_query($connect, "INSERT INTO menu (page, path, fa_icon) VALUES ('$title', 'page.php?id=$id', 'fa-columns')");
15+
16+
echo '<meta http-equiv="refresh" content="0;url=pages.php">';
17+
}
18+
?>
19+
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
20+
<h3 class="h3"><i class="fas fa-file-alt"></i> Pages</h3>
21+
</div>
22+
23+
<div class="card">
24+
<h6 class="card-header">Add Page</h6>
25+
<div class="card-body">
26+
<form action="" method="post">
27+
<p>
28+
<label>Title</label>
29+
<input class="form-control" name="title" value="" type="text" required>
30+
</p>
31+
<p>
32+
<label>Content</label>
33+
<textarea class="form-control" name="content" required></textarea>
34+
</p>
35+
<input type="submit" name="add" class="btn btn-primary col-12" value="Add" />
36+
</form>
37+
</div>
38+
</div>
39+
40+
<script>
41+
CKEDITOR.replace( 'content' );
42+
</script>
43+
<?php
44+
include "footer.php";
45+
?>

0 commit comments

Comments
 (0)