| Server IP : 172.67.187.206 / Your IP : 172.71.28.155 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 : E:/Inetpub/www/myschool/kanchana/modules/publish/ |
Upload File : |
<?
CheckUser($_SESSION['user_user'], $_SESSION['user_pwd']);
?>
<TABLE cellSpacing=0 cellPadding=0 width=100% height=500 border=0>
<TBODY>
<TR>
<TD width="100%" vAlign=top>
<BR>
<TABLE width="600" bgcolor=FFFFFF align=center cellSpacing=0 cellPadding=0 border=0 background="images/124.jpg">
<TR>
<TD vAlign=top>
<BR>
<?
if($_GET[op] == "publish_edit" AND $_GET[action] == "edit"){
//////////////////////////////////////////// กรณีเพิ่ม Database
if(CheckLevelUser($_SESSION['user_user'],$_GET[op])){
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$res[user] = $db->select_query("SELECT * FROM ".TB_user." WHERE username='".$_SESSION['user_user']."' ");
$arr[user] = $db->fetch($res[user]);
//ดึงค่า
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$res[publish] = $db->select_query("SELECT * FROM ".TB_PUBLISH." WHERE id='".$_GET[id]."' ");
$arr[publish] = $db->fetch($res[publish]);
$db->closedb ();
$FILE = $_FILES['files1'];
$FILE = $_FILES['files2'];
$FILE = $_FILES['files3'];
$FILE = $_FILES['files4'];
if (!$_POST[CATEGORY] ){
echo "<script language='javascript'>" ;
echo "alert('กรุณากรอกข้อมูลต่างๆให้ครบถ้วน')" ;
echo "</script>" ;
echo "<script language='javascript'>javascript:history.back()</script>";
exit();
}
//==========================================================================================
//======================================================== BEGIN ===== UPLOAD 1 ============
//==========================================================================================
if($_FILES["files1"]["tmp_name"] != "")
{
$upload = $_FILES["files1"]["tmp_name"];
$upload_file = $_FILES["files1"]["type"];
require 'includes/gen_file_name.php';
$upload_time=$gen_file_name;
//ตรวจสอบชนิดของไฟล์
if (( $upload_file!="application/pdf" ) AND ($upload_file!="application/msword") AND ($upload_file!="application/vnd.ms-excel") AND ($upload_file!="application/vnd.openxmlformats-officedocument.wordprocessingml.document") AND ($upload_file!="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") AND ($upload_file!="application/x-zip-compressed")){
echo "<script language='javascript'>" ;
echo "alert('กรุณาใช้ไฟล์ .pdf .doc .xls .zip ')" ;
echo "</script>" ;
echo "<script language='javascript'>javascript:history.back()</script>";
exit();
}
#แปลงนามสกุล และทำการ upload
if( $upload_file == "application/pdf" )
{
$filename = $upload_name.".pdf";
}
if( $upload_file == "application/msword" )
{
$filename = $upload_name.".doc";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" )
{
$filename = $upload_name.".docx";
}
if( $upload_file == "application/vnd.ms-excel" )
{
$filename = $upload_name.".xls";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" )
{
$filename = $upload_name.".xlsx";
}
if( $upload_file == "application/x-zip-compressed" )
{
$filename = $upload_name.".zip";
}
$new1_upload = $upload_time.$filename;
copy($_FILES["files1"]["tmp_name"], "data/publish/$new1_upload");
//======================================================== BEGIN ===== UPLOAD 2 ============
if($_FILES["files2"]["tmp_name"] != "")
{
$upload = $_FILES["files2"]["tmp_name"];
$upload_file = $_FILES["files2"]["type"];
require 'includes/gen_file_name.php';
$upload_time=$gen_file_name;
//ตรวจสอบชนิดของไฟล์
if (( $upload_file!="application/pdf" ) AND ($upload_file!="application/msword") AND ($upload_file!="application/vnd.ms-excel") AND ($upload_file!="application/vnd.openxmlformats-officedocument.wordprocessingml.document") AND ($upload_file!="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") AND ($upload_file!="application/x-zip-compressed")){
echo "<script language='javascript'>" ;
echo "alert('กรุณาใช้ไฟล์ .pdf .doc .xls .zip ')" ;
echo "</script>" ;
echo "<script language='javascript'>javascript:history.back()</script>";
exit();
}
#แปลงนามสกุล และทำการ upload
if( $upload_file == "application/pdf" )
{
$filename = $upload_name.".pdf";
}
if( $upload_file == "application/msword" )
{
$filename = $upload_name.".doc";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" )
{
$filename = $upload_name.".docx";
}
if( $upload_file == "application/vnd.ms-excel" )
{
$filename = $upload_name.".xls";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" )
{
$filename = $upload_name.".xlsx";
}
if( $upload_file == "application/x-zip-compressed" )
{
$filename = $upload_name.".zip";
}
$new2_upload = $upload_time.$filename;
copy($_FILES["files2"]["tmp_name"], "data/publish/$new2_upload");
//======================================================== BEGIN ===== UPLOAD 3 ============
if($_FILES["files3"]["tmp_name"] != "")
{
$upload = $_FILES["files3"]["tmp_name"];
$upload_file = $_FILES["files3"]["type"];
require 'includes/gen_file_name.php';
$upload_time=$gen_file_name;
//ตรวจสอบชนิดของไฟล์
if (( $upload_file!="application/pdf" ) AND ($upload_file!="application/msword") AND ($upload_file!="application/vnd.ms-excel") AND ($upload_file!="application/vnd.openxmlformats-officedocument.wordprocessingml.document") AND ($upload_file!="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") AND ($upload_file!="application/x-zip-compressed")){
echo "<script language='javascript'>" ;
echo "alert('กรุณาใช้ไฟล์ .pdf .doc .xls .zip ')" ;
echo "</script>" ;
echo "<script language='javascript'>javascript:history.back()</script>";
exit();
}
#แปลงนามสกุล และทำการ upload
if( $upload_file == "application/pdf" )
{
$filename = $upload_name.".pdf";
}
if( $upload_file == "application/msword" )
{
$filename = $upload_name.".doc";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" )
{
$filename = $upload_name.".docx";
}
if( $upload_file == "application/vnd.ms-excel" )
{
$filename = $upload_name.".xls";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" )
{
$filename = $upload_name.".xlsx";
}
if( $upload_file == "application/x-zip-compressed" )
{
$filename = $upload_name.".zip";
}
$new3_upload = $upload_time.$filename;
copy($_FILES["files3"]["tmp_name"], "data/publish/$new3_upload");
//======================================================== BEGIN ===== UPLOAD 4 ============
if($_FILES["files4"]["tmp_name"] != "")
{
$upload = $_FILES["files4"]["tmp_name"];
$upload_file = $_FILES["files4"]["type"];
require 'includes/gen_file_name.php';
$upload_time=$gen_file_name;
//ตรวจสอบชนิดของไฟล์
if (( $upload_file!="application/pdf" ) AND ($upload_file!="application/msword") AND ($upload_file!="application/vnd.ms-excel") AND ($upload_file!="application/vnd.openxmlformats-officedocument.wordprocessingml.document") AND ($upload_file!="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") AND ($upload_file!="application/x-zip-compressed")){
echo "<script language='javascript'>" ;
echo "alert('กรุณาใช้ไฟล์ .pdf .doc .xls .zip ')" ;
echo "</script>" ;
echo "<script language='javascript'>javascript:history.back()</script>";
exit();
}
#แปลงนามสกุล และทำการ upload
if( $upload_file == "application/pdf" )
{
$filename = $upload_name.".pdf";
}
if( $upload_file == "application/msword" )
{
$filename = $upload_name.".doc";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" )
{
$filename = $upload_name.".docx";
}
if( $upload_file == "application/vnd.ms-excel" )
{
$filename = $upload_name.".xls";
}
if( $upload_file == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" )
{
$filename = $upload_name.".xlsx";
}
if( $upload_file == "application/x-zip-compressed" )
{
$filename = $upload_name.".zip";
}
$new4_upload = $upload_time.$filename;
copy($_FILES["files4"]["tmp_name"], "data/publish/$new4_upload");
//======================================================== END ======= UPLOAD 4 ============
}
}
}
//ทำการเพิ่มข้อมูลลงดาต้าเบส
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$db->update_db(TB_PUBLISH,array(
"category"=>"$_POST[CATEGORY]",
"topic"=>"$_POST[TOPIC]",
"date"=>"$_POST[DATE]",
"posted"=>"$_POST[POSTED]",
"post_date"=>"".TIMESTAMP."",
"update_date"=>"".TIMESTAMP."",
"enable_comment"=>"1",
"full_text"=>"$new1_upload",
"full_texts"=>"$new2_upload",
"full_textu"=>"$new3_upload",
"full_texto"=>"$new4_upload"
)," id=$_GET[id] ");
$db->closedb ();
} else {
//ทำการเพิ่มข้อมูลลงดาต้าเบส
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$db->update_db(TB_PUBLISH,array(
"category"=>"$_POST[CATEGORY]",
"topic"=>"$_POST[TOPIC]",
"date"=>"$_POST[DATE]",
"posted"=>"$_POST[POSTED]",
"post_date"=>"".TIMESTAMP."",
"update_date"=>"".TIMESTAMP."",
"enable_comment"=>"1"
)," id=$_GET[id] ");
$db->closedb ();
}
$ProcessOutput .= "<BR><BR>";
$ProcessOutput .= "<CENTER><IMG SRC=\"images/icon/login-welcome.gif\" BORDER=\"0\"></A><BR><BR>";
$ProcessOutput .= "<FONT COLOR=\"#336600\"><B>ได้ทำการเพิ่ม เข้าสู่ระบบเรียบร้อยแล้ว</B></FONT><BR><BR>";
$ProcessOutput .= "<meta http-equiv=\"refresh\" content=\"1 ;url=?name=publish&file=tabain\">";
$ProcessOutput .= "</CENTER>";
$ProcessOutput .= "<BR><BR>";
}else{
//กรณีไม่ผ่าน
$ProcessOutput = $PermissionFalse ;
}
echo $ProcessOutput ;
}
else if($_GET[op] == "publish_edit"){
//////////////////////////////////////////// กรณีเพิ่ม Form
if(CheckLevelUser($_SESSION['user_user'],$_GET[op])){
// CheckUser($_SESSION['user_user']);
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$res[user] = $db->select_query("SELECT * FROM ".TB_user." WHERE username='".$_SESSION['user_user']."' ");
$arr[user] = $db->fetch($res[user]);
//ดึงค่า
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$res[publish] = $db->select_query("SELECT * FROM ".TB_PUBLISH." WHERE id='".$_GET[id]."' ");
$arr[publish] = $db->fetch($res[publish]);
$db->closedb ();
?>
<script type="text/javascript" src="datepicker.js"></script>
<FORM NAME="myform" METHOD=POST ACTION="?name=publish&file=edit&op=publish_edit&action=edit&id=<?=$_GET[id];?>"" enctype="multipart/form-data" id="myform">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="left">
ฉบับที่<?=$arr[publish][tabain];?>
<INPUT TYPE="hidden" NAME="CATEGORY" size="60" VALUE="o" style="background-color:#FFFF99">
<BR><br>
<B>เรื่อง:</B>
<INPUT TYPE="text" NAME="TOPIC" size="60" VALUE="<?=$arr[publish][topic];?>" style="background-color:#FFFF99">
<BR><BR>
<B>ประกาศ ณ วันที่:</B>
<input name="DATE" VALUE="<?=$arr[publish][date];?>" readonly value="<?=$_GET[dates];?>"style="background-color:#FFFF99"> <IMG SRC="images/admin/dateselect.gif" BORDER="0" ALT="เลือกวันที่" onclick="displayDatePicker('DATE', false, 'ymd', '-');" align="absmiddle"> <br><BR>
</td>
</tr>
<tr>
<td colspan="4"><div align="left">
<br><font face="MS Sans serif" ><b>ไฟล์แนบ : <input type="file" name="files1" maxlength ="50" size="50"style="background-color:#FFFF99"><font face="MS Sans serif"><br>
<br><font face="MS Sans serif" ><b>ไฟล์แนบ : <input type="file" name="files2" maxlength ="50" size="50"style="background-color:#FFFF99"><font face="MS Sans serif"><br>
<br><font face="MS Sans serif" ><b>ไฟล์แนบ : <input type="file" name="files3" maxlength ="50" size="50"style="background-color:#FFFF99"><font face="MS Sans serif"><br>
<br><font face="MS Sans serif" ><b>ไฟล์แนบ : <input type="file" name="files4" maxlength ="50" size="50"style="background-color:#FFFF99"><font face="MS Sans serif"><br>
<INPUT TYPE="hidden" NAME="POSTED" VALUE="<?=$arr[user][id];?>" readonly style=\"color: #FF0000"><br>
<CENTER><INPUT TYPE="submit" value=" บันทึกแก้ไข" name="submit"style="background-color:#FFFF99"> </CENTER>
</div></td>
</tr>
</tr>
</table>
</FORM>
<?
}else{
//กรณีไม่ผ่าน
$ProcessOutput = $PermissionFalse ;
}
echo $ProcessOutput ;
}
else if($_GET[op] == "publish_del" AND $_GET[action] == "multidel"){
//////////////////////////////////////////// กรณีลบ Multi
if(CheckLevelUser($_SESSION['user_user'],$_GET[op])){
while(list($key, $value) = each ($_POST['list'])){
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
$res[publish] = $db->select_query("SELECT * FROM ".TB_PUBLISH." WHERE id='".$value."' ");
$arr[publish] = $db->fetch($res[publish]);
$db->del(TB_PUBLISH," id='".$value."' ");
@unlink("publishdata/".$arr[publish][post_date].".txt");
@unlink("publishicon/".$arr[publish][post_date].".jpg");
@unlink("publish/".$arr[publish][full_text]);
$db->closedb ();
}
$ProcessOutput .= "<BR><BR>";
$ProcessOutput .= "<CENTER><A HREF=\"?name=publish&file=main\"><IMG SRC=\"images/icon/login-welcome.gif\" BORDER=\"0\"></A><BR><BR>";
$ProcessOutput .= "<FONT COLOR=\"#336600\"><B>ได้ทำการลบเรียบร้อยแล้ว</B></FONT><BR><BR>";
$ProcessOutput .= "<A HREF=\"index.php\"></B></A>";
$ProcessOutput .= "</CENTER>";
$ProcessOutput .= "<BR><BR>";
}else{
//กรณีไม่ผ่าน
$ProcessOutput = $PermissionFalse ;
}
echo $ProcessOutput ;
}
else if($_GET[op] == "publish_del"){
//////////////////////////////////////////// กรณีลบ Form
if(CheckLevelUser($_SESSION['user_user'],$_GET[op])){
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
// $db->del(TB_PUBLISH," id='".$_GET[id]."' ");
$res[publish] = $db->select_query("SELECT * FROM ".TB_PUBLISH." WHERE id='".$_GET[id]."' ");
$arr[publish] = $db->fetch($res[publish]);
$db->del(TB_PUBLISH," id='".$_GET[id]."' ");
@unlink("publishdata/".$arr[publish][post_date].".txt");
@unlink("publishicon/".$arr[publish][post_date].".jpg");
@unlink("publish/".$arr[publish][full_text]);
$db->closedb ();
$ProcessOutput .= "<BR><BR>";
$ProcessOutput .= "<CENTER><A HREF=\"?name=user&file=main\"><IMG SRC=\"images/icon/login-welcome.gif\" BORDER=\"0\"></A><BR><BR>";
$ProcessOutput .= "<FONT COLOR=\"#336600\"><B>ได้ทำการลบเรียบร้อยแล้ว</B></FONT><BR><BR>";
$ProcessOutput .= "<A HREF=\"?name=publish&file=addschool&op=publish_add\"><B>ส่งหนังสือถึงโรงเรียนใหม่</B></A>";
$ProcessOutput .= "<BR><BR>";
}else{
//กรณีไม่ผ่าน
$ProcessOutput = $PermissionFalse ;
}
echo $ProcessOutput ;
}
?>
</TD>
</TR>
</TABLE>
<!-- user -->
</TD>
</TR>
</TBODY>
</TABLE>