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 //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="root"; $pass_word="1234"; $db="std_card_db"; */ $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"); $group_id = $_REQUEST['group_id']; $student_id = $_REQUEST['student_id']; if($group_id=="") { if($student_id==""){ echo "กรุณากรอกรหัสกลุ่ม หรือ รหัสนักเรียนนักศึกษา"; exit(); }else{ $sql_std = "select * from tblstd_idcard where student_id = '$student_id' "; } }else{ $sql_std = "select * from tblstd_idcard where group_id = '$group_id' 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']; $minor_name = $rs_std['minor_name']; $card_no = $rs_std['card_no']; $date_print = $rs_std['date_print']; $date_expire = $rs_std['date_expire']; //echo "minor==>".$minor_name ; //echo "<br>==>".utf8_to_tis620($minor_name); //exit(); if($perfix_id=="002") $stdPrefixThai="นาย"; elseif($perfix_id=="003") $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; } //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]; $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->Code39(1.4,4.1,$student_id,0.095,0.65); $pdf->Code128(0.3,4.15,$student_id,8,0.7); /* //เส้นกรอบรูป นศ. //กำหนดวาดรูปสี่เหลี่ยม (rectangle) ไม่มีพื้นหลัง (no fill) $pdf->SetDrawColor(60, 100,200);//สีเส้น $pdf->SetFillColor(355,355, 255);//สีพื้นหลัง $pdf->Rect(.28,1.01,2.13, 2.82,"DF");//ความกว้างของเส้น >>5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านซ้าน ขวา, 5 คือ ระยะห่างของเส้นจากขอบกระดาษด้านบน ล่าง ,200 ความกว้าง X , 287 ความสูง , D */ $pdf->Image($str_imgfullpath,.29,1.03,2.08,2.71);//pic-std ,ระยะรูปห่างจากขอบบัตร,ระยะรูปห่างจากขอบบน,ความกว้างของรูป,ความสูงของรูป $pdf->SetXY(.2,1); $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); //เลขที่บัตร $pdf->SetXY(5.5,1.5); $pdf->Cell(5,0,$card_no_show."/".$start_year,0,1,'L'); // no. idcard $pdf->SetXY(4,1.8); $pdf->Cell(5,0,utf8_to_tis620("".$people_id,0,1,'L')); //no.id 13 $pdf->SetXY(1.1,1.9); //$pdf->Cell(5,0,$idcard,0,1,'C'); //no.id 13 //รหัสนักศึกษา $pdf->SetXY(3.6,2.2); $pdf->Cell(20,0,$student_id,0,0,'L'); //id std $pdf->SetXY(3.2,2.6); $pdf->Image("boss.gif",6.2,2.6,2.2,1.5);//รายเซ็น boss ,ระยะรูปห่างจากขอบบัตร,ระยะรูปห่างจากขอบบน,ความกว้างของรูป,ความสูงของรูป $pdf->Cell(5,0,utf8_to_tis620($stdPrefixThai.$stu_fname. " " . $stu_lname),0,0,'L'); //fname lname $pdf->SetXY(3.1,3); //$pdf->Cell(5,0,utf8_to_tis620($major_name,0,1,'L')); //sebject $pdf->Cell(5,0,utf8_to_tis620($level_show)); //sebject $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); $pdf->Text(3.5,5.3,utf8_to_tis620($date_print_show ." ".$date_expire_show));//�ѹ����͡�ѵ� $pdf->AddPage(); } // end while $pdf->Output(); ?>