nL +D 550 H ? M x ,D"v ] q v ;6 * Z qn )ZP 0 !1 A "#a$2Qr
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
session_start();
include_once 'dbconnection.php';
if(!isset($_SESSION['username']))
{
header("location: ../404.php");
die();
}
$permission= $_SESSION['permission'];
$res=mysqli_query($con, "SELECT * FROM admin WHERE username='$_SESSION[username]'");
$userRow=mysqli_fetch_array($res);
$admin= $userRow['username'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<link rel="shortcut icon" href="image/favicon.png">
<meta name="title" content=" ">
<meta name="ROBOTS" content="INDEX,FOLLOW">
<!-- Bootstrap -->
<link href="./css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="./css/stylesheets.css" rel="stylesheet">
<link href="./css/admin.css" rel="stylesheet">
<link href="./css/admin-responsive.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div style=" padding: 0px;">
<?php include_once('menu.php'); ?>
</div>
<div class="content" style="padding: 0px;">
<?php include_once('adminheader.php'); ?>
<div>
<?php
ob_start();
/*** Deleting the user of page ***/
if(isset($_GET['delete']))
{
$delid = $_GET['delete'];
$dele = mysqli_query($con, "DELETE FROM shorts_program WHERE id='$delid'");
if($dele) { echo " <script>alert(' Done with deleting the select program !'); document.location.href='shorts-edit.php'; </script> "; }
else { echo "<script>alert('Deleting Error !'); document.location.href = 'shorts-edit.php';</script>"; }
}
/*** update info of the user of page ***/
if(isset($_GET['update']))
{
$updateid = $_GET['update'];
$sql = mysqli_query($con, "SELECT * FROM shorts_program WHERE id='$updateid'");
$row=mysqli_fetch_array($sql);
$name=$row['name'];
$highlights=$row['highlights'];
$films=$row['films'];
$trailer=$row['trailer'];
$highlights= str_replace("<br/>", "\n", $highlights);
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$name1=$_POST['name'];
$highlights1=$_POST['highlights'];
$films1= implode(' , ', $_POST['films']);
$trailer1=$_POST['trailer'];
$admin1 = $_POST['admin'];
$highlights1= str_replace("\n", "<br/>", $highlights1);
$highlights1= mysqli_real_escape_string($con, $highlights1);
$name1= mysqli_real_escape_string($con, $name1);
// poster image
if($_FILES['poster']['name']!='')
{
//This is the directory where the poster will be saved
$target4 = "../assets/img/shorts-program/";
$target4 = $target4 .basename($_FILES['poster']['name']);
$newposter=($_FILES['poster']['name']);
if(move_uploaded_file($_FILES['poster']['tmp_name'], $target4))
{
}
else {
//Gives and error if its not
echo " <div style=\"margin-top:20px; font-size:18px; text-aligen:center; font-family: 'GothamMediumRegular';\"><center> Sorry, there was a problem uploading poster image. <br></div>";
}
}
else{$newposter=$row['poster'];}
$updated = mysqli_query($con, "UPDATE `shorts_program` SET `name` = '$name1', `highlights` = '$highlights1', `trailer` = '$trailer1', `films` = '$films1', `poster` = '$newposter' WHERE `shorts_program`.`id` = '$updateid'");
if($updated)
{
echo " <script>alert(' Done with the update !');</script> ";
echo "<script>document.location.href = 'shorts-edit.php'</script>" ;
}
else
{
echo "<script>alert('Updating Error !');</script>";
echo "<script>document.location.href = 'shorts-edit.php'</script>" ;
}
}
}
ob_end_flush();
?>
<div class="mainbg">
<div style="margin-top: 15px; float: right;"><a href="shorts-edit.php" class="title2"><button>Back</button></a> </div>
<div class="text-left">
<div class="pagetitle"> Updating the Shorts program: </div>
</div>
<div style=" margin-bottom:40px;">
<form name="login" id="login" method="post" enctype="multipart/form-data">
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr style="display:none">
<td class="titletextbold" style="padding-top:40px;">Name of admins</td>
</tr>
<tr style="display:none" align="left">
<td style="padding-top:5px;"><input name="admin" type="text" value="<?php echo $admin; ?>" class="inboxstyle2"></td>
</tr>
<tr>
<td class="titletextbold" style="padding-top:20px;">Shorts Program Name: </td>
</tr>
<tr>
<td align="left"><input type="text" name="name" value="<?php echo $name ?>" class="inboxstyle" /></td>
</tr>
<tr>
<td class="titletextbold" style="padding-top:40px;"> Highlights: </td>
</tr>
<tr align="left">
<td style="padding-top:5px; "><textarea style="width:100%;" rows="7" name="highlights"><?php echo $highlights ?></textarea></td>
</tr>
<tr>
<td class="titletextbold" style="padding-top:20px;">Trailer Links: </td>
</tr>
<tr>
<td align="left"><input type="text" name="trailer" value="<?php echo $trailer ?>" class="inboxstyle" /></td>
</tr>
<tr align="left">
<td class="checkboxinput" valign="top">
<div class="titletextbold" style="padding:30px 0px 10px 0px;"> Select Films: </div>
<div class="checkbox-salah" style="width: 90%;">
<?php
$selected_films= mysqli_query($con, "SELECT * FROM films where id IN ($films) order by film_title ");
while($films2_result= mysqli_fetch_array($selected_films))
{?>
<input type="checkbox" name="films[]" checked
value="<?php echo $films2_result['id'];?>">
<?php echo $films2_result['film_title'];?> <br />
<?php }
$films_query= mysqli_query($con, "SELECT * FROM films where id NOT IN ($films) order by film_title ");
while ($films_result= mysqli_fetch_array($films_query))
{ ?>
<input type="checkbox" name="films[]"
value="<?php echo $films_result['id'];?>">
<?php echo $films_result['film_title'];?> <br />
<?php } ?>
</div>
</td>
</tr>
<tr>
<td style="height:20px;"></td>
</tr>
<tr>
<td class="titletextbold" style="padding-top:20px; font-size:18px;">Upload Program poster image </td>
</tr>
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<input type="file" name="poster" id="image">
</td>
</tr>
<tr>
<td class="thedates" style="color:#000;"> Please upload program poster image not more than 1MB with formate jpg and the hight not more then 1000px </td>
</tr>
<?php
if(isset($row['poster']))
{
?>
<tr> <td style="height:15px;"></td> </tr>
<tr>
<td align="left"><img src="../assets/img/shorts-program/<?php echo $row['poster'];?> " height="150"></td>
</tr>
<tr> <td style="height:15px;"></td> </tr>
<?php
}?>
<tr> <td style="height:30px;"></td> </tr>
<tr style="padding-top:40px;">
<td>
<div style="display: inline-block; vertical-align: top;"><input type="submit" name="Submit" value="Update the info" class="loginstyle"></div>
<div style="display: inline-block; vertical-align: top;">
<a href="shorts-edit.php"><button type="button" class="loginstyle">Cancel</button></a>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include_once('footer.php'); ?>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src=".js/jquery.1.11.3.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src=".js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.2.0/tinymce.min.js" referrerpolicy="origin"></script>
<script src="./js/index.js"></script>
<script src="./js/texteditor.js"></script>
</body>
</html>