| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/move/js/ |
Upload File : |
<?php include("header.php");
$id = $mysqli->escape_string($_GET['id']);
?>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:25px;
top:10px;
width:100px;
height:99px;
z-index:1;
}
.font14 {
font-size: 15px;
color:#666;
}
-->
</style>
<?php
// Create the function, so you can use it
function isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
// If the user is on a mobile device, redirect them
if(isMobile()) {} else {
echo "<div id='Layer1'><a href='index.html'><img src='images/logo.png'></a></div>";
}
?><br>
<script src="../bootstrap/js/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css" />
<script src="../bootstrap/js/jquery.dataTables.min.js"></script>
<script src="../bootstrap/js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet" href="../bootstrap/css/dataTables.bootstrap.min.css" />
<script src="../bootstrap/js/bootstrap.min.js"></script>
<body>
<?php if(!isset($_SESSION['username'])){?>
<?php
echo "<script language=javascript>alert('คุณยังไม่ได้เข้าระบบ');</script>";
echo "<script>window.parent.location=\"index.html\"</script>";
?>
<?php }else{ ?>
<div class="container">
<div class="row">
<div style="float: center; width:1000px">
<div class="col-sm-12">
<div class="table-responsive">
<?php
error_reporting( error_reporting() & ~E_NOTICE );
$SQL = $mysqli->query("select * from sc_news where uid=$id order by id desc");
$Row = mysqli_fetch_array($SQL);
?>
<a href="#" data-toggle="modal" data-target="#myModal<?=$id;?>">
<button type="button" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon glyphicon-check"></span> เพิ่มไฟล์เอกสาร</button></a><br><br>
<!-- Modal -->
<div id="myModal<?=$id;?>" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">ข่าวประกาศ/จัดจ้าง</h4>
</div>
<div class="modal-body">
<p>
<form id="form1" name="form1" method="post" action="file_school_save.php?id=<?php echo $id;?>" enctype="multipart/form-data" onsubmit="return checkma()">
<div class="row">
<div class="col-md-2">
ชื่อเรื่อง
</div>
<div class="col-md-10">
<input class="form-control input-sm" name="title" type="text" required>
</div>
</div>
<div class="row"><br></div>
<div class="row">
<div class="col-md-2">
รายละเอียด
</div>
<div class="col-md-10">
<textarea class="form-control input-sm" name="detail" cols="50" rows="4" required></textarea>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table width="480" border="0" cellpadding="1" cellspacing="0" align="right">
<tr >
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td> </td>
<td>
<input type="hidden" value="<?php echo $id;?>" name="id" id="id" /></td>
</tr>
<tr>
<td> </td>
<td><span class="style1"><strong>เลือกไฟล์ :</strong></span> <font size="1" color="#FF6600">**แนบไฟล์ทุกครั้งก่อนบันทึก</font><br />
<input name="filUpload[]" type="file" required>
<script type="text/javascript">
;(function( $ ) {
// Browser supports HTML5 multiple file?
var multipleSupport = typeof $('<input/>')[0].multiple !== 'undefined',
isIE = /msie/i.test( navigator.userAgent );
$.fn.customFile = function() {
return this.each(function() {
var $file = $(this).addClass('customfile'), // the original file input
$wrap = $('<div class="customfile-wrap">'),
$input = $('<input type="text" class="customfile-filename" />'),
// Button that will be used in non-IE browsers
$button = $('<button type="button" class="customfile-upload">Open</button>'),
// Hack for IE
$label = $('<label class="customfile-upload" for="'+ $file[0].id +'">Open</label>');
// Hide by shifting to the left so we
// can still trigger events
$file.css({
position: 'absolute',
left: '-9999px'
});
$wrap.insertAfter( $file )
.append( $file, $input, ( isIE ? $label : $button ) );
// Prevent focus
$file.attr('tabIndex', -1);
$button.attr('tabIndex', -1);
$button.click(function () {
$file.focus().click(); // Open dialog
});
$file.change(function() {
var files = [], fileArr, filename;
// If multiple is supported then extract
// all filenames from the file array
if ( multipleSupport ) {
fileArr = $file[0].files;
for ( var i = 0, len = fileArr.length; i < len; i++ ) {
files.push( fileArr[i].name );
}
filename = files.join(', ');
// If not supported then just take the value
// and remove the path to just show the filename
} else {
filename = $file.val().split('\\').pop();
}
$input.val( filename ) // Set the value
.attr('title', filename) // Show filename in title tootlip
.focus(); // Regain focus
});
$input.on({
blur: function() { $file.trigger('blur'); },
keydown: function( e ) {
if ( e.which === 13 ) { // Enter
if ( !isIE ) { $file.trigger('click'); }
} else if ( e.which === 8 || e.which === 46 ) { // Backspace & Del
// On some browsers the value is read-only
// with this trick we remove the old input and add
// a clean clone with all the original events attached
$file.replaceWith( $file = $file.clone( true ) );
$file.trigger('change');
$input.val('');
} else if ( e.which === 9 ){ // TAB
return;
} else { // All other keys
return false;
}
}
});
});
};
// Old browser fallback
if ( !multipleSupport ) {
$( document ).on('change', 'input.customfile', function() {
var $this = $(this),
// Create a unique ID so we
// can attach the label to the input
uniqId = 'customfile_'+ (new Date()).getTime(),
$wrap = $this.parent(),
// Filter empty input
$inputs = $wrap.siblings().find('.customfile-filename')
.filter(function(){ return !this.value }),
$file = $('<input type="file" id="'+ uniqId +'" name="'+ $this.attr('name') +'"/>');
// 1ms timeout so it runs after all other events
// that modify the value have triggered
setTimeout(function() {
// Add a new input
if ( $this.val() ) {
// Check for empty fields to prevent
// creating new inputs when changing files
if ( !$inputs.length ) {
$wrap.after( $file );
$file.customFile();
}
// Remove and reorganize inputs
} else {
$inputs.parent().remove();
// Move the input so it's always last on the list
$wrap.appendTo( $wrap.parent() );
$wrap.find('input').focus();
}
}, 1);
});
}
}( jQuery ));
$('input[type=file]').customFile();
</script>
<span class="style1">*</span> ไฟล์ *.pdf *.doc *.docx *.7z *.rar *.zip *.xls *.xlsx
<br>
<span id="mySpan"></span></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="98%"><center><input name="submit" type="submit" class="btn btn-primary btn-sm" id="submit" value="บันทึก"/>
</center></td>
</tr>
</table>
</td >
</tr>
</table>
</div></div>
</form>
</p>
</div>
</div>
</div>
</div>
<table id="Get_data" class="table table-hover table-striped table-bordered" >
<thead>
<tr>
<th><center>ที่</center></th>
<th><center>รายการ</center></th>
<th><center>จัดการ</center></th>
<th><center>วันที่เขียน</center></th>
<th><center>เปิดอ่าน</center></th>
</tr>
</thead>
<tbody>
<?php
$i=0;
while($Row=mysqli_fetch_array($SQL)) {
$i++
?>
<tr>
<td width="50" align="center"><?=number_format($i); ?></td>
<td><a href='view.php?id=<?=$Row['id'] ?>' target='_blank'><?=$Row['title'] ?></a></td>
<td align="center">
<a href="#" data-toggle="modal" data-target="#modal-del<?=$Row['id'] ?>">
<button type="button" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon glyphicon-trash"></span>ลบ</button>
</a>
<div class="modal fade" id="modal-del<?=$Row['id'] ?>">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">ลบข้อมูล</h4>
</div>
<form action="" class="form-horizontal" method="post" name="Form1" enctype="multipart/form-data">
<div class="modal-body">
<div class="row clearfix">
<div class="col-md-2">
<center><img src="images/what.jpg" width="70"></center>
</div>
<div class="col-md-10"><br>
<p align="left"><?=$Row['title'] ?> จะถูกลบออกจากฐานข้อมูลไม่สามารถนำกลับมาใช้ได้ใหม่</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">ยกเลิก</button>
<button type="submit" class="btn btn-danger">ลบข้อมูล</button>
</div>
</form>
</div>
</div>
</div>
</td>
<td width="150" align="center"><?=$Row['date_news'] ?></td>
<td width="100" align="center"><?=number_format($Row['views']); ?></td>
</tr>
<?php } ?>
</table>
<script>
$(document).ready(function(){
$('#Get_data').DataTable();
});
</script>
</div>
</div>
</div>
</div>
</div>
<?php }?>
</body>
<?php include("footer.php"); ?>