<?php require_once 'protect.php'; ?>
<hr>
<!-- days-->
<?php
while (strtotime($startdate) < strtotime($enddate)) {
$startdate = date ("Y-m-d", strtotime("+1 day", strtotime($startdate)));
$everydate = $startdate;
$displaydate = date ("d-m-Y", strtotime($everydate));
$calcdate = str_replace("-", "", substr($everydate, 5) );
$countd++;
?>

<?php
$result71 = $mysqli->query("SELECT * FROM seasons WHERE (date1 <= '$calcdate' AND date1b >= '$calcdate') OR (date2 <= '$calcdate' AND date2b >= '$calcdate') AND lang_id=$lang");
$row = $result71->fetch_array(); 
$seasonid=$row['insert_id'];
$season=$row['name'];
$date1=$row['date1'];
$date2=$row['date2'];
$date1b=$row['date1b'];
$date2b=$row['date2b'];

$result72 = $mysqli->query("SELECT * FROM prices WHERE item_id=$id AND season_id=$seasonid AND available=1");
$row = $result72->fetch_array(); 
$pprice=$row['price'];
$allprice = $pprice*$pprice;

$dprice = $pprice-($pprice*(($discount+$langdiscount)/100));
$dprice2 = $dprice-($dprice*($sitediscount2/100));

if ($adays>0) { 
$totalprice += $dprice/$totaldays;
$totalprice2 += $dprice2/$totaldays;
} else {
$totalprice += $dprice;
$totalprice2 += $dprice2;
}

$totalpricep = floor($totalprice);
$totalpricec = floor($totalprice2);
?>
<!--end days-->
<?php } ?>
<?php
$totalpricef = ($totalpricep*$adults)+($totalpricec*$children);
$amount = $totalpricef;
?>