Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.216.156.226
<?php
/*$servername = "localhost";
$username = 'root';
$password = "";
$databse = 'cuk_convo';
$servername = "209.59.187.13";
$username = 'cukuser';
$password = "Cuk_convo_2018";
$databse = 'cuk_convo';
$conn = new mysqli($servername,$username,$password,$databse);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}*/
include('database.php');
error_reporting(E_ALL);
ini_set('display_errors', 'on');
include('PHPExcel-1.8/Classes/PHPExcel.php');
include('PHPExcel-1.8/Classes/PHPExcel/Writer/Excel2007.php');
$fromdeg = explode('-',$_GET['fromdeg']);
$todeg = explode('-',$_GET['todeg']);
$fromapp = $_GET['fromapp'];
$toapp = $_GET['toapp'];
$combcode = $_GET['combcode'];
//echo $containing_dir = basename(dirname(__FILE__));
//die();
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("PHPExcel Test Document")
->setSubject("PHPExcel Test Document")
->setDescription("Test document for PHPExcel, generated using PHP classes.")
->setKeywords("office PHPExcel php")
->setCategory("Test result file");
$collcode_query = "SELECT dc.fappno,dc.fphotopath,d.`fdescpn` as degree,
dc.fname, dc.ffatname, dc.fmotname, dc.femail, date_format(dc.fdob,'%d/%m/%Y') as dob,
dc.fcaste, dc.fsex, dc.FCONTACT_NO as fmobileno,
concat(ifnull(dc.FCURRADD1,''),' ',ifnull(dc.FCURRADD2,''), ' ',ifnull(dc.FCURRADD3,''), ' ' ,ifnull(dc.FCURRADD4,''),' ',ifnull(dc.FCURDISTRICT,''),' ',ifnull(dc.FCURSTATE,''),' - ',ifnull(dc.FCURPINCODE,'')) as curradd,
concat(ifnull(dc.FPERMADD1,''),' ',ifnull(dc.FPERMADD2,''), ' ',ifnull(dc.FPERMADD3,''), ' ' ,ifnull(dc.FPERMADD4,''),' ',ifnull(dc.FPERDISTRICT,''),' ',ifnull(dc.FPERSTATE,''),' - ',ifnull(dc.FPERPINCODE,'')) as peradd,
dc.FAADHARNO
FROM studadm dc INNER JOIN degree d ON d.`fdegree` = dc.`fdegree` and dc.FEXAMNO = d.fexamno
WHERE ifnull(dc.FAPPRSTATUS,'') = 'APPROVED'
and ifnull(dc.fphotopath,'') <> '' and dc.fexamno = 'A' and dc.fdegree between '{$fromdeg[0]}'
and '{$todeg[0]}' and dc.fappno between '{$fromapp}' and '{$toapp}'
and dc.fcombcode = '{$combcode}'
ORDER BY dc.fdegree,dc.fname";
//var_dump($collcode_query);
$result = mysqli_query($conn,$collcode_query);
$i=0;
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueByColumnAndRow(0,1,'Sl. No.')
->setCellValueByColumnAndRow(1,1,'App. No.')
->setCellValueByColumnAndRow(2,1,'Degree')
->setCellValueByColumnAndRow(3,1,'Name')
->setCellValueByColumnAndRow(4,1,'Father Name')
->setCellValueByColumnAndRow(5,1,'Mother Name')
->setCellValueByColumnAndRow(6,1,'Category')
->setCellValueByColumnAndRow(7,1,'DOB')
->setCellValueByColumnAndRow(8,1,'Sex')
->setCellValueByColumnAndRow(9,1,'Email Id')
->setCellValueByColumnAndRow(10,1,'Mobile No')
->setCellValueByColumnAndRow(11,1,'Aadhar Number')
->setCellValueByColumnAndRow(12,1,'Communication Address')
->setCellValueByColumnAndRow(13,1,'Permanent Address')
->setCellValueByColumnAndRow(14,1,'Photo');
//$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(100);
$i = 2;
$x = 1;
while($coll = mysqli_fetch_array($result,MYSQLI_NUM))
{
//var_dump($coll);
//echo $_SERVER['DOCUMENT_ROOT'];die();
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueByColumnAndRow(0,$i,$x)
->setCellValueByColumnAndRow(1,$i,$coll[0])
->setCellValueByColumnAndRow(2,$i,$coll[2])
->setCellValueByColumnAndRow(3,$i,$coll[3])
->setCellValueByColumnAndRow(4,$i,$coll[4])
->setCellValueByColumnAndRow(5,$i,$coll[5])
->setCellValueByColumnAndRow(6,$i,$coll[8])
->setCellValueByColumnAndRow(7,$i,$coll[7])
->setCellValueByColumnAndRow(8,$i,$coll[9])
->setCellValueByColumnAndRow(9,$i,$coll[10])
->setCellValueByColumnAndRow(10,$i,$coll[6])
->setCellValueByColumnAndRow(11,$i,$coll[13])
->setCellValueByColumnAndRow(12,$i,$coll[11])
->setCellValueByColumnAndRow(13,$i,$coll[12]);
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(110);
$n = 'O'.$i;
$coll[1] = "/home/logisys32/public_html/oasis/gcg/adm/".$coll[1];
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('test_img');
$objDrawing->setDescription('test_img');
$objDrawing->setPath($coll[1]);
$objDrawing->setCoordinates($n);
$objDrawing->setHeight(138);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$i++;
$x++;
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="admission_data.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
?>
|