205CDE

<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Home</title>
	</head>
	<style>
		@media only screen and (min-width: 893px) {
		.card-img-top{
		width: 100%;
		height: 15vw; 
		object-fit: cover;
		}
		}
		
		.card-body{
		background: #1f52a3;
		}
		
		.card-footer{
		background: #1f52a3;
		}
		
		.h5{
		color: #1f52a3;
		}
		
		.card-text{
		font-size: 12px;
		}
	</style>
	<body class="bg-light">
		<!--using external files-->
		<?php require('header.php'); ?>
		<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
			<ol class="carousel-indicators">
				<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
				<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
				<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
			</ol>
			<div class="carousel-inner">
				<div class="carousel-item active">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>First slide label</h5>
						<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
					</div>
				</div>
				<div class="carousel-item">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>Second slide label</h5>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
					</div>
				</div>
				<div class="carousel-item">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>Third slide label</h5>
						<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
					</div>
				</div>
			</div>
			<a class="carousel-control-prev" href="#carouselExampleCaptions" role="button" data-slide="prev">
				<span class="carousel-control-prev-icon" aria-hidden="true"></span>
				<span class="sr-only">Previous</span>
			</a>
			<a class="carousel-control-next" href="#carouselExampleCaptions" role="button" data-slide="next">
				<span class="carousel-control-next-icon" aria-hidden="true"></span>
				<span class="sr-only">Next</span>
			</a>
		</div>
		<!--4 latest news START-->
		<div class="container-fluid bg-light" style="padding: 40px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-6">
					<h5 style="color: #1f52a3;">Latest News</h5>
				</div>
				
				<div class="col-6 d-flex justify-content-end">
					<a href="" class="btn btn-link font-weight-bold" style="color: #1f52a3;">MORE NEWS <i class="fas fa-angle-double-right" style="font-size: 18px;"></i></a>
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 latest news END-->
		<!--4 nation news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">Nation News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="Nation" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php	
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 nation news END-->
		<!--4 world news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">World News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="World" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 world news END-->
		<!--4 entertainment news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0; margin-bottom: 40px;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">Entertainment News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="Entertainment" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 entertainment news END-->
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>				
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Admin</title>
		<script>
			
		</script>
	</head>
	<body>
		<!--using external files-->
		<?php require('header.html'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">Manage News</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row bg-light" style="margin: 0 35px;">
				<div class="col-6">
					<h5>All News</h5>
				</div>
				<div class="col-6 d-flex justify-content-end">
					<button type="button" class="btn btn-primary" style="background: #1f52a3;" data-toggle="modal" data-target="#addNewsModal"><i class="fas fa-plus" style="font-size: 20px;"></i> Add News</button>
				</div>
			</div>
			
			<!--add news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="addNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Add News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/admin.php" method="post">
							<div class="modal-body">
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="inputNewsTitle" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="selectNewsCategory">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Lifestyle' => 4,
											'Food' => 5,	'Tech' => 6,
											'Education' => 7
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="inputNewsDetails" rows="10"></textarea>
								</div>
								
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="btnAddNews" style="background: #1f52a3;">Add</button>
								<input type="hidden" name="submitted" value="true"/>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--add news modal END-->
			<!--connect & insert news into database START-->
			<?php			
				if (isset($_POST['submitted'])){
					//connect database
					$dbc = mysqli_connect('localhost', 'root', '');
					//select database
					mysqli_select_db($dbc, 'news');
					
					$problem = FALSE;
					
					if(!empty($_POST['txtNewsTitle']) && !empty($_POST['selectNewsCategory']) && !empty($_POST['txtNewsDetails'])){
						$newsTitle = trim($_POST['txtNewsTitle']);
						$newsDetails = trim($_POST['txtNewsDetails']);
						$newsCategory = trim($_POST['selectNewsCategory']);
						}else{
						echo '<p>Error! Please enter title and details select category!</p>';
						$problem = TRUE;
					}
					
					if(!$problem){
						$query = "INSERT INTO news (news_title, news_details, news_category, news_datetime) 
						VALUES ('$newsTitle', '$newsDetails', '$newsCategory', NOW())";
						if(mysqli_query($dbc, $query)){
							echo '<p>Added successfully!</p>';
							}else{
							echo '<p>Error! '.mysqli_error($dbc).'</p>';
							echo '<p>Query: '.$query.'</p>';
						}
					}
					mysqli_close($dbc);
				}
			?>
			<!--connect & insert news into database END-->
			<!--news table START-->
			<div class="card-deck" style="margin: 15px 50px;">
				<table class="table table-hover bg-light">
					<thead class="thead-light">
						<tr>
							<th scope="col">News ID</th>
							<th scope="col">News Datetime</th>
							<th scope="col">News Title</th>
							<th scope="col">News Details</th>
							<th scope="col">News Category</th>
							<th scope="col">Edit/Delete</th>
						</tr>
					</thead>
					<tbody>
						<!--select news from database START-->
						<?php
							$dbc = mysqli_connect('localhost', 'root', '');
							mysqli_select_db($dbc, 'news');
							
							$query = 'SELECT * FROM news ORDER BY news_id ASC';
							
							if($r = mysqli_query($dbc, $query)){
								while($row = mysqli_fetch_array($r)){
									echo "<tr>
									<th scope=\"row\">{$row['news_id']}</th>
									<td>{$row['news_datetime']}</td>
									<td>{$row['news_title']}</td>
									<td>{$row['news_details']}</td>
									<td>{$row['news_category']}</td>
									<td>
									<button type=\"button\" class=\"btn btn-info\"><i class=\"fas fa-edit\" style=\"font-size: 20px;\"></i></button>
									<button type=\"button\" class=\"btn btn-danger\"><i class=\"fas fa-trash\" style=\"font-size: 20px;\"></i></button>
									</td>
									</tr>";
								}
								}else{
								echo '<p>Error! '.mysqli_error($dbc).'</p>';
							}
							
							mysqli_close($dbc);
						?>
						<!--select news from database END-->
					</tbody>
				</table>
			</div>
			<!--news table END-->
		</div>
	</body>
</html>
<!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
	
    <!-- U Chen CSS -->
	<link rel="stylesheet" href="homeStyle.css">
	
	<!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
	
	<!-- Font Awesome Icons -->
	<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<div class="container-fluid" style="background: #1f52a3;">
	<div class="row">
		<div class="col-2"></div>
		<div class="col-8">
			<a href="/205CDE/Assignment/home.php"><h1 style="text-align: center; color: #e6e8eb; margin: 20px 0;">U Chen Daily</h1></a>
		</div>
		<div class="col-2 d-flex justify-content-center align-items-center"><a href="/205CDE/Assignment/manageNews.php" target="_blank" class="btn btn-outline-light">LOGIN</a></div>
	</div>
</div>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
	<a class="navbar-brand" href="/205CDE/Assignment/home.php"><i class="fas fa-home" style="font-size: 30px; color: #1f52a3;"></i></a>
	<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
		<span class="navbar-toggler-icon"></span>
	</button>
	
	<div class="collapse navbar-collapse" id="navbarSupportedContent">
		<ul class="navbar-nav mr-auto">
			<li class="nav-item dropdown" style="margin: 0 15px;">
				<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">News</a>
				<div class="dropdown-menu" aria-labelledby="navbarDropdown">
					<?php
						$newsCategoryArr = array(
						'All', 'Nation', 'World',
						'Sport', 'Entertainment',
						);
						foreach($newsCategoryArr as $newsType){
							echo "<a class=\"dropdown-item\" href=\"/205CDE/Assignment/news$newsType.php\" target=\"_blank\">$newsType</a>";
						}
					?>
				</div>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/aboutUs.php" target="_blank">About Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/contactUs.php" target="_blank">Contact Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/faqs.php" target="_blank">FAQs</a>
			</li>
			<!-- <li class="nav-item"> -->
			<!-- <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> -->
			<!-- </li> -->
		</ul>
		<!-- <form class="form-inline my-2 my-lg-0"> -->
		<!-- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> -->
		<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> -->
		<!-- </form> -->
	</div>
</nav>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Admin</title>
		<script type="text/javascript">
			setTimeout(function(){ 
				document.querySelector('.close').click();
			}, 2500);
		</script>
		<!--show news info for editing START-->
		<script type="text/javascript">
			$(document).ready(function(){
				$('.btnEdit').on('click', function(){
					$('#updNewsModal').modal('show');
					
					$tr = $(this).closest('tr');
					
					var data = $tr.children("td").map(function(){
						return $(this).text();
					}).get();
					
					console.log(data);
					
					$('#update_id').val(data[0]);
					$('#news_datetime').val(data[1]);
					$('#news_title').val(data[2]);
					$('#news_details').val(data[3]);
					$('#news_category').val(data[4]);
					$('#news_image').val(data[5]);
				});
			});
		</script>
		<!--show news info for editing END-->
		
		<!--show confirmation message for deleting START-->
		<script type="text/javascript">
			$(document).ready(function(){
				$('.btnDel').on('click', function(){
					$('#delNewsModal').modal('show');
					
					$tr = $(this).closest('tr');
					
					var data = $tr.children("td").map(function(){
						return $(this).text();
					}).get();
					
					console.log(data);
					
					$('#delete_id').val(data[0]);
				});
			});
		</script>
		<!--show confirmation message for deleting END-->
		
		<!--show file name after uploading image START-->
		<script type="text/javascript">
            $(document).ready(function() {
                bsCustomFileInput.init();
			});
		</script>
		<!--show file name after uploading image END-->
		<body>
			<!--using external files-->
			<?php
				if(empty($_SESSION['username'])){
					header('Location: /205CDE/Assignment/home.php');
				}
			?>
			<?php require('header.php'); ?>
			
			<div class="container" style="margin: 20px;">
				<div class="row">
					<div class="col-sm"><h3 style="color: #1f52a3;">Manage News</h3></div>
				</div>
			</div>
			<!--add news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="addNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Add News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/insertData.php" method="post" enctype="multipart/form-data">
							<div class="modal-body">
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="inputNewsTitle" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="selectNewsCategory">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Entertainment' => 4
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group mb-3">
									<label for="inputNewsImage" class="col-form-label">News Image:</label>
									<div class="custom-file">
										<input type="file" class="custom-file-input" name="uploadNewsImg" id="customFile">
										<label class="custom-file-label" for="customFile">Choose file</label>
									</div>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="inputNewsDetails" rows="10"></textarea>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="addNewsData" style="background: #1f52a3;">Add</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--add news modal END-->
			
			<!--edit news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="updNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Edit News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/updateData.php" method="post" enctype="multipart/form-data">
							<div class="modal-body">
								<input type="hidden" name="update_id" id="update_id">
								<div class="form-group">
									<label for="txtNewsDatetime">News Created Datetime:</label>
									<input type="text" class="form-control" name="txtNewsDatetime" id="news_datetime" aria-describedby="emailHelp" placeholder="Enter news datetime" disabled>
								</div>
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="news_title" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="news_category">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Entertainment' => 4
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group mb-3">
									<label for="inputNewsImage" class="col-form-label">News Image:</label>
									<div class="custom-file">
										<input type="file" class="custom-file-input" name="uploadNewsImg" id="news_image">
										<label class="custom-file-label" for="news_image"></label>
									</div>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="news_details" rows="10"></textarea>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="updNewsData" style="background: #1f52a3;">Edit</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--edit news modal END-->
			
			<!--delete news modal START-->
			<!-- Modal -->
			<div class="modal fade" id="delNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-dialog-centered" role="document">
					<div class="modal-content">
						<form action="/205CDE/Assignment/deleteData.php" method="post">
							<div class="modal-body">
								<input type="hidden" name="delete_id" id="delete_id">
								<div class="d-flex justify-content-center" style="margin: 25px 0;">
									<i class="fas fa-times-circle text-danger" style="font-size: 100px;"></i>
								</div>
								<div class="d-flex justify-content-center">
									<h4>Are you sure?</h4>
								</div>
								<div class="d-flex justify-content-center">
									<p class="col-1"></p>
									<p class="col-10" style="text-align: center;">Do you really want to delete this record?<br>This process cannot be undone.</p>
									<p class="col-1"></p>
								</div>
								<div class="row justify-content-around" style="margin: 15px 0;">
									<div class="col-6 d-flex justify-content-end">
										<button type="button" class="btn btn-secondary btn-lg" data-dismiss="modal">Cancel</button>
									</div>
									<div class="col-6 d-flex justify-content-start">
										<button type="submit" class="btn btn-danger btn-lg" name="delNewsData">Delete</button>
									</div>
									<input type="hidden" name="delSubmitted" value="true"/>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--delete news modal END-->
			
			<div class="container-fluid bg-light" style="padding: 30px 10px;">
				<div class="row bg-light" style="margin: 0 35px;">
					<div class="col-6">
						<h5>All News</h5>
					</div>
					<div class="col-6 d-flex justify-content-end">
						<button type="button" class="btn btn-primary" style="background: #1f52a3;" data-toggle="modal" data-target="#addNewsModal"><i class="fas fa-plus" style="font-size: 20px;"></i> Add News</button>
					</div>
				</div>
				<!--add news alert START-->
				<div class="row bg-light" style="margin: 15px 35px;" id="addNewsAlert">
					<div class="col-12">
						<div class="alert alert-success alert-dismissible fade show" role="alert" >
							<strong>Success!</strong> The news is added successfully!
							<button type="button" class="close" data-dismiss="alert" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
						</div>
					</div>
				</div>
				<!--add news alert END-->
				
				<!--news table START-->
				<div class="card-deck" style="margin: 15px 50px;">
					<?php
						$dbc = mysqli_connect('localhost', 'root', '');	//connect database
						mysqli_select_db($dbc, 'news');	//select database
						
						$query = 'SELECT * FROM news ORDER BY news_datetime DESC';
						$runQuery = mysqli_query($dbc, $query);
					?>
					<table class="table table-hover bg-light" id="manageNewsTable">
						<thead class="thead-light">
							<tr>
								<th scope="col">News ID</th>
								<th scope="col">News Created Datetime</th>
								<th scope="col">News Title</th>
								<th scope="col">News Details</th>
								<th scope="col">News Category</th>
								<th scope="col">News Image</th>
								<th scope="col">Edit/Delete</th>
							</tr>
						</thead>
						<?php
							if($runQuery){
								foreach($runQuery as $row){
								?>
								<tbody>
									<tr>
										<td><?php echo $row['news_id']; ?></td>
										<td><small><?php echo $row['news_datetime'];?></small></td>
										<td><?php echo $row['news_title']; ?></td>
										<td><?php echo $row['news_details']; ?></td>
										<td><?php echo $row['news_category']; ?></td>
										<td>
											<a href="<?php 
												if(empty($row['news_image'])){
													echo 'https://via.placeholder.com/200x200';
													}else{
													echo '/205CDE/Assignment/'.$row['news_image'];
												} ?>" target="_blank">
												<img src="<?php 
													if(empty($row['news_image'])){
														echo 'https://via.placeholder.com/200x200';
														}else{
														echo $row['news_image'];
													}?>" alt="Thumbnail News Image" class="img-thumbnail">
											</a>
										</td>
										<td>
											<button type="button" class="btn btn-info btnEdit"><i class="fas fa-edit" style="font-size: 14px;"></i></button>
											<button type="button" class="btn btn-danger btnDel"><i class="fas fa-trash" style="font-size: 14px;"></i></button>
										</td>
									</tr>
								</tbody>
								<?php
								}
								}else{
								echo "ERROR! No record found!";
							}
							mysqli_close($dbc);
						?>
					</table>
				</div>
				<!--news table END-->
			</div>
			<!--using external files-->
			<?php require('footer.html'); ?>
		</body>
	</html>																				
<?php
	$dbc = mysqli_connect('localhost', 'root', '');	//connect database
	mysqli_select_db($dbc, 'news');	//select database
	
	$errorsAddNewsArr = array();
	
	if(isset($_POST['addNewsData'])){
		$newsTitle = trim(str_replace("'", "\'", $_POST['txtNewsTitle']));
		$newsDetails = trim(str_replace("'", "\'", $_POST['txtNewsDetails']));
		$newsCategory = $_POST['selectNewsCategory'];
		
		$targetImage = "/205CDE/Assignment/".basename($_FILES['uploadNewsImg']['name']);
		$newsImage = $_FILES['uploadNewsImg']['name'];
		
		//ensure form fields are filled properly
		if(empty($newsTitle)){
			array_push($errorsAddNewsArr, "News title is required! Please try again!");
		}
		if(empty($newsDetails)){
			array_push($errorsAddNewsArr, "News details is required! Please try again!");
		}
		if($newsCategory == 0){
			array_push($errorsAddNewsArr, "News category is required! Please try again!");
		}
		
		//no errors
		if(count($errorsAddNewsArr) == 0){
			$query = "INSERT INTO news (news_title, news_details, news_category, news_datetime, news_image) 
			VALUES ('$newsTitle', '$newsDetails', '$newsCategory', NOW(), '$newsImage')";
			
			//Move uploaded image into a folder
			if(move_uploaded_file($_FILES['name']['tmp_name'], $targetImage)){
				$msg = "Image uploaded successfully!";
				}else{
				$msg = "Image uploaded unsuccessfully!";
			}
			
			$runQuery = mysqli_query($dbc, $query);
			
			if($runQuery){
				echo '<script> alert("Data saved!"); </script>';
				header('Location: /205CDE/Assignment/manageNews.php');
				}else{
				echo '<script> alert("Data not save yet!"); </script>';
			}
		}else{
			//display error message in alert
			foreach($errorsAddNewsArr as $errorsAddNewsMsg){
				echo '<script type="text/javascript">alert("'.$errorsAddNewsMsg.'");</script>'; 
			}
			
			//redirect to manageNews.php
			echo '<script type="text/javascript">window.location.href = "/205CDE/Assignment/manageNews.php";</script>'; 
		}
	}
	mysqli_close($dbc);
?>
<footer>
	<div class="container-fluid" style="background: #1f52a3; margin-top: 50px; padding: 30px;">
		<div class="row">
			<div class="col-1"></div>
			<div class="col-10 d-flex justify-content-start" style="color: #e6e8eb;">&#169; Copyright 2020 U Chen Daily. All rights reserved.</div>
			<div class="col-1"></div>
		</div>
	</div>
</footer>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen  Daily | About Us</title>
	</head>
	<body>
		<!--using external files-->
		<?php require('header.html'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">About Us</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row bg-light" style="margin: 0 35px;">
				<div class="col">
					<h4>U Chen  Daily</h4>
				</div>
			</div>
			<div class="row bg-light" style="margin: 10px 35px;">
				<div class="col-6">
					<p>Since its launch on June 23, 1995, as Malaysia's first news website, U Chen  Daily has always striven to provide readers with up to date breaking news, compelling content and insightful opinions.</p>
					<p>Evolving with the times, our content includes current news, business, sports, community, tech, lifestyle and world news, as well as expert analysis and dynamic videos.</p>
					<p>The website was recognised in 2014 as one of the best in Asia by the World Association of Newspapers and News Publishers (WAN-IFRA).</p>
					<p>It serves as the foundation of an online community that has a million strong following on both Twitter and Facebook.</p>
					<p>As the digital companion to U Chen  Daily newspaper, U Chen  Daily is part of a portfolio that offers content through print, U Chen  Daily ePaper and a mobile app.</p>
					<p>Readers on-the-go who want breaking news and business updates delivered to them can opt for our SMS services available via Maxis and DiGi.</p>
				</div>
				<div class="col-6">
					<p>U Chen  Daily (daily) and Sunday U Chen  are published in five editions. Two editions cover the northern peninsular states of Penang, Kedah, Perlis, Kelantan and northern Perak, while another two editions cover the rest of the country. As of March 2010, the newspaper has a separate Sarawak edition priced at RM1.20.</p>
					<p>There are two main printing plants that publish four editions of U Chen  Daily on a daily basis. The northern editions are printed at U Chen  Daily Northern Hub in Bayan Lepas, Penang, while the other two editions are printed at U Chen  Daily Media Hub in Bukit Jelutong, Shah Alam, Selangor.</p>
					<p>U Chen  Daily weekday paper is packaged as a 4-in-1 paper, comprising the Main Paper, U Chen Biz, U Chen 2 and U Chen  Metro. Naturally, this newspaper also contains classifieds.</p>
					<p>The Main Paper covers the latest in both local and international news while U Chen Biz offers a comprehensive coverage of business developments, market trends, financial reports and updates in the stock market. U Chen 2 features articles on lifestyle, entertainment, health, parenting, social etiquette, science, environment, fashion, food, comics and many more. The contents published on U Chen  Daily Metro varies by edition, covering news and events in a particular region covered by each edition.</p>
				</div>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen  Daily | Contact Us</title>
	</head>
	<style>
		.google-maps {
        position: relative;
        padding-bottom: 50%;
        height: 0;
        overflow: hidden;
		}
		.google-maps iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
		}
		i {
		font-size: 50px; 
		color: #1f52a3;
		}
		h5 {
		color: #1f52a3;
		margin-top: 35px;
		}
	</style>
	<body>
		<!--using external files-->
		<?php require('header.html'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">Contact Us</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row bg-light" style="margin: 0px 35px;">
				<div class="col-12 google-maps">
					<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3972.4919887247825!2d100.2796820147649!3d5.341603796125226!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x304ac048a161f277%3A0x881c46d428b3162c!2sINTI%20International%20College%20Penang!5e0!3m2!1sen!2smy!4v1606047317819!5m2!1sen!2smy" width="600" height="450" frameborder="0" style="border: 2px solid #1f52a3;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>
				</div>
			</div>
			<div class="row bg-light" style="margin: 35px 35px 0;">
				<div class="col-4">
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<i class="far fa-envelope"></i>
					</div>
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<h5>info@uchendaily.com</h5>
					</div>
				</div>
				<div class="col-4">
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<i class="fas fa-phone-alt"></i>
					</div>
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<h5>+604-577 9999</h5>
					</div>
				</div>
				<div class="col-4">
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<i class="fas fa-map-marker-alt"></i>
					</div>
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<h5>1-Z, Lebuh Bukit Jambul,<br>Bukit Jambul,<br>11900 Bayan Lepas,Pulau Pinang.</h5>
					</div>
				</div>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | FAQs</title>
	</head>
	<style>
		.card-header{
		background: #1f52a3;
		}
		.card-body{
		color: #1f52a3;
		}
		h3{
		color: #1f52a3;
		margin: 20px 0;
		}
	</style>
	<body>
		<!--using external files-->
		<?php require('header.php'); ?>
		<div class="container" style="margin: 5px 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">FAQs</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 10px 10px 50px;">
			<div class="row bg-light" style="margin: 10px 35px; font-size: 18px;">
				<div class="col-lg-6">
					<h3>General</h3>
					<div class="accordion" id="accordionExample">
						<!--first faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingOne">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
										There is something wrong with TheUChen.com.my and/or app. What should I do? (example: broken link, error page, spotted some issues)
									</button>
								</h2>
							</div>
							<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
								<div class="card-body bg-white">
									We are sorry for the inconvenience caused. Please report your issue to us and include as much information as possible.
								</div>
							</div>
						</div>
						<!--first faq END-->
						<!--second faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingTwo">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
										I want to publish articles or pictures from U Chen Daily. How do I get copyright permission?
									</button>
								</h2>
							</div>
							<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Write to us and get permission. Granting or refusal of permission is at our sole and absolute discretion.
								</div>
							</div>
						</div>
						<!--second faq END-->
						<!--third faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingThree">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
										Why can I only read a limited number of articles on TheUChen.com.my and app?
									</button>
								</h2>
							</div>
							<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Effective Feb 24, 2020, we will be offering a paid digital membership for unlimited access to TheUChen.com.my and app (“Digital Access”). This will ensure that we continue to provide reliable, relevant, and compelling content while maintaining the quality of journalism that readers trust us to uphold. The membership, called U Chen Daily Digital Access, also includes personalisation features to improve your reading experience.
								</div>
							</div>
						</div>
						<!--third faq END-->
						<!--4th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFour">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
										How can I keep track of how many articles I have read?
									</button>
								</h2>
							</div>
							<div id="collapseFour" class="collapse" aria-labelledby="headingFour" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Sorry, you can't track your article limit at the moment. We're still developing this part of the system so do bear with us while we continue to improve.
								</div>
							</div>
						</div>
						<!--4th faq END-->
						<!--5th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFive">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFive" aria-expanded="false" aria-controls="collapseFive">
										If I don’t want to register as a member, can I still read articles for free?
									</button>
								</h2>
							</div>
							<div id="collapseFive" class="collapse" aria-labelledby="headingFive" data-parent="#accordionExample">
								<div class="card-body bg-white">
									As a guest user without an active paid membership, you can access a limited number of articles for free each month. This limit resets every 30 days. This excludes premium content (marked as ‘PREMIUM’), which are exclusive to paid members, and content hosted on a separate subscription-based service, e.g. dimsum e-tuition videos.
								</div>
							</div>
						</div>
						<!--5th faq END-->
						<!--6th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingSix">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseSix" aria-expanded="false" aria-controls="collapseSix">
										Do I need to log in with a MyUChen account if I just want to read articles for free as a guest user?
									</button>
								</h2>
							</div>
							<div id="collapseSix" class="collapse" aria-labelledby="headingSix" data-parent="#accordionExample">
								<div class="card-body bg-white">
									While it’s not compulsory, we do recommend that you sign up for a MyUChen account. As a member, you can UChent your 1-month free trial to U Chen Daily Digital Access and enjoy personalisation features to improve your reading experience.
								</div>
							</div>
						</div>
						<!--6th faq END-->
						<!--7th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingSeven">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseSeven" aria-expanded="false" aria-controls="collapseSeven">
										What does the paid U Chen Daily Digital Access membership entail?
									</button>
								</h2>
							</div>
							<div id="collapseSeven" class="collapse" aria-labelledby="headingSeven" data-parent="#accordionExample">
								<div class="card-body bg-white">
									With U Chen Daily Digital Access membership, you will be able to access all articles on TheUChen.com.my and app, including premium content which are exclusive to paid members, excluding content hosted on a separate subscription-based services, e.g. dimsum e-tuition videos. Members can also access all personalisation features.
								</div>
							</div>
						</div>
						<!--7th faq END-->
						<!--8th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingEight">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseEight" aria-expanded="false" aria-controls="collapseEight">
										I'm currently subscribed to ePaper. Do I still need to subscribe to U Chen Daily?
									</button>
								</h2>
							</div>
							<div id="collapseEight" class="collapse" aria-labelledby="headingEight" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Yes. At the moment U Chen Daily Digital Access and ePaper subscription are on two separate platforms.
								</div>
							</div>
						</div>
						<!--8th faq END-->
					</div>
				</div>
				<div class="col-lg-6">
					<h3>About Account</h3>
					<div class="accordion" id="accordionExample">
						<!--9th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingNine">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light" type="button" data-toggle="collapse" data-target="#collapseNine" aria-expanded="true" aria-controls="collapseNine">
										I can’t sign up/register from Internet Explorer?
									</button>
								</h2>
							</div>
							<div id="collapseNine" class="collapse show" aria-labelledby="headingNine" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Internet Explorer is not supported at the moment. Best view from Chrome browsers.
								</div>
							</div>
						</div>
						<!--9th faq END-->
						<!--10th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingTen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseTen" aria-expanded="false" aria-controls="collapseTen">
										I signed up for a free MyUChen account before Feb 10, 2020 and was prompted to update my password. What should I do?
									</button>
								</h2>
							</div>
							<div id="collapseTen" class="collapse" aria-labelledby="headingTen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Please log in with your username/email and change your password with a minimum of eight characters. It must contain at least one upper case letter, one number, and one special character except '+' and '='. Please use your new password for future logins.
								</div>
							</div>
						</div>
						<!--10th faq END-->
						<!--11th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingEleven">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseEleven" aria-expanded="false" aria-controls="collapseEleven">
										Why do I have to change my password?
									</button>
								</h2>
							</div>
							<div id="collapseEleven" class="collapse" aria-labelledby="headingEleven" data-parent="#accordionExample">
								<div class="card-body bg-white">
									We've made some enhancements to the TheUChen.com.my and app to improve your reading experience and for web security. This includes migrating all MyUChen accounts to a new system. Members who signed up before Feb 10, 2020, are required to update their password.
								</div>
							</div>
						</div>
						<!--11th faq END-->
						<!--12th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingTwelve">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseTwelve" aria-expanded="false" aria-controls="collapseTwelve">
										I forgot my password, what should I do?
									</button>
								</h2>
							</div>
							<div id="collapseTwelve" class="collapse" aria-labelledby="headingTwelve" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Click ‘Forgot Password?’ and you will be emailed a temporary password that you can log in with. Please proceed to change your password as soon as possible.
								</div>
							</div>
						</div>
						<!--12th faq END-->
						<!--13th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingThirteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseThirteen" aria-expanded="false" aria-controls="collapseThirteen">
										I’ve updated my password, but I can’t log in with MyUChen account’s username?
									</button>
								</h2>
							</div>
							<div id="collapseThirteen" class="collapse" aria-labelledby="headingThirteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Please use the new password with your MyUChen email.
								</div>
							</div>
						</div>
						<!--13th faq END-->
						<!--14th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFourteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFourteen" aria-expanded="false" aria-controls="collapseFourteen">
										I registered for a MyUChen account but did not receive any verification email. What should I do?
									</button>
								</h2>
							</div>
							<div id="collapseFourteen" class="collapse" aria-labelledby="headingFourteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									lease check both your Inbox and/or Spam folders. Click ‘Resend verification email’ and try again. If you have closed the page or have been logged out, please log in again to click ‘Resend verification email’.
									<br>
									If you are using a corporate email, kindly inform your tech department to whitelist @theUChen.com.my.
								</div>
							</div>
						</div>
						<!--14th faq END-->
						<!--15th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFifteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFifteen" aria-expanded="false" aria-controls="collapseFifteen">
										The email verification link/code provided is invalid. What should I do?
									</button>
								</h2>
							</div>
							<div id="collapseFifteen" class="collapse" aria-labelledby="headingFifteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Click ‘Resend verification email’ and try again. If you have closed the page or have been logged out, please log in again to click ‘Resend verification email’.
								</div>
							</div>
						</div>
						<!--15th faq END-->
						<!--16th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingSixteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseSixteen" aria-expanded="false" aria-controls="collapseSixteen">
										I can’t seem to register. It says email address previously registered. What do I do?
									</button>
								</h2>
							</div>
							<div id="collapseSixteen" class="collapse" aria-labelledby="headingSixteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									If you have forgotten your password, click ‘Forgot Password?’ to reset it. If you are certain that you did not sign up with your email address before, kindly contact our Customer Service.
								</div>
							</div>
						</div>
						<!--16th faq END-->
					</div>
				</div>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Home</title>
	</head>
	<style>
		@media only screen and (min-width: 893px) {
		.card-img-top{
		width: 100%;
		height: 15vw; 
		object-fit: cover;
		}
		}
		
		.card-body{
		background: #1f52a3;
		}
		
		.card-footer{
		background: #1f52a3;
		}
		
		.h5{
		color: #1f52a3;
		}
		
		.card-text{
		font-size: 12px;
		}
	</style>
	<body class="bg-light">
		<!--using external files-->
		<?php require('header.php'); ?>
		<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
			<ol class="carousel-indicators">
				<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
				<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
				<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
			</ol>
			<div class="carousel-inner">
				<div class="carousel-item active">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>First slide label</h5>
						<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
					</div>
				</div>
				<div class="carousel-item">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>Second slide label</h5>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
					</div>
				</div>
				<div class="carousel-item">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>Third slide label</h5>
						<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
					</div>
				</div>
			</div>
			<a class="carousel-control-prev" href="#carouselExampleCaptions" role="button" data-slide="prev">
				<span class="carousel-control-prev-icon" aria-hidden="true"></span>
				<span class="sr-only">Previous</span>
			</a>
			<a class="carousel-control-next" href="#carouselExampleCaptions" role="button" data-slide="next">
				<span class="carousel-control-next-icon" aria-hidden="true"></span>
				<span class="sr-only">Next</span>
			</a>
		</div>
		<!--4 latest news START-->
		<div class="container-fluid bg-light" style="padding: 40px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-6">
					<h5 style="color: #1f52a3;">Latest News</h5>
				</div>
				
				<div class="col-6 d-flex justify-content-end">
					<a href="" class="btn btn-link font-weight-bold" style="color: #1f52a3;">MORE NEWS <i class="fas fa-angle-double-right" style="font-size: 18px;"></i></a>
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 latest news END-->
		<!--4 nation news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">Nation News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="Nation" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php	
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 nation news END-->
		<!--4 world news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">World News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="World" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 world news END-->
		<!--4 entertainment news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0; margin-bottom: 40px;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">Entertainment News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="Entertainment" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 entertainment news END-->
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>				
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Admin</title>
		<script type="text/javascript">
			setTimeout(function(){ 
				document.querySelector('.close').click();
			}, 2500);
		</script>
		<!--show news info for editing START-->
		<script type="text/javascript">
			$(document).ready(function(){
				$('.btnEdit').on('click', function(){
					$('#updNewsModal').modal('show');
					
					$tr = $(this).closest('tr');
					
					var data = $tr.children("td").map(function(){
						return $(this).text();
					}).get();
					
					console.log(data);
					
					$('#update_id').val(data[0]);
					$('#news_datetime').val(data[1]);
					$('#news_title').val(data[2]);
					$('#news_details').val(data[3]);
					$('#news_category').val(data[4]);
					$('#news_image').val(data[5]);
				});
			});
		</script>
		<!--show news info for editing END-->
		
		<!--show confirmation message for deleting START-->
		<script type="text/javascript">
			$(document).ready(function(){
				$('.btnDel').on('click', function(){
					$('#delNewsModal').modal('show');
					
					$tr = $(this).closest('tr');
					
					var data = $tr.children("td").map(function(){
						return $(this).text();
					}).get();
					
					console.log(data);
					
					$('#delete_id').val(data[0]);
				});
			});
		</script>
		<!--show confirmation message for deleting END-->
		
		<!--show file name after uploading image START-->
		<script type="text/javascript">
            $(document).ready(function() {
                bsCustomFileInput.init();
			});
		</script>
		<!--show file name after uploading image END-->
		<body>
			<!--using external files-->
			<?php
				if(empty($_SESSION['username'])){
					header('Location: /205CDE/Assignment/home.php');
				}
			?>
			<?php require('header.php'); ?>
			
			<div class="container" style="margin: 20px;">
				<div class="row">
					<div class="col-sm"><h3 style="color: #1f52a3;">Manage News</h3></div>
				</div>
			</div>
			<!--add news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="addNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Add News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/insertData.php" method="post" enctype="multipart/form-data">
							<div class="modal-body">
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="inputNewsTitle" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="selectNewsCategory">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Entertainment' => 4
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group mb-3">
									<label for="inputNewsImage" class="col-form-label">News Image:</label>
									<div class="custom-file">
										<input type="file" class="custom-file-input" name="uploadNewsImg" id="customFile">
										<label class="custom-file-label" for="customFile">Choose file</label>
									</div>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="inputNewsDetails" rows="10"></textarea>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="addNewsData" style="background: #1f52a3;">Add</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--add news modal END-->
			
			<!--edit news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="updNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Edit News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/updateData.php" method="post" enctype="multipart/form-data">
							<div class="modal-body">
								<input type="hidden" name="update_id" id="update_id">
								<div class="form-group">
									<label for="txtNewsDatetime">News Created Datetime:</label>
									<input type="text" class="form-control" name="txtNewsDatetime" id="news_datetime" aria-describedby="emailHelp" placeholder="Enter news datetime" disabled>
								</div>
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="news_title" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="news_category">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Entertainment' => 4
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group mb-3">
									<label for="inputNewsImage" class="col-form-label">News Image:</label>
									<div class="custom-file">
										<input type="file" class="custom-file-input" name="uploadNewsImg" id="news_image">
										<label class="custom-file-label" for="news_image"></label>
									</div>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="news_details" rows="10"></textarea>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="updNewsData" style="background: #1f52a3;">Edit</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--edit news modal END-->
			
			<!--delete news modal START-->
			<!-- Modal -->
			<div class="modal fade" id="delNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-dialog-centered" role="document">
					<div class="modal-content">
						<form action="/205CDE/Assignment/deleteData.php" method="post">
							<div class="modal-body">
								<input type="hidden" name="delete_id" id="delete_id">
								<div class="d-flex justify-content-center" style="margin: 25px 0;">
									<i class="fas fa-times-circle text-danger" style="font-size: 100px;"></i>
								</div>
								<div class="d-flex justify-content-center">
									<h4>Are you sure?</h4>
								</div>
								<div class="d-flex justify-content-center">
									<p class="col-1"></p>
									<p class="col-10" style="text-align: center;">Do you really want to delete this record?<br>This process cannot be undone.</p>
									<p class="col-1"></p>
								</div>
								<div class="row justify-content-around" style="margin: 15px 0;">
									<div class="col-6 d-flex justify-content-end">
										<button type="button" class="btn btn-secondary btn-lg" data-dismiss="modal">Cancel</button>
									</div>
									<div class="col-6 d-flex justify-content-start">
										<button type="submit" class="btn btn-danger btn-lg" name="delNewsData">Delete</button>
									</div>
									<input type="hidden" name="delSubmitted" value="true"/>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--delete news modal END-->
			
			<div class="container-fluid bg-light" style="padding: 30px 10px;">
				<div class="row bg-light" style="margin: 0 35px;">
					<div class="col-6">
						<h5>All News</h5>
					</div>
					<div class="col-6 d-flex justify-content-end">
						<button type="button" class="btn btn-primary" style="background: #1f52a3;" data-toggle="modal" data-target="#addNewsModal"><i class="fas fa-plus" style="font-size: 20px;"></i> Add News</button>
					</div>
				</div>
				<!--add news alert START-->
				<div class="row bg-light" style="margin: 15px 35px;" id="addNewsAlert">
					<div class="col-12">
						<div class="alert alert-success alert-dismissible fade show" role="alert" >
							<strong>Success!</strong> The news is added successfully!
							<button type="button" class="close" data-dismiss="alert" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
						</div>
					</div>
				</div>
				<!--add news alert END-->
				
				<!--news table START-->
				<div class="card-deck" style="margin: 15px 50px;">
					<?php
						$dbc = mysqli_connect('localhost', 'root', '');	//connect database
						mysqli_select_db($dbc, 'news');	//select database
						
						$query = 'SELECT * FROM news ORDER BY news_datetime DESC';
						$runQuery = mysqli_query($dbc, $query);
					?>
					<table class="table table-hover bg-light" id="manageNewsTable">
						<thead class="thead-light">
							<tr>
								<th scope="col">News ID</th>
								<th scope="col">News Created Datetime</th>
								<th scope="col">News Title</th>
								<th scope="col">News Details</th>
								<th scope="col">News Category</th>
								<th scope="col">News Image</th>
								<th scope="col">Edit/Delete</th>
							</tr>
						</thead>
						<?php
							if($runQuery){
								foreach($runQuery as $row){
								?>
								<tbody>
									<tr>
										<td><?php echo $row['news_id']; ?></td>
										<td><small><?php echo $row['news_datetime'];?></small></td>
										<td><?php echo $row['news_title']; ?></td>
										<td><?php echo $row['news_details']; ?></td>
										<td><?php echo $row['news_category']; ?></td>
										<td>
											<a href="<?php 
												if(empty($row['news_image'])){
													echo 'https://via.placeholder.com/200x200';
													}else{
													echo '/205CDE/Assignment/'.$row['news_image'];
												} ?>" target="_blank">
												<img src="<?php 
													if(empty($row['news_image'])){
														echo 'https://via.placeholder.com/200x200';
														}else{
														echo $row['news_image'];
													}?>" alt="Thumbnail News Image" class="img-thumbnail">
											</a>
										</td>
										<td>
											<button type="button" class="btn btn-info btnEdit"><i class="fas fa-edit" style="font-size: 14px;"></i></button>
											<button type="button" class="btn btn-danger btnDel"><i class="fas fa-trash" style="font-size: 14px;"></i></button>
										</td>
									</tr>
								</tbody>
								<?php
								}
								}else{
								echo "ERROR! No record found!";
							}
							mysqli_close($dbc);
						?>
					</table>
				</div>
				<!--news table END-->
			</div>
			<!--using external files-->
			<?php require('footer.html'); ?>
		</body>
	</html>																				
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | News</title>
	</head>
	<body>
		<!--using external files-->
		<?php require('header.php'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">News</h3></div>
			</div>
		</div>
		<?php
			$dbc = mysqli_connect('localhost', 'root', '');
			mysqli_select_db($dbc, 'news');
			
			if(isset($_GET['id']) && is_numeric($_GET['id'])){
				$query = "SELECT * FROM news WHERE news_id={$_GET['id']}";
				
				if($r = mysqli_query($dbc, $query)){
					$row = mysqli_fetch_array($r);
				?>
				<div class="container-fluid bg-light" style="padding: 50px 20px">
					<div class="row d-flex justify-content-between" style="margin: 0 50px;">
						<div class="col-lg-8 col-md-12">
							<div class="row mb-3">
								<h2 style="color: #1f52a3;"><?php echo $row['news_title'] ?></h2>
							</div>
							<div class="row">
								<div class="col mb-3" style="font-size: 18px; color:#1f52a3;">
									<i class="far fa-clock"></i>&nbsp
									<?php echo date('d-M-Y', strtotime($row['news_datetime'])); ?>&nbsp&nbsp&nbsp
									<i class="fas fa-tag"></i>&nbsp
									<?php echo strtoupper($row['news_category']); ?>
								</div>
							</div>
							<div class="row">
								<div class="col-12"  style="margin-bottom: 10px;">
									<img class="card-img-top" src="<?php 
										if(empty($row['news_image'])){
											echo 'https://via.placeholder.com/350x250';
											}else{
											echo $row['news_image'];
										}
									?>" alt="Card image cap" style="width:80%;">
								</div>
								
							</div>
							<div class="row" style="margin: 10px 0; font-size: 20px;">
								<p class="font-weight-normal"><?php echo $row['news_details'] ?></p>
							</div>
						</div>
						<?php
						}
					}
					mysqli_close($dbc);
				?>
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC LIMIT 5';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<div class="col-lg-4 col-md-12">
					<div class="list-group list-group-flush" style="border: 2px solid #1f52a3; border-top: 0;">
						<h4 class="list-group-item text-light text-center" style="background: #1f52a3;">Top 5 Latest News</h4>
						<?php
							if($runQuery){
								foreach($runQuery as $row){?>
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>" class="list-group-item list-group-item-action" target="_blank">
									<div class="row">
										<div class="col-3">
											<img src="<?php 
												if(empty($row['news_image'])){
													echo 'https://via.placeholder.com/200x200';
													}else{
													echo $row['news_image'];
												}?>" alt="Thumbnail News Image" class="img-thumbnail">
											</div>
											<div class="col-8" style="font-size: 15px;">
												<?php echo $row['news_title']; ?>
											</div>
										</div>
									</a>	
									<?php }
									}else{
									echo "ERROR! No record found!";
								}
								mysqli_close($dbc);
							?>
						</div>
					</div>
					<!--<div class="col-3" style="">
						<img class="card-img-top" src="https://via.placeholder.com/350x200" alt="Card image cap">
					</div>-->
				</div>
			</div>
			
			
			<!--using external files-->
			<?php require('footer.html'); ?>
		</body>
	</html>	
<?php
	session_start();
	
	$errorsArr = array();
	
	if(isset($_POST['submittedLogin'])){
		$username = $_POST['usernameLogin'];
		$password = $_POST['passwordLogin'];
		
		//ensure form fields are filled properly
		if(empty($username)){
			array_push($errorsArr, "Username is required! Please try again!");
		}
		if(empty($password)){
			array_push($errorsArr, "Password is required! Please try again!");
		}
		if((!empty($username)) && (!empty($password)) && ($username != 'admin') && ($password != 'admin')){
			array_push($errorsArr, "Incorrect username or password! Please try again!");
		}
		
		//no errors
		if(count($errorsArr) == 0){
			$_SESSION['username'] = $username;
			$_SESSION['success'] = "You are now logged in!";
			header('Location: /205CDE/Assignment/manageNews.php');
		}
	}
	
	//logout
	if(isset($_GET['logout'])){
		session_destroy();
		unset($_SESSION['username']);
		header('Location: /205CDE/Assignment/home.php');
	}
?>
<div class="container-fluid" style="background: #1f52a3;">
	<div class="row">
		<div class="col-2"></div>
		<div class="col-8">
			<a href="/205CDE/Assignment/home.php"><h1 style="text-align: center; color: #e6e8eb; margin: 20px 0;">U Chen Daily</h1></a>
		</div>
		<div class="col-2 d-flex justify-content-center align-items-center">
			<?php if(isset($_SESSION['username'])){ ?>
				<a href="/205CDE/Assignment/home.php?logout='1'" class="btn btn-outline-light">LOGOUT</a>
				<?php }else{ 
				?>
				<button type="button" class="btn btn-outline-light" data-toggle="modal" data-target="#loginFormModal">
					LOGIN AS ADMIN
				</button>
			<?php } ?>
			<!--<a href="/205CDE/Assignment/manageNews.php" target="_blank" class="btn btn-outline-light">LOGIN</a>-->
		</div>
	</div>
</div>
<!--login form modal START-->
<!-- Modal -->
<div class="modal fade" id="loginFormModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="exampleModalCenterTitle">Login</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<form action="/205CDE/Assignment/home.php" method="post" id="loginModalForm">
				<div class="modal-body">
					<?php
						if(count($errorsArr) > 0){?>
						<div class="form-group">
							<?php
								foreach($errorsArr as $errorMsg){
									//echo "<p class=\"text-danger\">$errorMsg</p>";
									echo "<script>alert(\"$errorMsg\")</script>";
								}
							?>
						</div>
						<?php }
					?>
					<div class="form-group">
						<label for="exampleInputEmail1">Username</label>
						<input type="text" class="form-control" name="usernameLogin" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter username" value="<?php if(isset($username)){echo $username;} ?>">
					</div>
					<div class="form-group">
						<label for="exampleInputPassword1">Password</label>
						<input type="password" class="form-control" name="passwordLogin" id="exampleInputPassword1" placeholder="Enter password">
					</div>
					<br>
					<div class="form-group">
						<button type="submit" class="btn btn-lg btn-block text-light" style="background: #1f52a3;">LOGIN</button>
						<input type="hidden" name="submittedLogin">
					</div>
				</div>
				<!--<div class="modal-footer">
					<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
					<button type="button" class="btn btn-primary">Login</button>
				</div>-->
			</form>
		</div>
	</div>
</div>
<!--login form modal END-->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
	<a class="navbar-brand" href="/205CDE/Assignment/home.php"><i class="fas fa-home" style="font-size: 30px; color: #1f52a3;"></i></a>
	<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
		<span class="navbar-toggler-icon"></span>
	</button>
	
	<div class="collapse navbar-collapse" id="navbarSupportedContent">
		<ul class="navbar-nav mr-auto">
			<li class="nav-item dropdown" style="margin: 0 15px;">
				<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">News</a>
				<div class="dropdown-menu" aria-labelledby="navbarDropdown">
					<?php
						$newsCategoryArr = array(
						'All', 'Nation', 'World',
						'Sport', 'Entertainment',
						);
						foreach($newsCategoryArr as $newsType){
							echo "<a class=\"dropdown-item\" href=\"/205CDE/Assignment/news$newsType.php\" target=\"_blank\">$newsType</a>";
						}
					?>
				</div>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/aboutUs.php" target="_blank">About Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/contactUs.php" target="_blank">Contact Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/faqs.php" target="_blank">FAQs</a>
			</li>
			<!-- <li class="nav-item"> -->
			<!-- <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> -->
			<!-- </li> -->
		</ul>
		<!-- <form class="form-inline my-2 my-lg-0"> -->
		<!-- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> -->
		<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> -->
		<!-- </form> -->
	</div>
</nav>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html'); ?>
		
		<title>U Chen Daily | All News</title>
	</head>
	<style>
		@media only screen and (min-width: 893px) {
		.card-img-top{
		width: 100%;
		height: 15vw; 
		object-fit: cover;
		}
		}
		
		.card-body{
		background: #1f52a3;
		}
		
		.card-footer{
		background: #1f52a3;
		}
		
		.h5{
		color: #1f52a3;
		}
		
		.card-text{
		font-size: 12px;
		}
	</style>
	<body class="bg-light">
		<!--using external files-->
		<?php require('header.php'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">All News</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row d-flex justify-content-start" style="margin: 0 10px;">
			<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
				<div class="card" style="width: 22rem; margin: 20px 30px;">
					<img class="card-img-top" src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
					<div class="card-body">
						<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
					</div>
					<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
				</div>
				<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>		
<?php
	$dbc = mysqli_connect('localhost', 'root', '');	//connect database
	mysqli_select_db($dbc, 'news');	//select database
	
	$errorsUpdNewsArr = array();
	
	if(isset($_POST['updNewsData'])){
		$newsID = $_POST['update_id'];
		$newsTitle = $_POST['txtNewsTitle'];
		$newsDetails = $_POST['txtNewsDetails'];
		$newsCategory = $_POST['selectNewsCategory'];
		
		$targetImage = "/205CDE/Assignment/".basename($_FILES['uploadNewsImg']['name']);
		$newsImage = $_FILES['uploadNewsImg']['name'];
		$newsImageExt = pathinfo($newsImage, PATHINFO_EXTENSION);
		
		//ensure form fields are filled properly
		if(empty($newsTitle)){
			array_push($errorsUpdNewsArr, "News title is required! Please try again!");
		}
		if(empty($newsDetails)){
			array_push($errorsUpdNewsArr, "News details is required! Please try again!");
		}
		if($_FILES["uploadNewsImg"]["error"] == 4){
			//no upload image
			//uploading news image is not mandatory
		}else{
			//check uploaded image file type
			if($newsImageExt !== 'jpg' && $newsImageExt !== 'jpeg' && $newsImageExt !== 'png' && $newsImageExt !== 'jfif'){
				array_push($errorsUpdNewsArr, "Invalid news image file type! Please try again!");
			}
		}
		
		//no errors
		if(count($errorsUpdNewsArr) == 0){
			$query = "UPDATE news SET news_title='$newsTitle', news_details='$newsDetails', news_category='$newsCategory', news_image='$newsImage' WHERE news_id='$newsID'";
			
			//Move uploaded image into a folder
			if(move_uploaded_file($_FILES['name']['tmp_name'], $targetImage)){
				$msg = "Image uploaded successfully!";
				}else{
				$msg = "Image uploaded unsuccessfully!";
			}
			
			$runQuery = mysqli_query($dbc, $query);
			
			if($runQuery){
				echo '<script> alert("Data updated!"); </script>';
				header('Location: /205CDE/Assignment/manageNews.php');
				}else{
				echo '<script> alert("Data not update yet!"); </script>';
			}
			}else{
			//display error message in alert
			foreach($errorsUpdNewsArr as $errorsUpdNewsMsg){
				echo '<script type="text/javascript">alert("'.$errorsUpdNewsMsg.'");</script>'; 
			}
			
			//redirect to manageNews.php
			echo '<script type="text/javascript">window.location.href = "/205CDE/Assignment/manageNews.php";</script>'; 
		}
	}
	mysqli_close($dbc);
?>
<?php
	$dbc = mysqli_connect('localhost', 'root', '');	//connect database
	mysqli_select_db($dbc, 'news');	//select database
	
	$errorsUpdNewsArr = array();
	
	if(isset($_POST['updNewsData'])){
		$newsID = $_POST['update_id'];
		$newsTitle = $_POST['txtNewsTitle'];
		$newsDetails = $_POST['txtNewsDetails'];
		$newsCategory = $_POST['selectNewsCategory'];
		
		$targetImage = "/205CDE/Assignment/".basename($_FILES['uploadNewsImg']['name']);
		$newsImage = $_FILES['uploadNewsImg']['name'];
		$newsImageExt = pathinfo($newsImage, PATHINFO_EXTENSION);
		
		//ensure form fields are filled properly
		if(empty($newsTitle)){
			array_push($errorsUpdNewsArr, "News title is required! Please try again!");
		}
		if(empty($newsDetails)){
			array_push($errorsUpdNewsArr, "News details is required! Please try again!");
		}
		if($_FILES["uploadNewsImg"]["error"] == 4){
			//no upload image
			//uploading news image is not mandatory
		}else{
			//check uploaded image file type
			if($newsImageExt !== 'jpg' && $newsImageExt !== 'jpeg' && $newsImageExt !== 'png' && $newsImageExt !== 'jfif'){
				array_push($errorsUpdNewsArr, "Invalid news image file type! Please try again!");
			}
		}
		
		//no errors
		if(count($errorsUpdNewsArr) == 0){
			$query = "UPDATE news SET news_title='$newsTitle', news_details='$newsDetails', news_category='$newsCategory', news_image='$newsImage' WHERE news_id='$newsID'";
			
			//Move uploaded image into a folder
			if(move_uploaded_file($_FILES['name']['tmp_name'], $targetImage)){
				$msg = "Image uploaded successfully!";
				}else{
				$msg = "Image uploaded unsuccessfully!";
			}
			
			$runQuery = mysqli_query($dbc, $query);
			
			if($runQuery){
				echo '<script> alert("Data updated!"); </script>';
				header('Location: /205CDE/Assignment/manageNews.php');
				}else{
				echo '<script> alert("Data not update yet!"); </script>';
			}
			}else{
			//display error message in alert
			foreach($errorsUpdNewsArr as $errorsUpdNewsMsg){
				echo '<script type="text/javascript">alert("'.$errorsUpdNewsMsg.'");</script>'; 
			}
			
			//redirect to manageNews.php
			echo '<script type="text/javascript">window.location.href = "/205CDE/Assignment/manageNews.php";</script>'; 
		}
	}
	mysqli_close($dbc);
?>

Similiar Collections

Python strftime reference pandas.Period.strftime python - Formatting Quarter time in pandas columns - Stack Overflow python - Pandas: Change day - Stack Overflow python - Check if multiple columns exist in a df - Stack Overflow Pandas DataFrame apply() - sending arguments examples python - How to filter a dataframe of dates by a particular month/day? - Stack Overflow python - replace a value in the entire pandas data frame - Stack Overflow python - Replacing blank values (white space) with NaN in pandas - Stack Overflow python - get list from pandas dataframe column - Stack Overflow python - How to drop rows of Pandas DataFrame whose value in a certain column is NaN - Stack Overflow python - How to drop rows of Pandas DataFrame whose value in a certain column is NaN - Stack Overflow python - How to lowercase a pandas dataframe string column if it has missing values? - Stack Overflow How to Convert Integers to Strings in Pandas DataFrame - Data to Fish How to Convert Integers to Strings in Pandas DataFrame - Data to Fish create a dictionary of two pandas Dataframe columns? - Stack Overflow python - ValueError: No axis named node2 for object type <class 'pandas.core.frame.DataFrame'> - Stack Overflow Python Pandas iterate over rows and access column names - Stack Overflow python - Creating dataframe from a dictionary where entries have different lengths - Stack Overflow python - Deleting DataFrame row in Pandas based on column value - Stack Overflow python - How to check if a column exists in Pandas - Stack Overflow python - Import pandas dataframe column as string not int - Stack Overflow python - What is the most efficient way to create a dictionary of two pandas Dataframe columns? - Stack Overflow Python Loop through Excel sheets, place into one df - Stack Overflow python - How do I get the row count of a Pandas DataFrame? - Stack Overflow python - How to save a new sheet in an existing excel file, using Pandas? - Stack Overflow Python Loop through Excel sheets, place into one df - Stack Overflow How do I select a subset of a DataFrame? — pandas 1.2.4 documentation python - Delete column from pandas DataFrame - Stack Overflow python - Convert list of dictionaries to a pandas DataFrame - Stack Overflow How to Add or Insert Row to Pandas DataFrame? - Python Examples python - Check if a value exists in pandas dataframe index - Stack Overflow python - Set value for particular cell in pandas DataFrame using index - Stack Overflow python - Pandas Dataframe How to cut off float decimal points without rounding? - Stack Overflow python - Pandas: Change day - Stack Overflow python - Clean way to convert quarterly periods to datetime in pandas - Stack Overflow Pandas - Number of Months Between Two Dates - Stack Overflow python - MonthEnd object result in <11 * MonthEnds> instead of number - Stack Overflow python - Extracting the first day of month of a datetime type column in pandas - Stack Overflow
MySQL MULTIPLES INNER JOIN How to Use EXISTS, UNIQUE, DISTINCT, and OVERLAPS in SQL Statements - dummies postgresql - SQL OVERLAPS PostgreSQL Joins: Inner, Outer, Left, Right, Natural with Examples PostgreSQL Joins: A Visual Explanation of PostgreSQL Joins PL/pgSQL Variables ( Format Dates ) The Ultimate Guide to PostgreSQL Date By Examples Data Type Formatting Functions PostgreSQL - How to calculate difference between two timestamps? | TablePlus Date/Time Functions and Operators PostgreSQL - DATEDIFF - Datetime Difference in Seconds, Days, Months, Weeks etc - SQLines CASE Statements in PostgreSQL - DataCamp SQL Optimizations in PostgreSQL: IN vs EXISTS vs ANY/ALL vs JOIN PostgreSQL DESCRIBE TABLE Quick and best way to Compare Two Tables in SQL - DWgeek.com sql - Best way to select random rows PostgreSQL - Stack Overflow PostgreSQL: Documentation: 13: 70.1. Row Estimation Examples Faster PostgreSQL Counting How to Add a Default Value to a Column in PostgreSQL - PopSQL How to Add a Default Value to a Column in PostgreSQL - PopSQL SQL Subquery - Dofactory SQL IN - SQL NOT IN - JournalDev DROP FUNCTION (Transact-SQL) - SQL Server | Microsoft Docs SQL : Multiple Row and Column Subqueries - w3resource PostgreSQL: Documentation: 9.5: CREATE FUNCTION PostgreSQL CREATE FUNCTION By Practical Examples datetime - PHP Sort a multidimensional array by element containing date - Stack Overflow database - Oracle order NULL LAST by default - Stack Overflow PostgreSQL: Documentation: 9.5: Modifying Tables PostgreSQL: Documentation: 14: SELECT postgresql - sql ORDER BY multiple values in specific order? - Stack Overflow How do I get the current unix timestamp from PostgreSQL? - Database Administrators Stack Exchange SQL MAX() with HAVING, WHERE, IN - w3resource linux - Which version of PostgreSQL am I running? - Stack Overflow Copying Data Between Tables in a Postgres Database php - How to remove all numbers from string? - Stack Overflow sql - How to get a list column names and datatypes of a table in PostgreSQL? - Stack Overflow postgresql - How do I remove all spaces from a field in a Postgres database in an update query? - Stack Overflow sql - How to get a list column names and datatypes of a table in PostgreSQL? - Stack Overflow How to change PRIMARY KEY of an existing PostgreSQL table? · GitHub Drop tables w Dependency Tracking ( constraints ) Import CSV File Into PosgreSQL Table How To Import a CSV into a PostgreSQL Database How can I drop all the tables in a PostgreSQL database? - Stack Overflow How can I drop all the tables in a PostgreSQL database? - Stack Overflow PostgreSQL CASE Statements & Examples using WHEN-THEN, if-else and switch | DataCamp PostgreSQL LEFT: Get First N Characters in a String How can I drop all the tables in a PostgreSQL database? - Stack Overflow How can I drop all the tables in a PostgreSQL database? - Stack Overflow PostgreSQL - Copy Table - GeeksforGeeks PostgreSQL BETWEEN Query with Example sql - Postgres Query: finding values that are not numbers - Stack Overflow PostgreSQL UPDATE Join with A Practical Example
Request API Data with JavaScript or PHP (Access a Json data with PHP API) PHPUnit – The PHP Testing Framework phpspec array_column How to get closest date compared to an array of dates in PHP Calculating past and future dates < PHP | The Art of Web PHP: How to check which item in an array is closest to a given number? - Stack Overflow implode php - Calculate difference between two dates using Carbon and Blade php - Create a Laravel Request object on the fly testing - How can I measure the speed of code written in PHP? testing - How can I measure the speed of code written in PHP? What to include in gitignore for a Laravel and PHPStorm project Laravel Chunk Eloquent Method Example - Tuts Make html - How to solve PHP error 'Notice: Array to string conversion in...' - Stack Overflow PHP - Merging two arrays into one array (also Remove Duplicates) - Stack Overflow php - Check if all values in array are the same - Stack Overflow PHP code - 6 lines - codepad php - Convert array of single-element arrays to one a dimensional array - Stack Overflow datetime - PHP Sort a multidimensional array by element containing date - Stack Overflow sql - Division ( / ) not giving my answer in postgresql - Stack Overflow Get current date, given a timezone in PHP? - Stack Overflow php - Get characters after last / in url - Stack Overflow Add space after 7 characters - PHP Coding Help - PHP Freaks php - Laravel Advanced Wheres how to pass variable into function? - Stack Overflow php - How can I manually return or throw a validation error/exception in Laravel? - Stack Overflow php - How to add meta data in laravel api resource - Stack Overflow php - How do I create a webhook? - Stack Overflow Webhooks - Examples | SugarOutfitters Accessing cells - PhpSpreadsheet Documentation Reading and writing to file - PhpSpreadsheet Documentation PHP 7.1: Numbers shown with scientific notation even if explicitely formatted as text · Issue #357 · PHPOffice/PhpSpreadsheet · GitHub How do I install Java on Ubuntu? nginx - How to execute java command from php page with shell_exec() function? - Stack Overflow exec - Executing a java .jar file with php - Stack Overflow Measuring script execution time in PHP - GeeksforGeeks How to CONVERT seconds to minutes? PHP: Check if variable exist but also if has a value equal to something - Stack Overflow How to declare a global variable in php? - Stack Overflow How to zip a whole folder using PHP - Stack Overflow php - Saving file into a prespecified directory using FPDF - Stack Overflow PHP 7.0 get_magic_quotes_runtime error - Stack Overflow How to Create an Object Without Class in PHP ? - GeeksforGeeks Recursion in PHP | PHPenthusiast PHP PDO Insert Tutorial Example - DEV Community PHP Error : Unparenthesized `a ? b : c ? d : e` is deprecate | Laravel.io mysql - Which is faster: multiple single INSERTs or one multiple-row INSERT? - Stack Overflow Display All PHP Errors: Basic & Advanced Usage Need to write at beginning of file with PHP - Stack Overflow Append at the beginning of the file in PHP - Stack Overflow PDO – Insert, update, and delete records in PHP – BrainBell php - How to execute a raw sql query with multiple statement with laravel - Stack Overflow
Clear config cache Eloquent DB::Table RAW Query / WhereNull Laravel Eloquent "IN" Query get single column value in laravel eloquent php - How to use CASE WHEN in Eloquent ORM? - Stack Overflow AND-OR-AND + brackets with Eloquent - Laravel Daily Database: Query Builder - Laravel - The PHP Framework For Web Artisans ( RAW ) Combine Foreach Loop and Eloquent to perform a search | Laravel.io Access Controller method from another controller in Laravel 5 How to Call a controller function in another Controller in Laravel 5 php - Create a Laravel Request object on the fly php - Laravel 5.6 Upgrade caused Logging to break Artisan Console - Laravel - The PHP Framework For Web Artisans What to include in gitignore for a Laravel and PHPStorm project php - Create a Laravel Request object on the fly Process big DB table with chunk() method - Laravel Daily How to insert big data on the laravel? - Stack Overflow php - How can I build a condition based query in Laravel? - Stack Overflow Laravel Chunk Eloquent Method Example - Tuts Make Database: Migrations - Laravel - The PHP Framework For Web Artisans php - Laravel Model Error Handling when Creating - Exception Laravel - Inner Join with Multiple Conditions Example using Query Builder - ItSolutionStuff.com laravel cache disable phpunit code example | Newbedev In PHP, how to check if a multidimensional array is empty? · Humblix php - Laravel firstOrNew how to check if it's first or new? - Stack Overflow get base url laravel 8 Code Example Using gmail smtp via Laravel: Connection could not be established with host smtp.gmail.com [Connection timed out #110] - Stack Overflow php - Get the Last Inserted Id Using Laravel Eloquent - Stack Overflow php - Laravel-5 'LIKE' equivalent (Eloquent) - Stack Overflow Accessing cells - PhpSpreadsheet Documentation How to update chunk records in Laravel php - How to execute external shell commands from laravel controller? - Stack Overflow How to convert php array to laravel collection object 3 Best Laravel Redis examples to make your site load faster How to Create an Object Without Class in PHP ? - GeeksforGeeks Case insensitive search with Eloquent | Laravel.io How to Run Specific Seeder in Laravel? - ItSolutionStuff.com PHP Error : Unparenthesized `a ? b : c ? d : e` is deprecate | Laravel.io How to chunk query results in Laravel php - How to execute a raw sql query with multiple statement with laravel - Stack Overflow
PostgreSQL POSITION() function PostgresQL ANY / SOME Operator ( IN vs ANY ) PostgreSQL Substring - Extracting a substring from a String How to add an auto-incrementing primary key to an existing table, in PostgreSQL PostgreSQL STRING_TO_ARRAY()function mysql FIND_IN_SET equivalent to postgresql PL/pgSQL Variables ( Format Dates ) The Ultimate Guide to PostgreSQL Date By Examples Data Type Formatting Functions PostgreSQL - How to calculate difference between two timestamps? | TablePlus Date/Time Functions and Operators PostgreSQL - DATEDIFF - Datetime Difference in Seconds, Days, Months, Weeks etc - SQLines CASE Statements in PostgreSQL - DataCamp SQL Optimizations in PostgreSQL: IN vs EXISTS vs ANY/ALL vs JOIN PL/pgSQL Variables PostgreSQL: Documentation: 11: CREATE PROCEDURE Reading a Postgres EXPLAIN ANALYZE Query Plan Faster PostgreSQL Counting sql - Fast way to discover the row count of a table in PostgreSQL - Stack Overflow PostgreSQL: Documentation: 9.1: tablefunc PostgreSQL DESCRIBE TABLE Quick and best way to Compare Two Tables in SQL - DWgeek.com sql - Best way to select random rows PostgreSQL - Stack Overflow How to Add a Default Value to a Column in PostgreSQL - PopSQL How to Add a Default Value to a Column in PostgreSQL - PopSQL PL/pgSQL IF Statement PostgreSQL: Documentation: 9.1: Declarations SQL Subquery - Dofactory SQL IN - SQL NOT IN - JournalDev PostgreSQL - IF Statement - GeeksforGeeks How to work with control structures in PostgreSQL stored procedures: Using IF, CASE, and LOOP statements | EDB PL/pgSQL IF Statement How to combine multiple selects in one query - Databases - ( loop reference ) DROP FUNCTION (Transact-SQL) - SQL Server | Microsoft Docs SQL : Multiple Row and Column Subqueries - w3resource PostgreSQL: Documentation: 9.5: CREATE FUNCTION PostgreSQL CREATE FUNCTION By Practical Examples datetime - PHP Sort a multidimensional array by element containing date - Stack Overflow database - Oracle order NULL LAST by default - Stack Overflow PostgreSQL: Documentation: 9.5: Modifying Tables PostgreSQL: Documentation: 14: SELECT PostgreSQL Array: The ANY and Contains trick - Postgres OnLine Journal postgresql - sql ORDER BY multiple values in specific order? - Stack Overflow sql - How to aggregate two PostgreSQL columns to an array separated by brackets - Stack Overflow How do I get the current unix timestamp from PostgreSQL? - Database Administrators Stack Exchange SQL MAX() with HAVING, WHERE, IN - w3resource linux - Which version of PostgreSQL am I running? - Stack Overflow Postgres login: How to log into a Postgresql database | alvinalexander.com Copying Data Between Tables in a Postgres Database PostgreSQL CREATE FUNCTION By Practical Examples php - How to remove all numbers from string? - Stack Overflow sql - How to get a list column names and datatypes of a table in PostgreSQL? - Stack Overflow postgresql - How do I remove all spaces from a field in a Postgres database in an update query? - Stack Overflow sql - How to get a list column names and datatypes of a table in PostgreSQL? - Stack Overflow A Step-by-Step Guide To PostgreSQL Temporary Table How to change PRIMARY KEY of an existing PostgreSQL table? · GitHub PostgreSQL UPDATE Join with A Practical Example PostgreSQL: Documentation: 15: CREATE SEQUENCE How can I drop all the tables in a PostgreSQL database? - Stack Overflow PostgreSQL Show Tables Drop tables w Dependency Tracking ( constraints ) Import CSV File Into PosgreSQL Table How To Import a CSV into a PostgreSQL Database How can I drop all the tables in a PostgreSQL database? - Stack Overflow How can I drop all the tables in a PostgreSQL database? - Stack Overflow PostgreSQL CASE Statements & Examples using WHEN-THEN, if-else and switch | DataCamp PostgreSQL LEFT: Get First N Characters in a String How can I drop all the tables in a PostgreSQL database? - Stack Overflow How can I drop all the tables in a PostgreSQL database? - Stack Overflow postgresql - Binary path in the pgAdmin preferences - Database Administrators Stack Exchange postgresql - Binary path in the pgAdmin preferences - Database Administrators Stack Exchange PostgreSQL - Copy Table - GeeksforGeeks postgresql duplicate key violates unique constraint - Stack Overflow PostgreSQL BETWEEN Query with Example VACUUM FULL - PostgreSQL wiki How To Remove Spaces Between Characters In PostgreSQL? - Database Administrators Stack Exchange sql - Postgres Query: finding values that are not numbers - Stack Overflow PostgreSQL LEFT: Get First N Characters in a String unaccent: Getting rid of umlauts, accents and special characters
כמה עוד נשאר למשלוח חינם גם לעגלה ולצקאאוט הוספת צ'קבוקס לאישור דיוור בצ'קאאוט הסתרת אפשרויות משלוח אחרות כאשר משלוח חינם זמין דילוג על מילוי כתובת במקרה שנבחרה אפשרות איסוף עצמי הוספת צ'קבוקס לאישור דיוור בצ'קאאוט שינוי האפשרויות בתפריט ה-סידור לפי בווקומרס שינוי הטקסט "אזל מהמלאי" הערה אישית לסוף עמוד העגלה הגבלת רכישה לכל המוצרים למקסימום 1 מכל מוצר קבלת שם המוצר לפי ה-ID בעזרת שורטקוד הוספת כפתור וואטסאפ לקנייה בלופ ארכיון מוצרים הפיכה של מיקוד בצ'קאאוט ללא חובה מעבר ישיר לצ'קאאוט בלחיתה על הוספה לסל (דילוג עגלה) התראה לקבלת משלוח חינם בדף עגלת הקניות גרסה 1 התראה לקבלת משלוח חינם בדף עגלת הקניות גרסה 2 קביעה של מחיר הזמנה מינימלי (מוצג בעגלה ובצ'קאאוט) העברת קוד הקופון ל-ORDER REVIEW העברת קוד הקופון ל-ORDER REVIEW Kadence WooCommerce Email Designer קביעת פונט אסיסנט לכל המייל בתוסף מוצרים שאזלו מהמלאי - יופיעו מסומנים באתר, אבל בתחתית הארכיון הוספת כפתור "קנה עכשיו" למוצרים הסתרת אפשרויות משלוח אחרות כאשר משלוח חינם זמין שיטה 2 שינוי סימן מטבע ש"ח ל-ILS להפוך סטטוס הזמנה מ"השהייה" ל"הושלם" באופן אוטומטי תצוגת הנחה באחוזים שינוי טקסט "בחר אפשרויות" במוצרים עם וריאציות חיפוש מוצר לפי מק"ט שינוי תמונת מוצר לפי וריאציה אחרי בחירה של וריאציה אחת במקרה של וריאציות מרובות הנחה קבועה לפי תפקיד בתעריף קבוע הנחה קבועה לפי תפקיד באחוזים הסרה של שדות משלוח לקבצים וירטואליים הסתרת טאבים מעמוד מוצר הצגת תגית "אזל מהמלאי" בלופ המוצרים להפוך שדות ל-לא חובה בצ'קאאוט שינוי טקסט "אזל מהמלאי" לוריאציות שינוי צבע ההודעות המובנות של ווקומרס הצגת ה-ID של קטגוריות המוצרים בעמוד הקטגוריות אזל מהמלאי- שינוי ההודעה, תגית בלופ, הודעה בדף המוצר והוספת אזל מהמלאי על וריאציה הוספת שדה מחיר ספק לדף העריכה שינוי טקסט אזל מהמלאי תמונות מוצר במאונך לצד תמונת המוצר הראשית באלמנטור הוספת כפתור קנה עכשיו לעמוד המוצר בקניה הזו חסכת XX ש''ח לאפשר למנהל חנות לנקות קאש ברוקט לאפשר רק מוצר אחד בעגלת קניות הוספת סימון אריזת מתנה ואזור להוראות בצ'קאאוט של ווקומרס הצגת הנחה במספר (גודל ההנחה) הוספת "אישור תקנון" לדף התשלום הצגת רשימת תכונות המוצר בפרונט שינוי כמות מוצרים בצ'קאאוט ביטול השדות בצ'קאאוט שינוי כותרות ופלייסהולדר של השדות בצ'קאאוט