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 : |
<?php error_reporting(0); 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); $host="localhost"; $user_name="ivecr2_stdcard"; $pass_word="ivecr2stdcard"; $db="ivecr2_stdcard"; /* $host="localhost"; $user_name="stdcard_db"; $pass_word="Stdcard123"; $db="stdcard_db"; */ mysql_connect( $host,$user_name,$pass_word) or die ("can not connect to server"); mysql_query("SET NAMES utf8"); mysql_select_db($db) or die("can not select database"); /* if($_REQUEST['student_id'] != ''){ @mysql_query("INSERT INTO log_print_card VALUES ('','".$_REQUEST['student_id']."','".date("Y-m-d H:i:s")."')"); } */ $group_id = $_REQUEST['group_id']; $student_id = $_REQUEST['student_id'];//รหัส นศ. $idschool = $_REQUEST['isschool'];//รหัสสถานศึกษา if($group_id=="") { if($student_id==""){ echo "กรุณากรอกรหัสนักศึกษา"; exit(); }else{ $sql_std = "select * from tblstd_idcard where student_id = '$student_id' && idschool='$idschool' "; } }else{ $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); $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']; $adress = $rs_std['adress']; $adress1 = $rs_std['adress1']; $idschool = $rs_std['idschool'];//เลขประจำวิทยาลัย //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="จ.ส.ท."; 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'] != ''){ @mysql_query("INSERT INTO log_print_cardback 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 รูป มาเชื่อมกับ ชื่อรูป 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.64,2.20, 2.81,"DF");//ความกว้างของเส้น >>5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านซ้าน ขวา, 5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านบน ล่าง ,200 ความกว้าง X , 287 ความสูง , D $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',20); $pdf->SetTextColor(255,255,255); $pdf->Text(1.9,.7,utf8_to_tis620("บัตรประจำตัวนักศึกษา")); /* */ $pdf->Image("logoive.gif",.32,1.6,2.11,2.11);//pic-std ,ระยะรูปห่างจากขอบบัตร,ระยะรูปห่างจากขอบบน,ความกว้างของรูป,ความสูงของรูป $pdf->SetXY(.2,1); $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',18); //$pdf->Text(2.3,.8,utf8_to_tis620("บัตรประจำตัวนักศึกษา")); //text(ระยะห่างจากขอบซ้าย,ระยะห่างจากขอบบน) //เลขที่บัตร $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); $pdf->SetTextColor(0,0,0); $pdf->Text(2.8,1.7,utf8_to_tis620("เลขที่ ".$card_no."/".$start_year)); //ชื่อสถาบัน $pdf->Text(2.8,2.1,utf8_to_tis620("สถาบันการอาชีวศึกษาภาคกลาง 2 ")); //วิทยาลัยในสังกัดสถาบัน $pdf->Text(2.8,2.5,utf8_to_tis620($school)); //ที่ตั้้ง $pdf->Text(2.8,2.9,utf8_to_tis620($adress)); //ที่ตั้ง 2 $pdf->Text(2.8,3.3,utf8_to_tis620($adress1)); //วันที่ออกบัตร $pdf->Text(2.8,3.7,utf8_to_tis620("วันออกบัตร ".$date_print_show)); //วันที่ออกบัตร $pdf->Text(2.8,4.1,utf8_to_tis620("บัตรหมดอายุ ".$date_expire_show)); //แทป bar code //$pdf->Text(0.3,4.5,$student_id,8,0.6); $pdf->Code128(0.3,4.3,$student_id,8,0.7); $pdf->SetFont('angsanab','',9); $pdf->Text(7.2,5.2,utf8_to_tis620($student_id)); } // end while $pdf->Output(); ?>