Server IP : 202.29.229.35 / Your IP : 18.119.120.88 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/stdcard/ |
Upload File : |
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> </head> <?php date_default_timezone_set("Asia/Bangkok"); require_once("connect/connect.php"); ?> <body> <div class="container"> <h2>ค้นหานักเรียน</h2> <form class="form-horizontal" style="width:500px;" method="post" action=""> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">ชื่อ/นามสกุล</label> <div class="col-sm-10"> <input type="text" name="id" class="form-control" id="inputEmail3" placeholder=""> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">ค้นหา</button> </div> </div> </form> <?php //$_POST['id'] => from input name= id if($_POST['id'] != ''){ $query = mysql_query("SELECT * FROM tblstd_idcard WHERE stu_fname LIKE '%".$_POST['id']."%' OR stu_lname LIKE '%".$_POST['id']."%'")or die(mysql_error()); ?> <table class="table table-bordered"> <thead> <tr> <th>id</th> <th>First Name</th> <th>Last Name</th> <th>major_name</th> <th>minor_name</th> <th>New id</th> <th>minor_name</th> <th>OK</th> </tr> </thead> <tbody> <?php while($data = mysql_fetch_assoc($query)){ ?> <tr> <form method="post" action=""> <td><?php echo $data['student_id'];?></td> <td><?php echo $data['stu_fname'];?></td> <td><?php echo $data['stu_lname'];?></td> <td><?php echo $data['major_name'];?></td> <td><?php echo $data['minor_name'];?></td> <td><input type="text" name="newid" /><input type="hidden" name="oldid" value="<?php echo $data['student_id'];?>" /><input type="hidden" name="oldminor" value="<?php echo $data['minor_name'];?>"></td> <td><select name="minor"> <option value="0">select</option> <option value="การบัญชี">การบัญชี</option> <option value="คอมพิวเตอร์ธุรกิจ">คอมพิวเตอร์ธุรกิจ</option> <option value="การตลาด">การตลาด</option> </select></td> <td> <button type="submit" class="btn btn-default">OK</button></td> </form> </tr> <?php } }?> </tbody> </table> <?php if( $_POST['newid'] != '' && $_POST['minor'] != "" ): //insert log cheng mysql_query("INSERT INTO std_cheng_id_by2558 VALUES ('".$_POST['oldid']."','".$_POST['newid']."','".$_POST['oldminor']."','".$_POST['minor']."','".date("Y-m-d H:i:s")."')") or die("log === ".mysql_error()); //cheng img $filenameold = "photo_std/".$_POST['oldid'].".jpg"; $filenamenew = "photo_std/".$_POST['newid'].".jpg"; if (file_exists($filenameold)) { if(rename($filenameold,$filenamenew)){ echo '<div class="alert alert-success" role="alert">ok img <br></div>'; //unlink($filenameold); }else{ echo '<div class="alert alert-danger" role="alert">on img</div>'; } } else { echo '<div class="alert alert-danger" role="alert">The file $filenameold does not exist</div>'; } //cheng id //cheng minor $query_cheng = mysql_query("UPDATE tblstd_idcard SET student_id='".$_POST['newid']."',minor_name='".$_POST['minor']."' WHERE student_id='".$_POST['oldid']."' LIMIT 1") or die("cheng == ".mysql_error()); if($query_cheng){ echo '<div class="alert alert-success" role="alert">ทำการแก้ไขข้อมูลเรียนร้อย id</div>'; }else{ echo '<div class="alert alert-danger" role="alert">error ไม่สามารถแก้ไขได้</div>'; } endif; ?> <h2> show log</h2> <table class="table table-bordered"> <thead> <tr> <th>img</th> <th>oldid</th> <th>newid</th> <th>name</th> <th>old minor</th> <th>New minor</th> <th>datetime</th> </tr> </thead> <tbody> <?Php $query = mysql_query("SELECT * FROM std_cheng_id_by2558 ORDER BY datetime DESC LIMIT 0,10"); while($data = mysql_fetch_assoc($query)){ ?> <tr> <td class="success"><img src="photo_std/<?php echo $data['newid'];?>.jpg" style="max-width:30px"></td> <td><?php echo $data['oldid'];?></td> <td class="success"><?php echo $data['newid'];?></td> <td class="success"><?php getname($data['oldid'],$data['newid'])?></td> <td><?php echo $data['old_minor_name'];?></td> <td class="success"><?php echo $data['new_minor_name'];?></td> <td><?php echo $data['datetime'];?></td> </tr> <? } ?> </tbody> </table> <?php function getname($oldid,$newid){ $query = mysql_query("SELECT * FrOM tblstd_idcard WHERE student_id = '".$oldid."' OR student_id = '".$newid."' LIMIT 1"); $data = mysql_fetch_assoc($query); echo $data['stu_fname']." ".$data['stu_lname']; } ?> </div> </body> </html>