| Server IP : 172.64.80.1 / Your IP : 172.70.50.62 Web Server : Apache System : Linux mail.federalpolyede.edu.ng 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 User : federalpolyede.edu.ng_idh35skikv ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/federalpolyede.edu.ng/httpdocs/admin_main/ |
Upload File : |
<?php
/**
* Created by PhpStorm.
* User: Samuel Johnson AC
* Date: 09/01/2014
* Time: 10:37 AM
*/
require_once('headMain_sidebar.php');
extract($_POST);
require_once('../connect.php');
if (isset($_GET['nid'])) {
$db=ExecuteQuery("update tblnews set Is_Live= not (Is_Live) where ID=" . $_GET['nid']);
echo "<script> alert('The news item was successfully moved.');</script>";
}
if (isset($_GET['did'])) {
$db=ExecuteQuery("Delete from tblnews where ID=" . $_GET['did']);
echo "<script> alert('The news item was successfully deleted.');</script>";
}
if (isset($title)){
if (!isset($lives )) $lives=0;
$target_dir = "filetoU/";
$target_file = $target_dir . basename($_FILES["att_1"]["name"]);
$db = ExecuteQuery("insert into tblnews (News_Title,News_Content,Attachment_Url,Is_Live) Values('".$title . "','".$content ."','".$target_file."',". $lives .")");
echo "<script> alert('The News Item Has Been Saved.');</script>";
$target_file = "../" . $target_file ;
if (move_uploaded_file($_FILES["att_1"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["att_1"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
// echo "<script>alert($title);</script>";
}
?><!--
<script>alert('ook');</script>
-->
<!-- DataTables CSS -->
<div id="page-wrapperX">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">News</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
News Details
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<form role="form" method="post" action="proadmin.php" enctype="multipart/form-data" >
<div class="form-group">
<label>News Title</label>
<input name="title" class="form-control" placeholder="Enter text">
</div>
<div class="form-group">
<label>News Content</label>
<textarea name="content" class="form-control" rows="3"></textarea>
</div>
<div class="form-group">
<label>Attachment</label>
<input name="att_1" id="att_1" type="file">
</div>
<div class="form-group">
<div class="checkbox">
<label>
<input name="lives" type="checkbox" value="1">Is Live
</label>
</div>
</div>
<button type="submit" class="btn btn-default">Save</button>
<button type="reset" class="btn btn-default">Reset</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
All News
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>SN</th>
<th>News Title</th>
<th>News Content</th>
<th>Attachment Url</th>
<th>Is Live</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$result=ExecuteQuery("select * from tblnews order by ID");
$sNews="";
$a='';
$i=0;
while ($row=$result->fetch(PDO::FETCH_BOTH)) {
$i++;
?>
<tr class="odd gradeX">
<td><?php echo $i ?></td>
<td><?php echo $row['News_Title'] ?></td>
<td> <?php echo $row['News_Content'] ?></td>
<td class="center"><?php echo $row['Attachment_Url'] ?></td>
<td class="center"><?php
if ($row['Is_Live']==true)
echo 'Yes';
else
echo 'No';
?></td>
<td><?php
if ($row['Is_Live']==1)
{ echo '<a href="proadmin.php?nid='. $row['ID'] . '"> Take Offline </a>';}
else
{ echo '<a href="proadmin.php?nid='. $row['ID'] . '"> Push Online </a>';}
?>
</td>
<td><?php echo '<a href="proadmin.php?did='. $row['ID'] . '"> Delete</a>' ?> </td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery -->
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- DataTables JavaScript -->
<script src="../bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="../bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
<?php
require_once('footMain.php');
?>