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.117.93.183
<?php
require_once(_DIR_."/../aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
session_start();
function replaceChars($name)
{
$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
$link_name = strtolower(str_replace($spl_char,"_",$name));
return str_ireplace("__","_",$link_name);
}
function downloadAllStudentPhotos($aobj_context)
{
ini_set('max_execution_time', '900');
ini_set('memory_limit','1G');
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$college_code = $_SESSION['collcode'];
$degree_code = $aobj_context->mobj_data['degreeCode'];
$_SESSION['degree_codeImgUp']=$degree_code;
$RegNo_start = substr("00000000".$aobj_context->mobj_data["regStart"],-8);
$RegNo_end = substr("ZZZZZZZZ".$aobj_context->mobj_data["regEnd"],-8);
$sql_dateFormat = "select CONCAT(DAY(NOW()),MONTH(NOW()),YEAR(NOW()),HOUR(NOW())) as dateFormat ";
$lobj_dateFormat = $aobj_context->mobj_db->getRow($sql_dateFormat);
$get_studentInfo = "select s.fdegree,s.fregno,s.FPHOTOPATH, c.funivcode from student s , control c
where s.fdegree = '{$degree_code}'
and s.fregno between '{$RegNo_start}' and '{$RegNo_end}' AND IFNULL(s.FPHOTOPATH,'') != '' ORDER BY s.fregno ";
$lobj_get_studentInfo = $aobj_context->mobj_db->getAll($get_studentInfo);
if(strtoupper($aobj_context->mobj_data["db"]) == 'KUSDDE')
$FUNIVCODE = '003D';
else
$FUNIVCODE = $lobj_get_studentInfo[0]['funivcode'];
$desDirectry = $aobj_context->main_src.'/'.$aobj_context->mobj_data["db"]."/tmpphotos/".$degree_code.$lobj_dateFormat['dateFormat'].'/';
$photoDownloadCnt=0;
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
foreach($lobj_get_studentInfo as $key=>$value)
{
$fURI ='';
$photo_path = $value['FPHOTOPATH'];
$file_name=replaceChars(basename($photo_path));
$fURI = $FUNIVCODE.'/'.$photo_path;
if(!is_dir($desDirectry))
{
mkdir($desDirectry);
chmod($desDirectry,0777);
}
$regno_index = $value['fregno'];
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
$full_file_path= $desDirectry.$regno_index.".".$ext;
$target_file = $full_file_path;// Path to a local file
if (file_exists( $target_file ))
{
$ifmodhdr = 'If-Modified-Since: '.date( "r", filemtime( $target_file ) )."\r\n";
}
else
{
$ifmodhdr = '';
}
// $rc = copy( $fURI, $target_file);
try
{
$rc = $s3->getObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $fURI, 'SaveAs' => $target_file]);
} catch(S3Exception $e) {
$excepted = true;
// Assert::assertEquals('NoSuchKey', $e->getAwsErrorCode());
} finally {
// Assert::assertTrue($excepted);
}
// if($rc)
// {
// $photoDownloadCnt++;
// if ( fclose( $rc ) )
// {
// unset( $err );
// }
// else
// {
// $err = error_get_last();
// }
// }
// else
// {
// $err = error_get_last();
// }
}
$the_folder = $desDirectry;
$zip_file_name = $aobj_context->mobj_data["db"]."/tmpphotos/"."{$degree_code}{$lobj_dateFormat['dateFormat']}.zip";
$download_file= true;
// $command = "zip -r ".$zip_file_name." tmpphotos/".$degree_code.$lobj_dateFormat['dateFormat'];
// $res = exec($command);
$za = new FlxZipArchive;
// $za = new ZipArchive();
$res = $za->open($zip_file_name, ZipArchive::CREATE);
if($res === TRUE)
{
$za->addDir($the_folder, basename($the_folder));
$za->close();
}
else
{
echo 'Could not create a zip archive';
}
if($download_file)
{
$command = "rm -r $desDirectry";
$res = exec($command);
ob_get_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($zip_file_name) . ";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($zip_file_name));
readfile($zip_file_name);
}
}
function downloadTDVSScripts($aobj_context)
{
ini_set('max_execution_time', '900');
ini_set('memory_limit','1G');
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$college_code = $_SESSION['collcode'];
$degree_code = $aobj_context->mobj_data['degreeCode'];
$_SESSION['degree_codeImgUp']=$degree_code;
$RegNo_start = substr("00000000".$aobj_context->mobj_data["regStart"],-8);
$RegNo_end = substr("ZZZZZZZZ".$aobj_context->mobj_data["regEnd"],-8);
$sql_dateFormat = "select CONCAT(DAY(NOW()),MONTH(NOW()),YEAR(NOW()),HOUR(NOW())) as dateFormat ";
$lobj_dateFormat = $aobj_context->mobj_db->getRow($sql_dateFormat);
$get_studentInfo = "select fregcode,FFILEPATH from logisys3_rcu.tdvs_tabhead where fregcode in('32121000104',
'32121000105',
'32121000106',
'32121000107',
'32121000108',
'32121000109',
'32123000102',
'32123000103',
'32321000217',
'41122000101',
'41122000102',
'41122000103',
'41122000104',
'41122000105',
'41122000106',
'41122000107',
'41122000108',
'41122000109',
'41122000110',
'41122000111',
'41122000112',
'41122000113',
'41122000114',
'41122000115',
'41122000116',
'41122000117',
'41122000118',
'41122000201',
'41122000202',
'41122000203',
'41122000204',
'41122000205',
'41122000206',
'41122000207',
'41122000208',
'41122000209',
'41122000210',
'41122000211',
'41122000212',
'41122000213',
'41122000214',
'41122000215',
'41122000216',
'41122000217',
'41122000218',
'41122000301',
'41122000302',
'41122000303',
'41122000304',
'41122000305',
'41122000306',
'41122000307',
'41122000308',
'41122000309',
'41122000310',
'41122000311',
'41122000312',
'41122000313',
'41122000314',
'41122000315',
'41122000316',
'41122000317',
'41122000318',
'41122000401',
'41122000402',
'41122000403',
'41122000404',
'41122000405',
'41122000406',
'41122000407',
'41122000408',
'41122000409',
'41122000410',
'41122000411',
'41122000412',
'41122000413',
'41122000414',
'41122000415',
'41122000416',
'41122000417',
'41122000418',
'41122000501',
'41122000502',
'41122000503',
'41122000504',
'41122000505',
'41122000506',
'41122000507',
'41122000508',
'41122000509',
'41122000510',
'41122000511',
'41122000512',
'41122000513',
'41122000514',
'41122000515',
'41122000516',
'41122000517',
'41122000518',
'41122000601',
'41122000602',
'41122000603',
'41122000604',
'41122000605',
'41122000606',
'41122000607',
'41122000608',
'41122000609',
'41122000610',
'41122000611',
'41122000612',
'41122000613',
'41122000614',
'41122000615',
'41122000616',
'41122000617',
'41122000618',
'41122000701',
'41122000702',
'41122000703',
'41122000704',
'41122000705',
'41122000706',
'41122000707',
'41122000708',
'41122000709',
'41122000710',
'41122000711',
'41122000712',
'41122000713',
'41122000714',
'41122000715',
'41122000716',
'41122000717',
'41122000718',
'41122000801',
'41122000802',
'41122000803',
'41122000804',
'41122000805',
'41122000806',
'41122000807',
'41122000808',
'41122000809',
'41122000810',
'41122000811',
'41122000812',
'41122000813',
'41122000814',
'41122000815',
'41122000816',
'41122000817',
'41122000818',
'41122000901',
'41122000902',
'41122000903',
'41122000904',
'41122000905',
'41122000906',
'41122000907',
'41122000908',
'41122000909',
'41122000910',
'41321005515',
'41321008708',
'41321009810',
'41321010718',
'41322000101',
'41322000102',
'41322000103',
'41322000104',
'41322000105',
'41322000106',
'41322000107',
'41322000108',
'41322000109',
'41322000110',
'41322000111',
'41322000112',
'41322000113',
'41322000114',
'41322000115',
'41322000116',
'41322000117',
'41322000118',
'41322000201',
'41322000202',
'41322000203',
'41322000204',
'41322000205',
'41322000206',
'41322000207',
'41322000208',
'41322000209',
'41322000210',
'41322000211',
'41322000212',
'41322000213',
'41322000214',
'41322000215',
'41322000216',
'41322000217',
'41322000218',
'41322000301',
'41322000302',
'41322000303',
'41322000304',
'41322000305',
'41322000306',
'41322000307',
'41322000308',
'41322000309',
'41322000310',
'41322000311',
'41322000312',
'41322000313',
'41322000314',
'41322000315',
'41322000316',
'41322000317',
'41322000318',
'41322000401',
'41322000402',
'41322000403',
'41322000404',
'41322000405',
'41322000406',
'41322000407',
'41322000408',
'41322000409',
'41322000410',
'41322000411',
'41322000412',
'41322000413',
'41322000414',
'41322000415',
'41322000416',
'41322000417',
'41322000418',
'41322000501',
'41322000502',
'41322000503',
'41322000504',
'41322000505',
'41322000506',
'41322000507',
'41322000508',
'41322000509',
'41322000510',
'41322000511',
'41322000512',
'41322000513',
'41322000514',
'41322000515',
'41322000516',
'41322000517',
'41322000518',
'41322000601',
'41322000602',
'41322000603',
'41322000604',
'41322000605',
'41322000606',
'41322000607',
'41322000608',
'41322000609',
'41322000610',
'41322000611',
'41322000612',
'41322000613',
'41322000614',
'41322000615',
'41322000616',
'41322000617',
'41322000618',
'41322000701',
'41322000702',
'41322000703',
'41322000704',
'41322000705',
'41322000706',
'41322000707',
'41322000708',
'41322000709',
'41322000710',
'41322000711',
'41322000712',
'41322000713',
'41322000714',
'41322000715',
'41322000716',
'41322000717',
'41322000718',
'41322001901',
'41322001902',
'41322001903',
'41322001904',
'41322001905',
'41322001906',
'41322001907',
'41322001908',
'41322001909',
'41322001910',
'41322001911',
'41322001912',
'41322001913',
'41322001914',
'41322001915',
'41322001916',
'41322001917',
'41322001918',
'41322002001',
'41322002002',
'41322002003',
'41322002004',
'41322002005',
'41322002006',
'41322002007',
'41322002008',
'41322002009',
'41322002010',
'41322002011',
'41322002012',
'41322002013',
'41322002014',
'41322002015',
'41322002016',
'41322002017',
'41322002018',
'41322002101',
'41322002102',
'41322002103',
'41322002104',
'41322002105',
'41322002106',
'41322002107',
'41322002108',
'41322002109',
'41322002110',
'41322002111',
'41322002112',
'41322002113',
'41322002114',
'41322002115',
'41322002116',
'41322002117',
'41322002118',
'41322002801',
'41322002802',
'41322002803',
'41322002804',
'41322002805',
'41322002806',
'41322002807',
'41322002808',
'41322002809',
'41322002810',
'41322002811',
'41322002812',
'41322002813',
'41322002814',
'41322002815',
'41322002816',
'41322002817',
'41322002818',
'41322002901',
'41322002902',
'41322002903',
'41322002904',
'41322002905',
'41322002906',
'41322002907',
'41322002908',
'41322002909',
'41322002910',
'41322002911',
'41322002912',
'41322002913',
'41322002914',
'41322002915',
'41322002916',
'41322002917',
'41322002918',
'41322003001',
'41322003002',
'41322003003',
'41322003004',
'41322003005',
'41322003006',
'41322003007',
'41322003008',
'41322003009',
'41322003010',
'41322003011',
'41322003012',
'41322003013',
'41322003014',
'41322003015',
'41322003016',
'41322003017',
'41322003018',
'41322003101',
'41322003102',
'41322003103',
'41322003104',
'41322003105',
'41322003106',
'41322003107',
'41322003108',
'41322003109',
'41322003110',
'41322003111',
'41322003112',
'41322003113',
'41322003114',
'41322003115',
'41322003116',
'41322003117',
'41322003118',
'41322003201',
'41322003202',
'41322003203',
'41322003204',
'41322003205',
'41322003206',
'41322003207',
'41322003208',
'41322003209',
'41322003210',
'41322003211',
'41322003212',
'41322003213',
'41322003214',
'41322003215',
'41322003216',
'41322003217',
'41322003218',
'41322003301',
'41322003302',
'41322003303',
'41322003304',
'41322003305',
'41322003306',
'41322003307',
'41322003308',
'41322003309',
'41322003310',
'41322003311',
'41322003312',
'41322003313',
'41322003314',
'41322003315',
'41322003316',
'41322003317',
'41322003318',
'41322003401',
'41322003402',
'41322003403',
'41322003404',
'41322003405',
'41322003406',
'41322003407',
'41322003408',
'41322003409',
'41322003410',
'41322003411',
'41322003412',
'41322003413',
'41322003414',
'41322003415',
'41322003416',
'41322003417',
'41322003418',
'41322003501',
'41322003502',
'41322003503',
'41322003504',
'41322003505',
'41322003506',
'41322003507',
'41322003508',
'41322003509',
'41322003510',
'41322003511',
'41322003512',
'41322003513',
'41322003514',
'41322003515',
'41322003516',
'41322003517',
'41322003518',
'41322003601',
'41322003602',
'41322003603',
'41322003604',
'41322003605',
'41322003606',
'41322003607',
'41322003608',
'41322003609',
'41322003610',
'41322003611',
'41322003612',
'41322003613',
'41322003614',
'41322003615',
'41322003616',
'41322003617',
'41322003618',
'41322003701',
'41322003702',
'41322003703',
'41322003704',
'41322003705',
'41322003706',
'41322003707',
'41322003708',
'41322003709',
'41322003710',
'41322003711',
'41322003712',
'41322003713',
'41322003714',
'41322003715',
'41322003716',
'41322003717',
'41322003718',
'41322003801',
'41322003802',
'41322003803',
'41322003804',
'41322003805',
'41322003806',
'41322003807',
'41322003808',
'41322003809',
'41322003810',
'41322003811',
'41322003812',
'41322003813',
'41322003814',
'41322003815',
'41322003816',
'41322003817',
'41322003818',
'41322005101',
'41322005102',
'41322005103',
'41322005104',
'41322005105',
'41322005106',
'41322005107',
'41322005108',
'41322005109',
'41322005110',
'41322005111',
'41322005112',
'41322005113',
'41322005114',
'41322005115',
'41322005116',
'41322005117',
'41322005118',
'41322005201',
'41322005202',
'41322005203',
'41322005204',
'41322005205',
'41322005206',
'41322005207',
'41322005208',
'41322005209',
'41322005210',
'41322005211',
'41322005212',
'41322005213',
'41322005214',
'41322005215',
'41322005216',
'41322005217',
'41322005218',
'41322005301',
'41322005302',
'41322005303',
'41322005304',
'41322005305',
'41322005306',
'41322005307',
'41322005308',
'41322005309',
'41322005310',
'41322005311',
'41322005312',
'41322005313',
'41322005314',
'41322005315',
'41322005316',
'41322005317',
'41322005318',
'41322005401',
'41322005402',
'41322005403',
'41322005404',
'41322005405',
'41322005406',
'41322005407',
'41322005408',
'41322005409',
'41322005410',
'41322005411',
'41322005412',
'41322005413',
'41322005414',
'41322005415',
'41322005416',
'41322005417',
'41322005418',
'41322005501',
'41322005502',
'41322005503',
'41322005504',
'41322005505',
'41322005506',
'41322005507',
'41322005508',
'41322005509',
'41322005510',
'41322005511',
'41322005512',
'41322005513',
'41322005514',
'41322005515',
'41322005516',
'41322005517',
'41322005518',
'41322005601',
'41322005602',
'41322005603',
'41322005604',
'41322005605',
'41322005606',
'41322005607',
'41322005608',
'41322005609',
'41322005610',
'41322005611',
'41322005612',
'41322005613',
'41322005614',
'41322005615',
'41322005616',
'41322005617',
'41322005618',
'41322005701',
'41322005702',
'41322005703',
'41322005704',
'41322005705',
'41322005706',
'41322005707',
'41322005708',
'41322005709',
'41322005710',
'41322005711',
'41322005712',
'41322005713',
'41322005714',
'41322005715',
'41322005716',
'41322005717',
'41322005718',
'41322005801',
'41322005802',
'41322005803',
'41322005804',
'41322005805',
'41322005806',
'41322005807',
'41322005808',
'41322005809',
'41322005810',
'41322005811',
'41322005812',
'41322005813',
'41322005814',
'41322005815',
'41322005816',
'41322005817',
'41322005818',
'41322005901',
'41322005902',
'41322005903',
'41322005904',
'41322005905',
'41322005906',
'41322005907',
'41322005908',
'41322005909',
'41322005910',
'41322005911',
'41322005912',
'41322005913',
'41322005914',
'41322005915',
'41322005916',
'41322005917',
'41322005918',
'41322006001',
'41322006002',
'41322006003',
'41322006004',
'41322006005',
'41322006006',
'41322006007',
'41322006008',
'41322006009',
'41322006010',
'41322006011',
'41322006012',
'41322006013',
'41322006014',
'41322006015',
'41322006016',
'41322006017',
'41322006018',
'41322006101',
'41322006102',
'41322006103',
'41322006104',
'41322006105',
'41322006106',
'41322006107',
'41322006108',
'41322006109',
'41322006110',
'41322006111',
'41322006112',
'41322006113',
'41322006114',
'41322006115',
'41322006116',
'41322006117',
'41322006118',
'41322006801',
'41322006802',
'41322006803',
'41322006804',
'41322006805',
'41322006806',
'41322006807',
'41322006808',
'41322006809',
'41322006810',
'41322006811',
'41322006812',
'41322006813',
'41322006814',
'41322006815',
'41322006816',
'41322006817',
'41322006818',
'41322006901',
'41322006902',
'41322006903',
'41322006904',
'41322006905',
'41322006906',
'41322006907',
'41322006908',
'41322006909',
'41322006910',
'41322006911',
'41322006912',
'41322006913',
'41322006914',
'41322006915',
'41322006916',
'41322006917',
'41322006918',
'41322007001',
'41322007002',
'41322007003',
'41322007004',
'41322007005',
'41322007006',
'41322007007',
'41322007008',
'41322007009',
'41322007010',
'41322007011',
'41322007012',
'41322007013',
'41322007014',
'41322007015',
'41322007016',
'41322007017',
'41322007018',
'41322007101',
'41322007102',
'41322007103',
'41322007104',
'41322007105',
'41322007106',
'41322007107',
'41322007108',
'41322007109',
'41322007110',
'41322007111',
'41322007112',
'41322007113',
'41322007114',
'41322007115',
'41322007116',
'41322007117',
'41322007118',
'41322008201',
'41322008202',
'41322008203',
'41322008204',
'41322008205',
'41322008206',
'41322008207',
'41322008208',
'41322008209',
'41322008210',
'41322008211',
'41322008212',
'41322008213',
'41322008214',
'41322008215',
'41322008216',
'41322008217',
'41322008218',
'41322008301',
'41322008302',
'41322008303',
'41322008304',
'41322008305',
'41322008306',
'41322008307',
'41322008308',
'41322008309',
'41322008310',
'41322008311',
'41322008312',
'41322008313',
'41322008314',
'41322008315',
'41322008316',
'41322008317',
'41322008318',
'41322008401',
'41322008402',
'41322008403',
'41322008404',
'41322008405',
'41322008406',
'41322008407',
'41322008408',
'41322008409',
'41322008410',
'41322008411',
'41322008412',
'41322008413',
'41322008414',
'41322008415',
'41322008416',
'41322008417',
'41322008418',
'41322008501',
'41322008502',
'41322008503',
'41322008504',
'41322008505',
'41322008506',
'41322008507',
'41322008508',
'41322008509',
'41322008510',
'41322008511',
'41322008512',
'41322008513',
'41322008514',
'41322008515',
'41322008516',
'41322008517',
'41322008518',
'41322008601',
'41322008602',
'41322008603',
'41322008604',
'41322008605',
'41322008606',
'41322008607',
'41322008608',
'41322008609',
'41322008610',
'41322008611',
'41322008612',
'41322008613',
'41322008614',
'41322008615',
'41322008616',
'41322008617',
'41322008618',
'41322008701',
'41322008702',
'41322008703',
'41322008704',
'41322008705',
'41322008706',
'41322008707',
'41322008708',
'41322008709',
'41322008710',
'41322008711',
'41322008712',
'41322008713',
'41322008714',
'41322008715',
'41322008716',
'41322008717',
'41322008718',
'41322008801',
'41322008802',
'41322008803',
'41322008804',
'41322008805',
'41322008806',
'41322008807',
'41322008808',
'41322008809',
'41322008810',
'41322008811',
'41322008812',
'41322008813',
'41322008814',
'41322008815',
'41322008816',
'41322008817',
'41322008818',
'41322008901',
'41322008902',
'41322008903',
'41322008904',
'41322008905',
'41322008906',
'41322008907',
'41322008908',
'41322008909',
'41322008910',
'41322008911',
'41322008912',
'41322008913',
'41322008914',
'41322008915',
'41322008916',
'41322008917',
'41322008918',
'41322009001',
'41322009002',
'41322009003',
'41322009004',
'41322009005',
'41322009006',
'41322009007',
'41322009008',
'41322009009',
'41322009010',
'41322009011',
'41322009012',
'41322009013',
'41322009014',
'41322009015',
'41322009016',
'41322009017',
'41322009018',
'41322009301',
'41322009302',
'41322009303',
'41322009304',
'41322009305',
'41322009306',
'41322009307',
'41322009308',
'41322009309',
'41322009310',
'41322009311',
'41322009312',
'41322009313',
'41322009314',
'41322009315',
'41322009316',
'41322009317',
'41322009318',
'41322009401',
'41322009402',
'41322009403',
'41322009404',
'41322009405',
'41322009406',
'41322009407',
'41322009408',
'41322009409',
'41322009410',
'41322009411',
'41322009412',
'41322009413',
'41322009414',
'41322009415',
'41322009416',
'41322009417',
'41322009418',
'41322009501',
'41322009502',
'41322009503',
'41322009504',
'41322009505',
'41322009506',
'41322009507',
'41322009508',
'41322009509',
'41322009510',
'41322009511',
'41322009512',
'41322009513',
'41322009514',
'41322009515',
'41322009516',
'41322009517',
'41322009518',
'41322009601',
'41322009602',
'41322009603',
'41322009604',
'41322009605',
'41322009606',
'41322009607',
'41322009608',
'41322009609',
'41322009610',
'41322009611',
'41322009612',
'41322009613',
'41322009614',
'41322009615',
'41322009616',
'41322009617',
'41322009618',
'41322009701',
'41322009702',
'41322009703',
'41322009704',
'41322009705',
'41322009706',
'41322009707',
'41322009708',
'41322009709',
'41322009710',
'41322009711',
'41322009712',
'41322009713',
'41322009714',
'41322009715',
'41322009716',
'41322009717',
'41322009718',
'41322009801',
'41322009802',
'41322009803',
'41322009804',
'41322009805',
'41322009806',
'41322009807',
'41322009808',
'41322009809',
'41322009810',
'41322009811',
'41322009812',
'41322009813',
'41322009814',
'41322009815',
'41322009816',
'41322009817',
'41322009818',
'41322009901',
'41322009902',
'41322009903',
'41322009904',
'41322009905',
'41322009906',
'41322009907',
'41322009908',
'41322009909',
'41322009910',
'41322009911',
'41322009912',
'41322009913',
'41322009914',
'41322009915',
'41322009916',
'41322009917',
'41322009918',
'41322010001',
'41322010002',
'41322010003',
'41322010004',
'41322010005',
'41322010006',
'41322010007',
'41322010008',
'41322010009',
'41322010010',
'41322010011',
'41322010012',
'41322010013',
'41322010014',
'41322010015',
'41322010016',
'41322010017',
'41322010018',
'41322010603',
'41322011704',
'41322012301',
'41322012302',
'41322012303',
'41322012304',
'41322012305',
'41322012306',
'41322012307',
'41322012308',
'41322012309',
'41322012310',
'41322012311',
'41322012312',
'41322012313',
'41322012314',
'41322012315',
'41322012316',
'41322012317',
'41322012318',
'41322012401',
'41322012402',
'41322012403',
'41322012404',
'41322012405',
'41322012406',
'41322012407',
'41322012408',
'41322012409',
'41322012410',
'41322012411',
'41322012412',
'41322012413',
'41322012414',
'41322012415',
'41322012416',
'41322012417',
'41322012418',
'41322012501',
'41322012502',
'41322012503',
'41322012504',
'41322012505',
'41322012506',
'41322012507',
'41322012508',
'41322012509',
'41322012510',
'41322012511',
'41322012512',
'41322012513',
'41322012514',
'41322012515',
'41322012516',
'41322012517',
'41322012518',
'41322012601',
'41322012602',
'41322012603',
'41322012604',
'41322012605',
'41322012606',
'41322012607',
'41322012608',
'41322012609',
'41322012610',
'41322012611',
'41322012612',
'41322012613',
'41322012614',
'41322012615',
'41322012616',
'41322012617',
'41322012618',
'41322012801',
'41322012802',
'41322012803',
'41322012804',
'41322012805',
'41322012806',
'41324003804',
'41324008501',
'41324008502',
'41324008503',
'41324008504',
'41324008505',
'41324008506',
'41324008507',
'41324008508',
'41324008509',
'41324008510',
'41324008511',
'41324008512',
'41324008513',
'41324008514',
'41324008515',
'41324008516',
'41324008517',
'41324008518',
'41324008601',
'41324008602',
'41324008603',
'41324008604',
'41324008605',
'41324008606',
'41324008607',
'41324008608',
'41324008609',
'41324008610',
'41324008611',
'41324008612',
'41324008613',
'41324008614',
'41324008615',
'41324008616',
'41324008617',
'41324008618',
'41324008701',
'41324008702',
'41324008703',
'41324008704',
'41324008705',
'41324008706',
'41324008707',
'41324008708',
'41324008709',
'41324008710',
'41324008711',
'41324008712',
'41324008713',
'41324008714',
'41324008715',
'41324008716',
'41324008717',
'41324008718',
'41324013301',
'41324013302',
'41324013303',
'41324013304',
'41324013305',
'41324013306',
'41324013307',
'41324013308',
'41324013309',
'41324013310',
'41324013311',
'41524009710',
'41524009711',
'41524009712',
'44622002817',
'44622002818',
'44622010501',
'44622010502',
'44622010503',
'44622010504',
'44622010505',
'44622010506',
'44622010507',
'44622010508',
'44622010509',
'44622010510',
'44622010511',
'44622010512',
'44622010513',
'44622010514',
'44622010515',
'44622010516',
'44622010517',
'44622010518',
'44624000101',
'44624000102',
'44624000103',
'44624000104',
'44624000105',
'44624000106',
'44624000107',
'44624000108',
'44624000109',
'44624000110',
'44624000111',
'44624000112',
'44624000113',
'44624000114',
'44624000115',
'44624000116',
'44624000117',
'44624000118',
'44624000201',
'44624000202',
'44624000203',
'44624000204',
'44624000205',
'44624000206',
'44624000207',
'44624000208',
'44624000209',
'44624000210',
'44624000211',
'44624000212',
'44624000213',
'44624000214',
'44624000215',
'44624000216',
'44624000217',
'44624000218',
'44624000301',
'44624000302',
'44624000303',
'44624000304',
'44624000305',
'44624000306',
'44624000307',
'44624000308',
'44624000309',
'44624000310',
'44624000311',
'44624000312',
'44624000313',
'44624000314',
'44624000315',
'44624000316',
'44624000317',
'44624000318',
'44624000401',
'44624000402',
'44624000403',
'44624000404',
'44624000405',
'44624000406',
'44624000407',
'44624000408',
'44624000409',
'44624000410',
'44624000411',
'44624000412',
'44624000413',
'44624000414',
'44624000415',
'44624000416',
'44624000417',
'44624000418',
'44624000501',
'44624000502',
'44624000503',
'44624000504',
'44624000505',
'44624000506',
'44624000507',
'44624000508',
'44624000509',
'44624000510',
'44624000511',
'44624000512',
'44624000513',
'44624000514',
'44624000515',
'44624000516',
'44624000517',
'44624000518',
'44624000601',
'44624000602',
'44624000603',
'44624000604',
'44624000605',
'44624000606',
'44624000607',
'44624000608',
'44624000609',
'44624000610',
'44624000611',
'44624000612',
'44624000613',
'44624000614',
'44624000615',
'44624000616',
'44624000617',
'44624000618',
'44624000701',
'44624000702',
'44624000703',
'44624000704',
'44624000705',
'44624000706',
'44624000707',
'44624000708',
'44624000709',
'44624000710',
'44624000711',
'44624000712',
'44624000713',
'44624000714',
'44624000715',
'44624000716',
'44624000717',
'44624000718',
'44624000801',
'44624000802',
'44624000803',
'44624000804',
'44624000805',
'44624000806',
'44624000807',
'44624000808',
'44624000809',
'44624000810',
'44624000811',
'44624000812',
'44624000813',
'44624000814',
'44624000815',
'44624000816',
'44624000817',
'44624000818',
'44624000901',
'44624000902',
'44624000903',
'44624000904',
'44624000905',
'44624000906',
'44624000907',
'44624000908',
'44624000909',
'44624000910',
'44624000911',
'44624000912',
'44624000913',
'44624000914',
'44624000915',
'44624000916',
'44624000917',
'44624000918',
'44624001001',
'44624001002',
'44624001003',
'44624001004',
'44624001005',
'44624001006',
'44624001007',
'44624001008',
'44624001009',
'44624001010',
'44624001011',
'44624001012',
'44624001013',
'44624001014',
'44624001015',
'44624001016',
'44624001017',
'44624001018',
'44624001101',
'44624001102',
'44624001103',
'44624001104',
'44624001105',
'44624001106',
'44624001107',
'44624001108',
'44624001109',
'44624001110',
'44624001111',
'44624001112',
'44624001113',
'44624001114',
'44624001115',
'44624001116',
'44624001117',
'44624001118',
'44624001201',
'44624001202',
'44624001203',
'44624001204',
'44624001205',
'44624001206',
'44624001207',
'44624001208',
'44624001209',
'44624001210',
'44624001211',
'44624001212',
'44624001213',
'44624001214',
'44624001215',
'44624001216',
'44624001217',
'44624001218',
'44624001301',
'44624001302',
'44624001303',
'44624001304',
'44624001305',
'44624001306',
'44624001307',
'44624001308',
'44624001309',
'44624001310',
'44624001311',
'44624001312',
'44624001313',
'44624001314',
'44624001315',
'44624001316',
'44624001317',
'44624001318',
'44624001401',
'44624001402',
'44624001403',
'44624001404',
'44624001405',
'44624001406',
'44624001407',
'44624001408',
'44624001409',
'44624001410',
'44624001411',
'44624001412',
'44624001413',
'44624001414',
'44624001415',
'44624001416',
'44624001417',
'44624001418',
'44624001501',
'44624001502',
'44624001503',
'44624001504',
'44624001505',
'44624001506',
'44624001507',
'44624001508',
'44624001509',
'44624001510',
'44624001511',
'44624001512',
'44624001513',
'44624001514',
'44624001515',
'44624001516',
'44624001517',
'44624001518',
'44624001601',
'44624001602',
'44624001603',
'44624001604',
'44624001605',
'44624001606',
'44624001607',
'44624001608',
'44624001609',
'44624001610',
'44624001611',
'44624001612',
'44624001613',
'44624001614',
'44624001615',
'44624001616',
'44624001617',
'44624001618',
'44624001701',
'44624001702',
'44624001703',
'44624001704',
'44624001705',
'44624001706',
'44624001707',
'44624001708',
'44624001709',
'44624001710',
'44624001711',
'44624001712',
'44624001713',
'44624001714',
'44624001715',
'44624001716',
'44624001717',
'44624001718',
'44624001801',
'44624001802',
'44624001803',
'44624001804',
'44624001805',
'44624001806',
'44624001807',
'44624001808',
'44624001809',
'44624001810',
'44624001811',
'44624001812',
'44624001813',
'44624001814',
'44624001815',
'44624001816',
'44624001817',
'44624001818',
'44624001901',
'44624001902',
'44624001903',
'44624001904',
'44624001905',
'44624001906',
'44624001907',
'44624001908',
'44624001909',
'44624001910',
'44624001911',
'44624001912',
'44624001913',
'44624001914',
'44624001915',
'44624001916',
'44624001917',
'44624001918',
'44624002001',
'44624002002',
'44624002003',
'44624002004',
'44624002005',
'44624002006',
'44624002007',
'44624002008',
'44624002009',
'44624002010',
'44624002011',
'44624002012',
'44624002013',
'44624002014',
'44624002015',
'44624002016',
'44624002017',
'44624002018',
'44624002101',
'44624002102',
'44624002103',
'44624002104',
'44624002105',
'44624002106',
'44624002107',
'44624002108',
'44624002109',
'44624002110',
'44624002111',
'44624002112',
'44624002113',
'44624002114',
'44624002115',
'44624002116',
'44624002117',
'44624002118',
'44624002201',
'44624002202',
'44624002203',
'44624002204',
'44624002205',
'44624002206',
'44624002207',
'44624002208',
'44624002209',
'44624002210',
'44624002211',
'44624002212',
'44624002213',
'44624002214',
'44624002215',
'44624002216',
'44624002217',
'44624002218',
'44624002301',
'44624002302',
'44624002303',
'44624002304',
'44624002305',
'44624002306',
'44624002307',
'44624002308',
'44624002309',
'44624002310',
'44624002311',
'44624002312',
'44624002313',
'44624002314',
'44624002315',
'44624002316',
'44624002317',
'44624002318',
'44624002401',
'44624002402',
'44624002403',
'44624002404',
'44624002405',
'44624002406',
'44624002407',
'44624002408',
'44624002409',
'44624002410',
'44624002411',
'44624002412',
'44624002413',
'44624002414',
'44624002415',
'44624002416',
'44624002417',
'44624002418',
'44624002501',
'44624002502',
'44624002503',
'44624002504',
'44624002505',
'44624002506',
'44624002507',
'44624002508',
'44624002509',
'44624002510',
'44624002511',
'44624002512',
'44624002513',
'44624002514',
'44624002515',
'44624002516',
'44624002517',
'44624002518',
'44624002601',
'44624002602',
'44624002603',
'44624002604',
'44624002605',
'44624002606',
'44624002607',
'44624002608',
'44624002609',
'44624002610',
'44624002611',
'44624002612',
'44624002613',
'44624002614',
'44624002615',
'44624002616',
'44624002617',
'44624002618',
'44624002701',
'44624002702',
'44624002703',
'44624002704',
'44624002705',
'44624002706',
'44624002707',
'44624002708',
'44624002709',
'44624002710',
'44624002711',
'44624002712',
'44624002713',
'44624002714',
'44624002715',
'44624002716',
'71694000201',
'71694000202',
'71694000203',
'71694000204',
'71694000205',
'71694000206',
'71694000207',
'71694000208',
'71694000209',
'71694000210',
'71694000211',
'71694000212',
'71694000214',
'71694000215',
'71694000218',
'72050000105',
'90844003910')";
$lobj_get_studentInfo = $aobj_context->mobj_db->getAll($get_studentInfo);
$desDirectry = $aobj_context->main_src.'/'.$aobj_context->mobj_data["db"]."/tmpphotos/".$lobj_dateFormat['dateFormat'].'/';
$photoDownloadCnt=0;
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
foreach($lobj_get_studentInfo as $key=>$value)
{
$fURI ='';
$photo_path = $value['FFILEPATH'];
$file_name=replaceChars(basename($photo_path));
$fURI = $photo_path;
if(!is_dir($desDirectry))
{
mkdir($desDirectry);
chmod($desDirectry,0777);
}
$regno_index = $value['fregcode'];
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
$full_file_path= $desDirectry.$regno_index.".".$ext;
$target_file = $full_file_path;// Path to a local file
if (file_exists( $target_file ))
{
$ifmodhdr = 'If-Modified-Since: '.date( "r", filemtime( $target_file ) )."\r\n";
}
else
{
$ifmodhdr = '';
}
// $rc = copy( $fURI, $target_file);
try
{
$rc = $s3->getObject(['Bucket' => "answer-booklets", 'Key' => $fURI, 'SaveAs' => $target_file]);
} catch(S3Exception $e) {
$excepted = true;
// Assert::assertEquals('NoSuchKey', $e->getAwsErrorCode());
} finally {
// Assert::assertTrue($excepted);
}
// if($rc)
// {
// $photoDownloadCnt++;
// if ( fclose( $rc ) )
// {
// unset( $err );
// }
// else
// {
// $err = error_get_last();
// }
// }
// else
// {
// $err = error_get_last();
// }
}
$the_folder = $desDirectry;
$zip_file_name = $aobj_context->mobj_data["db"]."/tmpphotos/"."{$lobj_dateFormat['dateFormat']}.zip";
$download_file= true;
// $command = "zip -r ".$zip_file_name." tmpphotos/".$degree_code.$lobj_dateFormat['dateFormat'];
// $res = exec($command);
$za = new FlxZipArchive;
// $za = new ZipArchive();
$res = $za->open($zip_file_name, ZipArchive::CREATE);
if($res === TRUE)
{
$za->addDir($the_folder, basename($the_folder));
$za->close();
}
else
{
echo 'Could not create a zip archive';
}
if($download_file)
{
$command = "rm -r $desDirectry";
$res = exec($command);
ob_get_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($zip_file_name) . ";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($zip_file_name));
readfile($zip_file_name);
}
}
class FlxZipArchive extends ZipArchive
{
public function addDir($location, $name)
{
$this->addDirDo($location, $name);
}
private function addDirDo($location, $name)
{
$name .= '/';
$location .= '/';
$dir = opendir ($location);
while ($file = readdir($dir))
{
if ($file == '.' || $file == '..') continue;
// Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
$do = (filetype( $location . $file) == 'dir') ? 'addDir' : 'addFile';
$this->$do($location . $file, $name . $file);
}
}
}
?>
|