ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/salemgovtitialumni.in/dashboard/admin/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/salemgovtitialumni.in/dashboard/admin/history-edit.php

<?php require_once('header.php'); ?>


<style>
    .cke_notification_warning {
    background: #c83939;
    border: 1px solid #902b2b;
    display: none;
}
</style>

<?php


if(isset($_GET['content_type']) && $_GET['content_type'] != ''){
	    
	    $content_type_id = $_GET['content_type'];
	    
	    if($content_type_id==1){
            $page_name = 'ITI History';
            $condition = ' AND id=1 AND content_type=1';
        }else if($content_type_id==2){
            $page_name = 'Vision';
            $condition = ' AND id=2 AND content_type=2';
        }else if($content_type_id==4){
            $page_name = 'Alumni History';
            $condition = ' AND id=4 AND content_type=4';
        }else if($content_type_id==5){
            $page_name = 'Alumni About';
            $condition = ' AND id=5 AND content_type=5';
        }else{
            $page_name = 'Mission';
            $condition = ' AND id=3 AND content_type=3';
        }
	    
	}



if(isset($_POST['form1'])) {
	$valid = 1;
	$ids = $_REQUEST['id'];
	
	
	


	
	
	
	

	if(empty($_POST['content'])) {
		$valid = 0;
		$error_message .= 'content can not be empty<br>';
	}

	if($valid == 1) {
	    
	    $content = $_POST['content'];


        $statement = $pdo->prepare("UPDATE tbl_content SET content=? WHERE id=?");
    	$statement->execute(array($content,$ids));
		
		} 
			   

    	    $success_message = $page_name.' is updated successfully!';
	}

?>

<?php
if(!isset($_REQUEST['id'])) {
	header('location: logout.php');
	exit;
} else {
	// Check the id is valid or not
	$statement = $pdo->prepare("SELECT * FROM tbl_content WHERE id=?");
	$statement->execute(array($_REQUEST['id']));
	$total = $statement->rowCount();
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);
	if( $total == 0 ) {
		header('location: logout.php');
		exit;
	}
}
?>

<section class="content-header">
	<div class="content-header-left">
		<h1>Edit <?= $page_name ?></h1>
	</div>
	<div class="content-header-right">
		<a href="history-list.php?id=<?=$content_type_id?>" class="btn btn-primary btn-sm">View All</a>
	</div>
</section>

<?php
$statement = $pdo->prepare("SELECT * FROM tbl_content WHERE id=?");
$statement->execute(array($_REQUEST['id']));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
	
	$content = $row['content'];
	$content_type = $row['content_type'];
}
?>

<section class="content">

	<div class="row">
		<div class="col-md-12">

			<?php if($error_message): ?>
			<div class="callout callout-danger">
				<p>
				<?php echo $error_message; ?>
				</p>
			</div>
			<?php endif; ?>

			<?php if($success_message): ?>
			<div class="callout callout-success">
				<p><?php echo $success_message; ?></p>
			</div>
			<?php endif; ?>

				<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
				<div class="box box-info">
					<div class="box-body">
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Content <span>*</span></label>
							<div class="col-sm-12">
								<textarea autocomplete="off" class="form-control" name="content" required ><?=$content?></textarea>
							</div>
						</div>
						
						<div class="form-group">
							<label for="" class="col-sm-2 control-label"></label>
							<div class="col-sm-12">
								<button t ype="submit" class="btn btn-success pull-left" name="form1">Submit</button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

</section>

<?php require_once('footer.php'); ?>


<script src="https://cdn.ckeditor.com/4.18.0/standard/ckeditor.js"></script>



<script>
$(document).ready(function() {
    // Initialize CKEditor on the textarea
    CKEDITOR.replace('content');
});
</script>

Zerion Mini Shell 1.0