Random Group fixes

This commit is contained in:
Michał Gdula 2022-09-25 12:01:23 +00:00
parent 8ecd3f5921
commit d8f2166a1f
8 changed files with 151 additions and 36 deletions

View file

@ -120,7 +120,7 @@ if (isset($_POST['title_submit'])) {
if (isset($_POST['new_group_submit'])) {
if ($user_info->is_loggedin()) {
$group_name = $_SESSION['username']." new image group";
$group_name = $_SESSION['username']."\'s Group";
$sql = "INSERT INTO groups (group_name, author, image_list) VALUES('$group_name', '".$_SESSION['id']."', '')";
mysqli_query($conn, $sql);

View file

@ -31,10 +31,7 @@ if (isset($_POST['submit_delete'])) {
// Delete from table
$sql = "DELETE FROM images WHERE id = ?";
if ($stmt = mysqli_prepare($conn, $sql)) {
mysqli_stmt_bind_param($stmt, "i", $param_id);
// Setting parameters
$param_id = $_POST['id'];
mysqli_stmt_bind_param($stmt, "i", $_POST['id']);
// Attempt to execute the prepared statement
if (mysqli_stmt_execute($stmt)) {
@ -52,9 +49,10 @@ if (isset($_POST['submit_delete'])) {
}
// TP user to the homepage with a success message
mysqli_query($conn,"INSERT INTO logs (ipaddress, action) VALUES('$user_ip','Deleted image ".$_POST['id']."')");
$_SESSION['del'] = $_POST['id'];
?>
<script>
window.location.replace("index.php?del=true&id=<?php echo $_POST['id']; ?>");
window.location.replace("index.php");
</script>
<?php
} else {