���� JFIF    aewtgwgerwasdasd403WebShell
403Webshell
Server IP : 147.93.80.58  /  Your IP : 216.73.216.195
Web Server : LiteSpeed
System : Linux id-dci-web1866.main-hosting.eu 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
User : u939086737 ( 939086737)
PHP Version : 8.2.28
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/u939086737/domains/mishrahometutor.in/public_html/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/u939086737/domains/mishrahometutor.in/public_html/admin/edit-blog.php
<?php
ini_set('session.cookie_secure', '1'); // Send cookie only over HTTPS
ini_set('session.cookie_httponly', '1'); // Prevent JavaScript access to session cookie
ini_set('session.use_strict_mode', '1'); // Reject uninitialized session IDs
ini_set('session.cookie_samesite', 'Strict'); // Prevent cross-site request
session_start();
if (!isset($_SESSION['admin_id'])) {
	header("Location: ./");
	exit;
}
include '../action/config.php';


if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
	die("Invalid blog ID.");
}

$id = $_GET['id'];

try {
	$stmt = $pdo->prepare("SELECT * FROM blogs WHERE id = :id");
	$stmt->execute([':id' => $id]);
	$blog = $stmt->fetch(PDO::FETCH_ASSOC);

	if (!$blog) {
		die("Blog not found.");
	}
} catch (PDOException $e) {
	die("Database error: " . $e->getMessage());
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
	$title = $_POST['title'];
	$slug = $_POST['slug'];
	$content = $_POST['content'];
	$meta_title = $_POST['meta_title'];
	$meta_description = $_POST['meta_description'];
	$meta_keywords = $_POST['meta_keywords'];
	$status = $_POST['status'];

	$old_image = $_POST['old_image'];
	$image_url = $old_image; // Keep old image by default

	// Handle image upload
	if (!empty($_FILES['image']['name'])) {
		$imageName = time() . '_' . basename($_FILES['image']['name']);
		$new_image_path = $imageUploadPath . $imageName;

		if (move_uploaded_file($_FILES['image']['tmp_name'], $new_image_path)) {
			if (file_exists($imageUploadPath . $old_image)) {
				unlink($imageUploadPath . $old_image);
			}
			$image_url = $imageName;
		}
	}

	try {
		$sql = "UPDATE blogs SET title = :title, slug = :slug, image_url = :image_url, content = :content, meta_title = :meta_title, 
                meta_description = :meta_description, meta_keywords = :meta_keywords, status = :status WHERE id = :id";
		$stmt = $pdo->prepare($sql);
		$stmt->execute([
			':title' => $title,
			':slug' => $slug,
			':content' => $content,
			':image_url' => $image_url,
			':meta_title' => $meta_title,
			':meta_description' => $meta_description,
			':meta_keywords' => $meta_keywords,
			':status' => $status,
			':id' => $id
		]);

		header("Location: blogs?msg=Blog-updated-successfully");
		exit;
	} catch (PDOException $e) {
		die("Database error: " . $e->getMessage());
	}
}



?>
<!doctype html>
<html lang="en" class="semi-dark">

<head>
	<!-- Required meta tags -->
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!--favicon-->
	<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
	<!--plugins-->
	<link href="assets/plugins/notifications/css/lobibox.min.css" rel="stylesheet" />
	<link href="assets/plugins/vectormap/jquery-jvectormap-2.0.2.css" rel="stylesheet" />
	<link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
	<link href="assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
	<link href="assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
	<!-- loader-->
	<link href="assets/css/pace.min.css" rel="stylesheet" />
	<script src="assets/js/pace.min.js"></script>
	<!-- Bootstrap CSS -->
	<link href="assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="assets/css/bootstrap-extended.css" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&amp;display=swap" rel="stylesheet">
	<link href="assets/css/app.css" rel="stylesheet">
	<link href="assets/css/icons.css" rel="stylesheet">
	<!-- Theme Style CSS -->
	<link rel="stylesheet" href="assets/css/dark-theme.css" />
	<link rel="stylesheet" href="assets/css/semi-dark.css" />
	<link rel="stylesheet" href="assets/css/header-colors.css" />
	<title><?= $page . " | " . $shop ?> </title>

	<style>
		img#imagePreview {
			max-width: 100%;
			max-height: 300px;
			margin-top: 10px;
		}

		.form-label {
			margin-bottom: 0;
		}
	</style>
</head>

<body>
	<!--wrapper-->
	<div class="wrapper">
		<?php include './header.php' ?>

		<!--start page wrapper -->
		<div class="page-wrapper">
			<div class="page-content">
				<!--breadcrumb-->
				<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
					<div class="ps-3">
						<nav aria-label="breadcrumb">
							<ol class="breadcrumb mb-0 p-0">
								<li class="breadcrumb-item"><a href="./dashboard"><i class="bx bx-home-alt"></i></a></li>
								<li class="breadcrumb-item"><a href="./blogs">Blogs</a></li>
								<li class="breadcrumb-item active" aria-current="page"><?= $page ?></li>
							</ol>
						</nav>
					</div>
				</div>
				<!--end breadcrumb-->

				<div class="row">
					<div class="col-lg-8 p-4" style="border:1px solid red; border-radius: 10px;">

						<div class="card card-header text-center">
							<b class="text-danger"><?= (isset($error_msg) ? $error_msg : '') ?></b>
							<b class="text-success"><?= (isset($success_msg) ? $success_msg : '') ?></b>
						</div>

						<!-- <form class="" id="blogForm" method="POST" enctype="multipart/form-data">
							<div class="mb-3">
								<label for="title" class="form-label">Title</label>
								<input type="text" class="form-control" id="title" name="title" required>
							</div>
							<div class="mb-3">
								<label for="slug" class="form-label">Slug</label>
								<input type="text" class="form-control" id="slug" name="slug" readonly required>
							</div>
							<div class="mb-3">
								<label for="content" class="form-label">Content</label>
								<textarea class="form-control" id="content" name="content" required></textarea>
							</div>
							<div class="mb-3">
								<label for="image" class="form-label">Feature Image</label>
								<input type="file" class="form-control" id="image" name="image" accept="image/*" required>
								<img id="imagePreview" alt="Image Preview" />
							</div>
							<div class="mb-3">
								<label for="metaTitle" class="form-label">Meta Title</label>
								<input type="text" class="form-control" id="metaTitle" name="meta_title" maxlength="255" required>
							</div>
							<div class="mb-3">
								<label for="metaDescription" class="form-label">Meta Description</label>
								<textarea class="form-control" id="metaDescription" name="meta_description" maxlength="500" required></textarea>
							</div>
							<div class="mb-3">
								<label for="metaKeywords" class="form-label">Meta Keywords</label>
								<input type="text" class="form-control" id="metaKeywords" name="meta_keywords" placeholder="e.g., blog, tutorial, PHP" required>
							</div>
							<div class="mb-3">
								<label for="author" class="form-label">Author</label>
								<input type="text" class="form-control" id="author" name="author" value="Admin" required>
							</div>
							<button type="submit" name="add_blog_type" value="draft" class="btn btn-info">Save Draft</button> &nbsp;
							<button type="submit" name="add_blog_type" value="save-and-publish" class="btn btn-success">Save & Publish</button>
						</form> -->



						<form method="POST" enctype="multipart/form-data">
							<input type="hidden" name="old_image" value="<?= $blog['image_url'] ?>">
							<div class="mb-3">
								<label for="title" class="form-label">Title</label>
								<input type="text" class="form-control" id="title" name="title" value="<?= htmlspecialchars($blog['title']); ?>" required>
							</div>
							<div class="mb-3">
								<label for="slug" class="form-label">Slug</label>
								<input type="text" class="form-control" id="slug" name="slug" value="<?= htmlspecialchars($blog['slug']); ?>" readonly required>
							</div>

							<div class="mb-3">
								<label>Current Image:</label><br>
								<img src="<?= $imageUploadPath . $blog['image_url'] ?>" width="200">
							</div>

							<div class="mb-3">
								<label>New Image (optional):</label>
								<input type="file" name="image" class="form-control" accept=".jpg, .jpeg, .png">
							</div>


							<div class="mb-3">
								<label for="content" class="form-label">Content</label>
								<textarea class="form-control" id="content" name="content"><?= htmlspecialchars($blog['content']); ?></textarea>
							</div>
							<div class="mb-3">
								<label for="metaTitle" class="form-label">Meta Title</label>
								<input type="text" class="form-control" id="metaTitle" name="meta_title" value="<?= htmlspecialchars($blog['meta_title']); ?>" required>
							</div>
							<div class="mb-3">
								<label for="metaDescription" class="form-label">Meta Description</label>
								<textarea class="form-control" id="metaDescription" name="meta_description"><?= htmlspecialchars($blog['meta_description']); ?></textarea>
							</div>
							<div class="mb-3">
								<label for="metaKeywords" class="form-label">Meta Keywords</label>
								<input type="text" class="form-control" id="metaKeywords" name="meta_keywords" value="<?= htmlspecialchars($blog['meta_keywords']); ?>" required>
							</div>

							<div class="mb-3">
								<label for="status" class="form-label">Status</label>
								<select name="status" id="status" class="form-control" required>
									<option value="<?= $blog['status']; ?>" selected><?= ucfirst($blog['status']); ?></option>
									<option value="">--Select Option---</option>
									<option value="draft">Draft</option>
									<option value="published">Published</option>
								</select>
							</div>

							<button type="submit" class="btn btn-primary">Update</button>
							<a href="blogs.php" class="btn btn-secondary">Cancel</a>
						</form>







					</div>
				</div>
			</div>
		</div>

		<?php include './footer.php' ?>
	</div>
	<!--end wrapper-->


	<!-- Bootstrap JS -->
	<script src="assets/js/bootstrap.bundle.min.js"></script>
	<!--plugins-->
	<script src="assets/js/jquery.min.js"></script>
	<script src="assets/plugins/simplebar/js/simplebar.min.js"></script>
	<script src="assets/plugins/metismenu/js/metisMenu.min.js"></script>
	<script src="assets/plugins/perfect-scrollbar/js/perfect-scrollbar.js"></script>
	<script src="assets/plugins/vectormap/jquery-jvectormap-2.0.2.min.js"></script>
	<script src="assets/plugins/vectormap/jquery-jvectormap-world-mill-en.js"></script>
	<script src="assets/plugins/chartjs/js/chart.js"></script>
	<script src="assets/plugins/sparkline-charts/jquery.sparkline.min.js"></script>
	<!--notification js -->
	<script src="assets/plugins/notifications/js/lobibox.min.js"></script>
	<script src="assets/plugins/notifications/js/notifications.min.js"></script>
	<script src="assets/js/index3.js"></script>
	<!--app JS-->
	<script src="assets/js/app.js"></script>
	<script src="https://cdn.ckeditor.com/4.21.0/standard/ckeditor.js"></script>
	<script>
		// Initialize CKEditor for content editing
		CKEDITOR.replace('content');

		// Generate slug automatically
		document.getElementById('title').addEventListener('input', function() {
			const title = this.value;
			const slug = title.toLowerCase()
				.replace(/[^a-z0-9\s-]/g, '') // Remove invalid characters
				.replace(/\s+/g, '-') // Replace spaces with hyphens
				.replace(/-+/g, '-'); // Replace multiple hyphens with single
			document.getElementById('slug').value = slug;
		});

		// Image preview
		document.getElementById('image').addEventListener('change', function() {
			const file = this.files[0];
			if (file) {
				const reader = new FileReader();
				reader.onload = function(e) {
					document.getElementById('imagePreview').src = e.target.result;
				};
				reader.readAsDataURL(file);
			}
		});
	</script>
</body>


</html>

Youez - 2016 - github.com/yon3zu
LinuXploit