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=array("", "ม.ค.", "ก.พ.","มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "", "พ.ย.", "ธ.ค."); require('fpdf.php'); require('code39.php'); $startday="16 มิ.ย 2557"; $endday="16 มิ.ย 2558"; 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_Code39('P','cm',array(8.5,5.5)); $pdf->AddPage(); $pdf->AddFont('angsanab','','angsanab.php'); $pdf->SetMargins(0,0,0,0); $host="localhost"; $user_name="root"; $pass_word="1234"; $db="std_card_db"; @mysql_connect( $host,$user_name,$pass_word) or die ("can not connect to server"); mysql_query("SET NAMES tis620"); @mysql_select_db($db) or die("can not select database"); $group_id = $_REQUEST['group_id']; $student_id = $_REQUEST['student_id']; $d = $_REQUEST['d']; $m = $_REQUEST['m']; $y = $_REQUEST['y']; $d2 = $_REQUEST['d2']; $m2 = $_REQUEST['m2']; $y2 = $_REQUEST['y2']; $date_print = $d." ".$month_show($m)." ". $y; $date_expire = $d2." ".$month_show($m2)." ". $y2; if($group_id=="") { if($student_id==""){ echo "กรุณากรอกรหัสกลุ่ม หรือ รหัสนักเรียนนักศึกษา"; exit(); }else{ $sql_student_id = "select group_id from tblstd_idcard where student_id = '$student_id' "; $result1 = mysql_query($sql_student_id); $rs_student_id = mysql_fetch_array($result1); $group_id = $student_id['group_id']; } } $y = "25".substr($group_id,0,2); //echo $y; //exit(); $sql_group = "select * from tblgroup_id where group_id = '$group_id' "; $result = mysql_query($sql_group); $rs_group = mysql_fetch_array($result); $major_name = $rs_group['major_name']; $branch_name = $rs_group['branch_name']; $level_id = $rs_group['level_id']; if($level_id==1) $level_show = "ปวช. สาขาวิชา".$branch_name; else $level_show = "ปวส. สาขางาน".$major_name; $sql_max = "select max(card_no) from tblstd_idcard where start_year = '$y' "; $result1 = mysql_query($sql_max); $rs_max = mysql_fetch_array($result1); $card_no_max = $rs_max['0']; $sql_std = "select * from tblstd_idcard where group_id = '$group_id' order by student_id"; $result1 = mysql_query($sql_std); while($rs_std = mysql_fetch_array($result1)){ $card_no_max++; $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_fname']; $start_year = $rs_std['start_year']; if(strlen($card_no_max)==1) $card_no_show = "000".$card_no_max; else if(strlen($card_no_max)==2) $card_no_show = "00".$card_no_max; else if(strlen($card_no_max)==3) $card_no_show = "0".$card_no_max; else $card_no_show = $card_no_max; if($perfix_id=="002") $stdPrefixThai="นาย"; elseif($perfix_id=="003") $stdPrefixThai="นางสาว"; else $stdPrefixThai=""; $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 $pdf->Image($str_imgfullpath,.25,1.02,2.2,2.6);//pic-std $pdf->SetXY(.2,1); $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); $pdf->SetXY(2.5,1.5); $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(5.7,1.9); $pdf->Cell(5,0,$card_no_show."/".$start_year,0,1,'L'); // no. idcard //รหัสนักศึกษา $pdf->SetXY(3.6,2.2); $pdf->Cell(20,0,$student_id,0,0,'L'); //id std $pdf->SetXY(3.2,2.6); $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->Image("boss.gif",6.2,2.4,2.2,1.5);//����繵� boss //bar code $pdf->Code39(1.4,4.1,$student_id,0.095,0.65); $pdf->SetThaiFont(); $pdf->SetFont('angsanab','',12); $pdf->Text(3.5,5.3,utf8_to_tis620($date_print ." ".$date_expire));//�ѹ����͡�ѵ� $sql_upd="update tblstd_idcard set card_no = '$card_no_max', date_print = '$date_print', date_expire='$date_expire' where student_id = '$student_id' "; $result = mysql_query($sql_upd); $pdf->AddPage(); } // end while $pdf->Output(); ?>