Server IP : 202.29.229.35 / Your IP : 18.191.171.26 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/ |
Upload File : |
<?php //http://html-color-codes.info/ โ๊ค๊ดสีตัวอักษร date_default_timezone_set('Asia/Bangkok'); //echo phpinfo(); $month_show['01']="ม.ค."; $month_show['02']="ก.พ."; $month_show['03']="มี.ค."; $month_show['04']="เม.ย."; $month_show['05']="พ.ค."; $month_show['06']="มิ.ย."; $month_show['07']="ก.ค."; $month_show['08']="ส.ค."; $month_show['09']="ก.ย."; $month_show['10']="ต.ค."; $month_show['11']="พ.ย."; $month_show['12']="ธ.ค."; require('fpdf.php'); require('code128.php'); /* //เรียนใช้ทำเส้นกรอบ include ('adodb/adodb.inc.php'); require ('fpdf/jpdf.inc.php'); */ function utf8_to_tis620($string) { $str = $string; $res = ""; for ($i = 0; $i < strlen($str); $i++) { if (ord($str[$i]) == 224) { $unicode = ord($str[$i+2]) & 0x3F; $unicode |= (ord($str[$i+1]) & 0x3F) << 6; $unicode |= (ord($str[$i]) & 0x0F) << 12; $res .= chr($unicode-0x0E00+0xA0); $i += 2; } else { $res .= $str[$i]; } } return $res; } class PDF extends FPDF { //Load data function LoadData($file) { //Read file lines $lines=file($file); $data=array(); foreach($lines as $line) $data[]=explode(';',chop($line)); return $data; } } // end class //$pdf=new PDF('P','cm',array(8.5,5.5)); //set ��д�� $pdf=new PDF_Code128('P','cm',array(8.5,5.5)); //$pdf=new PDF_Code128(); $pdf->AddPage(); $pdf->AddFont('angsanab','','angsanab.php'); //$pdf->AddFont('AngsanaNew','','angsa.php'); $pdf->SetMargins(0,0,0,0); //include("connect/connect.php"); $con = mysqli_connect("localhost", "stdcard_ivecr2", "Kim0815575706", "stdcard_ivecr2"); if (mysqli_connect_errno()) { echo "ไม่สามารถเชื่อมต่อกับฐานข้อมูล MySQL ได้: " . mysqli_connect_error(); } $group_id = $_REQUEST['group_id']; $student_id = $_REQUEST['student_id'];//รหัส นศ. $idschool = $_REQUEST['isschool'];//รหัสสถานศึกษา if($group_id=="") { if($student_id==""){ echo "กรุณากรอกรหัสนักศึกษา"; exit(); }else{ $querystd=mysqli_query($con,"select * from tblstd_idcard where student_id = '$student_id' && idschool='$idschool' "); //$sql_std = "select * from tblstd_idcard where student_id = '$student_id' && idschool='$idschool' "; //echo "==>".$sql_std; } }else{ $querystd=mysqli_query($con,"select * from tblstd_idcard where student_id = '$student_id' && idschool='$idschool' "); //$sql_std = "select * from tblstd_idcard where group_id = '$group_id' && idschool='$idschool' order by student_id"; } /* echo $sql_std ; echo "group=>".$group_id; exit(); */ /* $result1 = mysql_query($sql_std); while($rs_std = mysql_fetch_array($result1)){ //var_dump($rs_std); */ while($rs_std=mysqli_fetch_assoc($querystd)){ $student_id = $rs_std['student_id']; $people_id = $rs_std['people_id']; $perfix_id = $rs_std['perfix_id']; $stu_fname = $rs_std['stu_fname']; $stu_lname = $rs_std['stu_lname']; $start_year = $rs_std['start_year']; $schedu_id = $rs_std['schedu_id']; $group_id = $rs_std['group_id']; $major_id = $rs_std['major_id']; $minor_name = $rs_std['minor_name']; $card_no = $rs_std['card_no']; $date_print = $rs_std['date_print']; $date_expire = $rs_std['date_expire']; $BloodGroup = $rs_std['BloodGroup']; $school = $rs_std['school']; //echo "minor==>".$minor_name ; //echo "<br>==>".utf8_to_tis620($minor_name); //exit(); if($perfix_id=="002") $stdPrefixThai="นาย"; elseif($perfix_id=="003") $stdPrefixThai="นางสาว"; elseif($perfix_id=="009") $stdPrefixThai="จ.ส.ท."; elseif($perfix_id=="008") $stdPrefixThai="ส.อ."; else if($perfix_id=="004") $stdPrefixThai="นาง"; else $stdPrefixThai=""; if(substr($schedu_id,0,1)=="2"){ $level_show = "ปวช. สาขา".$minor_name; }elseif(substr($schedu_id,0,1)=="3"){ $level_show = "ปวส. สาขา".$minor_name; }else{ $level_show = "สาขาวิชา".$minor_name; } //echo substr($schedu_id,0,1); //exit(); /* if(strlen($card_no)==1) $card_no_show = "000".$card_no; elseif(strlen($card_no)==2) $card_no_show = "00".$card_no; elseif(strlen($card_no)==3) $card_no_show = "0".$card_no; elseif(strlen($card_no)==4) $card_no_show = $card_no; */ $m1 = explode("/",$date_print); $m2 = explode("/",$date_expire); $date_print_show = $m1[0]." ".$month_show[$m1[1]]." ".$m1[2]; $date_expire_show = $m2[0]." ".$month_show[$m2[1]]." ".$m2[2]; $printyear= date("Y") + 543;//ปีที่พิมพ์บัตร //เก็บประวัติการพิมพ์บัตรในแต่ละครั้ง if($_REQUEST['student_id'] != ''){ @mysqli_query($con,"INSERT INTO log_print_card VALUES ('','".$_REQUEST['student_id']."','$card_no','$date_print_show','$date_expire_show ','$idschool','$major_id','$printyear','".date("Y-m-d")."','".date("H:i:s")."')"); } $str_defaultfilepicname = "00.jpg"; // ให้ไฟล์รูปชื่อ 00.png เป็นรูป Default $str_filepicname = $student_id.".jpg"; // ให้ไฟล์รูปชื่อ 01.png เป็นรูปที่ต้องการตรวจสอบ $str_imgpath = "photo_std/"; // Path รูป $str_imgfullpath = $str_imgpath . $str_filepicname; // นำ Path รูป มาเชื่อมกับ ชื่อรูป //echo "==>".$str_imgfullpath; if (file_exists($str_imgfullpath)){ // ตรวจสอบว่ามีไฟล์รูปตาม Path ในตัวแปร $str_imgfullpath หรือไม่ $str_imgfullpath = $str_imgpath . $str_filepicname; // ถ้ามีไฟล์รูปให้ Path ชี้ที่ไฟล์รูปที่ต้องการ }else{ $str_imgfullpath = $str_imgpath . $str_defaultfilepicname; // ถ้าไม่มีไฟล์รุปให้ Path ชี้ไปที่ไฟล์รูป Default } //แทป bar code //$pdf->Code128(0.3,4.15,$student_id,8,0.7); //เส้นกรอบรูป นศ. //กำหนดวาดรูปสี่เหลี่ยม (rectangle) ไม่มีพื้นหลัง (no fill) (255,255,255); //$pdf->SetDrawColor(255, 255,0);//สีเหลือง //$pdf->SetDrawColor(60, 100,200);//สีนำ้เงิน //$pdf->SetDrawColor(255, 100,9);//สีส้ม //$pdf->SetDrawColor(255, 130,300);//สีชมพูเข้ม //$pdf->SetDrawColor(300,100,100);//สีแดงส้ม $pdf->SetDrawColor(300,100,100);//สีเส้น $pdf->SetFillColor(355,355, 255);//สีพื้นหลัง $pdf->Image("bgback.jpg",0,0,0,0);//สีพื้นหลัง $pdf->Rect(.28,1.41,2.32,2.77,"DF");//ความกว้างของเส้น >>5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านซ้าน ขวา, 5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านบน ล่าง ,200 ความกว้าง X , 287 ความสูง , D $pdf->Image($str_imgfullpath,.32,1.44,2.25,2.71);//pic-std ,ระยะรูปห่างจากขอบบัตร,ระยะรูปห่างจากขอบบน,ความกว้างของรูป,ความสูงของรูป //$pdf->SetXY(.2,1); $pdf->Image("logoive.gif",.3,.01,1,1);//pic-std ,ระยะรูปห่างจากขอบบัตร,ระยะรูปห่างจากขอบบน,ความกว้างของรูป,ความสูงของรูป $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',18); //ชื่อสถาบัน $pdf->SetTextColor(255,255,255); $pdf->Text(1.8,.5,utf8_to_tis620("สถาบันการอาชีวศึกษาภาคกลาง 2 ")); $pdf->Rect(1.8,.6,6,.05,"DF");//ความกว้างของเส้น >>5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านซ้าน ขวา, 5 คือ $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); //ชื่อสถาบัน $pdf->Text(1.8,.9,utf8_to_tis620("Instirute of Vocational Education Central Region 2 ")); $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); $pdf->SetTextColor(0,0,0); //ชื่อสถานศึกษา //$pdf->SetXY(3,1.5); $pdf->Text(2.8,1.7,utf8_to_tis620($school)); //text(ระยะห่างจากขอบซ้าย,ระยะห่างจากขอบบน) //ชื่อนามสกุล //$pdf->SetXY(3,2); $pdf->Text(2.8,2.1,utf8_to_tis620("ชื่อ - สกุล ".$stdPrefixThai.$stu_fname. " " . $stu_lname)); //เลขบัตรประชาชน //$pdf->SetXY(3,2.4); $pdf->Text(2.8,2.5,utf8_to_tis620("เลขประจำตัวประชาชน ".$people_id)); //รหัสนักศึกษา //$pdf->SetXY(3,2.8); $pdf->Text(2.8,2.9,utf8_to_tis620("เลขประจำตัวนักศึกษา ".$student_id)); //ระดับการศึกษา //$pdf->SetXY(3,3.15); $pdf->Text(2.8,3.3,utf8_to_tis620("ระดับปริญญาตรี")); //$pdf->SetXY(3.1,3); //$pdf->Cell(5,0,utf8_to_tis620($major_name,0,1,'L')); //ระดับการศึกษา //$pdf->SetXY(3,3.49); $pdf->Text(2.8,3.7,utf8_to_tis620($level_show)); //$pdf->SetXY(3,3); $pdf->Image("boss.gif",3.8,3.8,2.2,0.5);//รายเซ็น boss ,ระยะรูปห่างจากขอบบัตร,ระยะรูปห่างจากขอบบน,ความกว้างของรูป,ความสูงของรูป //หมู่โลหติ //$pdf->SetXY(3,5); $pdf->Text(0.8,4.7,utf8_to_tis620("หมู่โลหิต ".$BloodGroup)); //ลายเซ็น ผอ. //$pdf->SetXY(3,5); $pdf->Text(4,4.7,utf8_to_tis620("นายเรวัช ศรีแสงอ่อน")); $pdf->Text(2.5,5.1,utf8_to_tis620("ผู้อำนวยการสถาบันการอาชีวศึกษาภาคกลาง 2")); } // end while $pdf->Output(); ?>