Server IP : 202.29.229.35 / Your IP : 3.148.212.53 Web Server : Apache System : Linux aapanel2 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 User : www ( 1001) PHP Version : 5.5.38 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/www.ivecr2.ac.th/research/img/icons/ |
Upload File : |
<?php @session_start(); error_reporting(0); if($_SESSION['r_statuslogin'] != 1){ echo '<META HTTP-EQUIV="Refresh" CONTENT="0;URL=Loginadmin.php">'; exit(); } include("connect/connect.php"); $adid=$_GET['adid']; ////////////บันทึกข้อมูล//////// $button=$_POST['button']; echo "=>".$button.$adid."<br>"; if($button == "บันทึกข้อมูล"){ $adID=$_POST['adID']; $adFname=$_POST['adFname']; $adLname=$_POST['adLname']; $depno=$_POST['depno']; $aduser=$_POST['aduser']; $pass = $_POST['adpass']; $pinid = $_POST['pinid']; //echo "=>".$pass."<br>"; if($pass !=""){ $adpassori=$_POST['adpass']; }else{ $adpassori=$_POST['pass']; } if($depno == 1){ $depname="Super Admin"; }else if($depno == 2){ $depname="งานทะเบียน"; }else if($depno == 3){ $depname="งานการเงิน"; }else if($depno == 4){ $depname="งานหลักสูตร"; }else if($depno == 5){ $depname="งานครูที่ปรึกษา"; } $photo_old=$_POST['photo_old'];//รูปเก่า $filename=$_FILES["pictureUpload"]["name"]; $tmp_name=$_FILES['pictureUpload']['tmp_name']; echo "filepic=>".$filename.":".$tmp_name; if($tmp_name !=""){ $ext=strtolower(end(explode(".",$filename))); if($ext=="jpg" or $ext=="gif" or $ext=="png"){ }else{ echo "<script language='javascript'>alert('นามสกุลไฟล์ไม่ถูกต้อง ไฟล์ต้องเป็น .jpg/.png/.gif เท่านั้น')</script>"; echo '<meta http-equiv="refresh"content="0;url=?na=adAdminEditFrm&adid='.$adID.'">'; exit(); } $filedoc_ori=$pinid.".".$ext; $sql1="select * from tbladmin where adID='$adID'"; $result1=mysql_query($sql1); $rs1=mysql_fetch_array($result1); $file1=$rs1['adPhoto']; //echo "pic old=>".$file1."<br>"; if($file1<>""){ if(file_exists("img/icons/$file1")){ unlink("img/icons/$file1"); } } copy($tmp_name,"img/icons/".$filedoc_ori); }else{ $filedoc_ori=$photo_old; } $sqlwork1="update tbladmin set adUser='$aduser',adPass='$adpassori',pinid='$pinid',adFname='$adFname',adLname='$adLname',depno='$depno',depName='$depname',adPhoto='$filedoc_ori' where adID='$adID'"; $resqlwork1=mysql_query($sqlwork1); echo $sqlwork1; if($resqlwork1){ echo "<font color='#660066' size='+2'><b>แก้ไขข้อมูลเรียบร้อยแล้ว</b></font>"; //echo '<meta http-equiv="refresh" content="0; url=?na=adAdminEditFrm&adid='.$adID.'" />'; //exit(); }else{ echo " ไม่สามารถบันทึกข้อมูลได้Error <br>"; } }else{ $sqlad="select * from tbladmin adID where adID='$adid' "; $resultad=mysql_query($sqlad); $rsad=mysql_fetch_array($resultad); $adID = $rsad['adID'];//PK $adFname=$rsad['adFname'];//ชื่อ ผุ้ใช้งาน $adLname=$rsad['adLname'];//นามสกุล ผุ้ใช้งาน $depno=$rsad['depno'];//เลขประจำฝ่ายงาน $depName=$rsad["depName"]; $adUser=$rsad['adUser'];// $adPass=$rsad['adPass'];// $admin_pic=$rsad['adPhoto'];//รูป $pinid=$rsad['pinid']; echo "pic=>".$admin_pic.$adid; ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <a href="?na=adminShowlist"> <button type="button" class="btn btn-default" ><i class="fa fa-undo" aria-hidden="true"></i> ย้อนกลับ</button></a> <hr /> <h3>แก้ไขข้อมูลผู้ใช้งาน </h3> <form name="employeeAdminForm" id="eduForm" method="post" action="" class="form-horizontal form-validate" enctype="multipart/form-data"> <div class="form-group"> <div class="col-md-5"> <div class="panel panel-danger" > <div class="panel-heading"> รูปภาพ </div> <ul style="list-style-image: none; list-style-type: none;"> <br> <li><label class="txtBig"> <span class="btn btn-default btn-file"> เลือกรูป (.jpg) <input type="file" name="pictureUpload" accept=".jpg, .jpeg" value="" onchange="$('#uploadFile').html(this.value);loadFile(event);" id="pictureUpload" class="upload"> </span> <span id="uploadFile" class="fsmall"/> <script> var loadFile = function(event) { var reader = new FileReader(); reader.onload = function(){ var output = document.getElementById('output'); output.src = reader.result; }; reader.readAsDataURL(event.target.files[0]); }; </script> </span> </li> <div align="center"> <li> <?php if($admin_pic !=''){ ?> <img class="imgFrame" align="center" style="width: 250px;height: 230px;" id="output" src="mg/icons/<?php echo $admin_pic;?>" > <?php }else{ ?> <img class="imgFrame" align="center" style="width: 250px;height: 230px;" id="output" src="mg/icons/user.jpg" > <?php } ?> </li> </div> </ul> </div> </div> </div> <div class="form-group"> <label class="control-label col-sm-2"></label> <div class="col-sm-2"> <div class="col-sm-2"> <input type="submit" name="button" id="button" value="บันทึกข้อมูล" class="btn btn-success" onclick="submitFormSearch();"/> </div> </div> <input name="adID" type="hidden" id="adID" value="<?php echo $adID;?>" /> <input name="pass" type="hidden" id="pass" value="<?php echo $adPass;?>" /> <input name="photo_old" type="hidden" id="photo_old" value="<?php echo $admin_pic;?>" /> </div> </div> </form> <p> </p> <?php } ?> <style> .btn-file { position: relative; overflow: hidden; } .btn-file input[type=file] { position: absolute; top: 0; right: 0; min-width: 100%; min-height: 100%; font-size: 100px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; background: white; cursor: inherit; display: block; } </style> <script type="text/javascript"> $(function(){ $("#eduForm").validate({ ignore : [], rules: { pictureUpload : "required", }, messages: { pictureUpload : "ระบุ: รูปภาพที่ต้องการอัพโหลด", } }); }); function submitFormAdd(mode) { if($("#eduForm").valid()){ document.employeeAdminForm.mode.value = mode; document.employeeAdminForm.submit(); } } function submitFormInit(mode) { document.employeeAdminForm.mode.value = mode; document.employeeAdminForm.submit(); } function submitFormRemove(id) { bootbox.dialog({ title: 'ยืนยันการลบข้อมูล', message: 'คุณต้องการลบรายการนี้ [ใช่/ไม่]', buttons: { Cancel: { label: 'ยกเลิก', className: "btn-default", callback: function () { } }, success: { label: 'ตกลง', className: "btn-danger", callback: function () { document.employeeAdminForm.mode.value = 'deletePicture'; document.employeeAdminForm.id.value = id; document.employeeAdminForm.submit(); } } } }); }; </script>