session_start();
include "config.php";
include "functions.php";
include("function_mobile_detect.php");
if(isMobileDevice())
$mobile_device = 1;
$show_auction_sheet = 1;//Set deafaulkt t0 1
if($_REQUEST['auction_id'])
$auction_id = htmlentities($auction_id,ENT_QUOTES);
elseif($_GET['s'])
{
$auction_id = htmlentities($s,ENT_QUOTES);
if(hash('haval160,4', $auction_id) == $o)
$show_auction_sheet = 1;
}
if(isset($_REQUEST['ad']))
{
$show_auction_detail = $_REQUEST['ad'];
}
else
$show_auction_detail = 1;
if($_REQUEST['gk'])
{
$q = "SELECT * FROM whatsapp_group WHERE group_key = '".$_REQUEST['gk']."' ";
$r = pg_query($q) or die(pg_last_error());
$line = pg_fetch_assoc($r);
$group_data = json_decode($line['stock_details'] , true);
foreach($group_data as $data)
{
if($data['n'] == $auction_id)
{
$price_type = $data['t'];
$price_curr = $data['c'];
$price = $data['p'];
$remarks = $data['r'];
$group_remarks = $data['gr'];
}
}
}
$q = "SELECT auctionstock.* ,taa_auc_id
FROM auctionstock
LEFT JOIN auction_zone ON auction_zone.auction_full_name = auctionstock.auction_name
where auctionstock.auction_id = '".$auction_id ."' ";
$r = pg_query($q) or die(pg_last_error());
$line = pg_fetch_array($r);
$auction_id = $line['auction_id'];
$taa_auc_id = $line['taa_auc_id'];
$import_id = date("Ymd",strtotime($line[auction_date])).str_pad($taa_auc_id,3,'0',STR_PAD_LEFT).str_pad($line[lot_no],5,'0',STR_PAD_LEFT);
if($_POST['import_pictures'])
{
$url = 'https://photo.japan-auto-auctions.com/import_pictures/?id='.$auction_id.'&carid='.$import_id;
//print $url ."
";
$all_images = file_get_contents($url);
//print $all_images;
if($all_images)
{
$q2 = "UPDATE auctionstock SET all_images = '$all_images' WHERE auctionstock.auction_id = '".$auction_id ."' ";
$r2 = pg_query($q2) or die(pg_last_error());
}
}
if($download && $auction_id)
{
$pic_list = array();
//if($ZAAVIEWAUCTIONPICS)
{
if($line['all_images'])
{
$image_list = explode("#" , $line['all_images']);
foreach($image_list as $img )
$pic_list[] = $img;
}
else
{
if($line[image1])
{
$pic_list[] = $line[image1];
}
if($line[image2])
{
$pic_list[] = $line[image2];
}
if($line[image3])
{
$pic_list[] = $line[image3];
}
if($line[image4])
{
$pic_list[] = $line[image4];
}
if($line[image5])
{
$pic_list[] = $line[image5];
}
if($line[auction_img])
{
$pic_list[] = $line[auction_img];
}
}
}
$files = array();
foreach($pic_list as $i => $pic)
{
$files['path'][] = $pic;
$files['name'][] = "Pic ".($i+1).".jpg";
}
# create new zip opbject
$zip = new ZipArchive();
# create a temp file & open it
$tmp_file = tempnam('/temp','AUCPIC');
$zip->open($tmp_file, ZipArchive::CREATE);
# loop through each file
foreach($files['path'] as $k => $file){
# download file
$download_file = file_get_contents($file);
fclose($handle);
#add it to the zip
$zip->addFromString($files['name'][$k],$download_file);
}
# close zip
$zip->close();
# send the file to the browser as a download
header('Content-disposition: attachment; filename='.$line['lot_no'].'-'.$line['auction_name'].'-pictures.zip');
header('Content-type: application/zip');
readfile($tmp_file);
die();
}
if($auction_id)
{
showpopup('detailspopup' , "" , "");
?>
| $exr = getXERate('JPY' , $price_curr); print $price_curr." ". number_format($line['start'] / $exr) . "start"; ?> |
| JPY |