mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2025-05-29 14:53:12 +00:00
Normalising names of tables
This commit is contained in:
parent
1472692ed5
commit
32e6a356a3
4 changed files with 9 additions and 9 deletions
|
@ -97,7 +97,7 @@ class Image {
|
||||||
*/
|
*/
|
||||||
function get_image_info($conn, $id) {
|
function get_image_info($conn, $id) {
|
||||||
// Setting SQL query
|
// Setting SQL query
|
||||||
$sql = "SELECT * FROM swag_table WHERE id = ".$id;
|
$sql = "SELECT * FROM images WHERE id = ".$id;
|
||||||
// Getting results
|
// Getting results
|
||||||
$query = mysqli_query($conn, $sql);
|
$query = mysqli_query($conn, $sql);
|
||||||
// Fetching associated info
|
// Fetching associated info
|
||||||
|
|
|
@ -27,7 +27,7 @@ if (isset($_POST['submit_delete'])) {
|
||||||
// If user owns image or has the ID of 1
|
// If user owns image or has the ID of 1
|
||||||
if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) {
|
if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) {
|
||||||
// Delete from table
|
// Delete from table
|
||||||
$sql = "DELETE FROM swag_table WHERE id = ?";
|
$sql = "DELETE FROM images WHERE id = ?";
|
||||||
if ($stmt = mysqli_prepare($conn, $sql)) {
|
if ($stmt = mysqli_prepare($conn, $sql)) {
|
||||||
mysqli_stmt_bind_param($stmt, "i", $param_id);
|
mysqli_stmt_bind_param($stmt, "i", $param_id);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ if (isset($_POST['submit_description'])) {
|
||||||
// If user owns image or has the ID of 1
|
// If user owns image or has the ID of 1
|
||||||
if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) {
|
if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) {
|
||||||
// getting ready forSQL asky asky
|
// getting ready forSQL asky asky
|
||||||
$sql = "UPDATE swag_table SET alt=? WHERE id=?";
|
$sql = "UPDATE images SET alt=? WHERE id=?";
|
||||||
|
|
||||||
// Checking if databse is doing ok
|
// Checking if databse is doing ok
|
||||||
if ($stmt = mysqli_prepare($conn, $sql)) {
|
if ($stmt = mysqli_prepare($conn, $sql)) {
|
||||||
|
@ -161,7 +161,7 @@ if (isset($_POST['submit_tags'])) {
|
||||||
$tags_string = $make_stuff->tags(trim($_POST['input']));
|
$tags_string = $make_stuff->tags(trim($_POST['input']));
|
||||||
|
|
||||||
// getting ready forSQL asky asky
|
// getting ready forSQL asky asky
|
||||||
$sql = "UPDATE swag_table SET tags=? WHERE id=?";
|
$sql = "UPDATE images SET tags=? WHERE id=?";
|
||||||
|
|
||||||
// Checking if databse is doing ok
|
// Checking if databse is doing ok
|
||||||
if ($stmt = mysqli_prepare($conn, $sql)) {
|
if ($stmt = mysqli_prepare($conn, $sql)) {
|
||||||
|
@ -217,7 +217,7 @@ if (isset($_POST['submit_author'])) {
|
||||||
// If user has the ID of 1
|
// If user has the ID of 1
|
||||||
if ($user_info->is_admin($_SESSION['id'])) {
|
if ($user_info->is_admin($_SESSION['id'])) {
|
||||||
// getting ready forSQL asky asky
|
// getting ready forSQL asky asky
|
||||||
$sql = "UPDATE swag_table SET author=? WHERE id=?";
|
$sql = "UPDATE images SET author=? WHERE id=?";
|
||||||
|
|
||||||
// Checking if databse is doing ok
|
// Checking if databse is doing ok
|
||||||
if ($stmt = mysqli_prepare($conn, $sql)) {
|
if ($stmt = mysqli_prepare($conn, $sql)) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ if (isset($_POST['submit'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare sql for destruction and filtering the sus
|
// Prepare sql for destruction and filtering the sus
|
||||||
$sql = "INSERT INTO swag_table (imagename, alt, tags, author) VALUES (?, ?, ?, ?)";
|
$sql = "INSERT INTO images (imagename, alt, tags, author) VALUES (?, ?, ?, ?)";
|
||||||
|
|
||||||
if ($stmt = mysqli_prepare($conn, $sql)) {
|
if ($stmt = mysqli_prepare($conn, $sql)) {
|
||||||
// Bind the smelly smelly
|
// Bind the smelly smelly
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__."/ui/required.php";
|
require_once __DIR__."/ui/required.php";
|
||||||
require_once __DIR__."/ui/nav.php";
|
require_once __DIR__."/ui/nav.php";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -55,7 +55,7 @@ require_once __DIR__."/ui/nav.php";
|
||||||
<div class="gallery-root">
|
<div class="gallery-root">
|
||||||
<?php
|
<?php
|
||||||
// Reading images from table
|
// Reading images from table
|
||||||
$image_request = mysqli_query($conn, "SELECT * FROM swag_table ORDER BY id DESC");
|
$image_request = mysqli_query($conn, "SELECT * FROM images ORDER BY id DESC");
|
||||||
|
|
||||||
while ($image = mysqli_fetch_array($image_request)) {
|
while ($image = mysqli_fetch_array($image_request)) {
|
||||||
// Getting thumbnail
|
// Getting thumbnail
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue