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/link-add.php

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

<?php
if(isset($_POST['submit'])) {
	$valid = 1;

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


 $path = $_FILES['photo']['name'];
    $path_tmp = $_FILES['photo']['tmp_name'];

    if($path!='') {
        $ext = pathinfo( $path, PATHINFO_EXTENSION );
        $file_name = basename( $path, '.' . $ext );
        
        $final_name = 'service-'.$_REQUEST['id'].'.'.$ext;
        	move_uploaded_file( $path_tmp, '../assets/uploads/important/'.$final_name );
            $image_path ='assets/uploads/important/'.$final_name;

        
    }
         else {
    	$valid = 0;
        $error_message .= 'You must have to select a File<br>';
    }

	if($valid == 1) {

	
		$statement = $pdo->prepare("INSERT INTO tbl_important_links (name, image, type) VALUES (?,?,?)");
		$statement->execute(array($_POST['title'], $image_path, $_POST['type']));
			
		$success_message = 'Important  Links is added successfully!';

	}
}
?>

<?php
        $statement_important = $pdo->prepare("SELECT * FROM tbl_important_links WHERE status=1;");
        $statement_important->execute();
        $important_result = $statement_important->fetchAll(PDO::FETCH_ASSOC);
        $important_total = $statement_important->rowCount(); 
    	?>
    	
<section class="content-header">
	<div class="content-header-left">
		<h1>Add Imporatant Link</h1>
	</div>
	<div class="content-header-right">
		<a href="important-links.php" class="btn btn-primary btn-sm">View All</a>
	</div>
</section>


<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">Name <span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="title" value="" required>
							</div>
						</div>
						
						
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Sponser Name <span>*</span></label>
							<div class="col-sm-6">
								<select name="type" id="type" class="form-select valid font-size12 select2" style="width: 100%;" required>
        							<option value="1" >Upcoming Events</option>
        							<option value="2" >Annual Reports</option>
                                </select>
							</div>
						</div>
						
						
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Source <span>*</span></label>
							<div class="col-sm-9" style="padding-top:5px">
								<input type="file" name="photo" class="">
							</div>
						</div>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label"></label>
							<div class="col-sm-6">
								<button type="submit" class="btn btn-success pull-left" name="submit">Submit</button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

</section>

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

Zerion Mini Shell 1.0