<?php 
@header('Content-type: text/html;charset=windows-1256');
?>
<!DOCTYPE html>
<head>
 <style>
        table {
            border-collapse: collapse;
        }
        table, th, td {
            border: 1px solid black;
        }
        th, td {
            padding: 10px;
        }
        th {
            text-align: left;
        }
    </style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
</head>
    <body>

        <?php
@ini_set('display_errors',"0");
extract($_POST);
//extract($request);
extract($_POST);
extract($post);
//extract(("p")$post);
extract(('array'),$post);
extract(('array'),$method);
	include('functions_hijridate.php');
        $month = array("January" => "1",
            "February" => "2",
            "March" => "3",
            "April" => "4",
            "May" => "5",
            "June" => "6",
            "July" => "7",
            "August" => "8",
            "September" => "9",
            "October" => "10",
            "November" => "11",
            "December" => "12");
        ?><form name="form" method="post" action="<?php echo $PHP_SELF ?>">
<div style="padding:10px; background-color: #F8F7F4; border: 1px dashed #EAE9CD;">

	Latitude: <input type="text" value="<?php echo  $latitude; ?>" name="latitude" size="4">
	Longitude: <input type="text" value="<?php echo $longitude;?>" name="longitude" size="4">
	Time Zone: <input type="text" value="<?php echo $timeZone;?>" name="timeZone" size="2"> 
	Year: <input type="text" value="<?php echo  $year; ?>" name="year" size="4">
 <br>
<form><select name="month">
<?php foreach ($month as $key => $value) { ?>
<option value="<?php echo $value;?>"><?php
echo $key;?></option>
                <?php } ?>
            </select>
            <input type="submit" name="submit">
        </form>
        <?php
$sooo = date('m');
$soooo = date('Y');
$inputMonth= $_POST['month'];
if ($inputMonth==""){$inputMonth="$sooo";}else{$inputMonth= $_POST['month'];}
if ($year==""){$year="$soooo";}else{$year= $_POST['year'];}
 //if (isset($_POST['submit'])) {
if($inputMonth == "12"){
$soooo = date('Y');
$year = $_POST['year'];
if ($_POST['year']==""){$year="$soooo";}else{$year= $_POST['year'];}
$soooo = date('Y');
//$year = "2023"; 
$a_date = "2023-12-23"; 
$lastday = date('t',strtotime($dateToTest));
$y=  $year;
$m= $month;
$list=array();
$month = 12; 
//$year= 
//for($d=1; $d<=31; $d++) { 
  $mkt=mktime(12, 0, 0, $month,01, $year);
 $time=mktime(12, 0, 0, $month, $d, $year);
// if (date('m', $time)==$month)
$dayy=date('d',$mkt);
 $list[]=hdate('_Y-_m-_d Y m d D',$time).'-'.$fajr_prayer2.'-'.$Shrouk_prayer2.'-'.$zuhr_prayer2.'-'.$asr_prayer2.
'-'.$maghrib_prayer2.'-'.$esha_prayer2;
//echo "<pre>";  echo $fajr_prayer2;
//$mkt += 24*60*60;
date('m', $mkt)==$month;
date('Y', $mkt)==$year;
date('Y', $date2)==$year;
date('Y', $end2)==$year;
$date2 = date("$year-m-01");
//$date2=date('Y-m-01', $mkt); 
	//$date2 = strtotime($year. '12 d');
 //$date2 = hdate("$year-$month-d", $mkt);
$end2 =  date("$year-m-t");
//$year . "-" . $month . "-" . hdate('_t', strtotime($date2));

}else { $mkt = mktime(0, 0, 0, $inputMonth, 1, $year);
            $date2 = date("$year-$inputMonth-d", $mkt);
            $end2 =  $year . "-" . $inputMonth . "-" . date('t', strtotime($date2));}
            ?>
   <?php
echo "<br><table align='center' border='1' width='65%' height=''><tr>
				<th>arbbbbbbbb</th>
				<th>mildddddd</th>
				<th>fgrr</th>
        <th>shrgg</th>
        <th>zuhr</th>
        <th>asr</th>
        <th>mgh</th>
        <th>esha</th>
			</tr></table>";
                    while (strtotime($date2) <= strtotime($end2)) {require_once('hejri_calendar.php');
		$sanexday = new prayer_time;

$pi = 3.14159265358979323846;
$long = 46.716667;
$lat = 24.633333;
$zone =3;

//list($yy,$mm,$dd) = explode('-', date('Y-m-d', $date2));
$y=  $year;
$m= $inputMonth;
$zone_desc = $vbulletin->options['ain_prayer_description'];  
$julian_day = $sanexday->julian_day($y,$m,$d);
$sun_long = $sanexday->sun_long($julian_day);
$sun_period = $sanexday->sun_period($julian_day);
$Lambda = $sanexday->sun_wave_long($sun_long, $sun_period, $pi);
$Obliquity = $sanexday->obliquity($julian_day);
$Alpha = $sanexday->alpha($Obliquity, $Lambda, $pi);
$ST = $sanexday->starry_time($julian_day);
$Dec = $sanexday->sun_obliquity($Obliquity, $Lambda, $pi);

$noon = $sanexday->sun_miday($Alpha, $ST);
$UT_noon = $sanexday->international_midday($noon, $long);
$local_noon = $sanexday->local_noon($UT_noon, $zone);
$zuhr_prayer2 = $sanexday->zuhr_time($local_noon);

$AsrAlt = $sanexday->asr_alt($lat, $Dec, $pi);
$AsrAlt2 = $sanexday->asr_alt2($lat, $Dec, $pi);		
$AsrArc = $sanexday->asr_arc($AsrAlt, $lat, $Dec, $pi);
$AsrArc2 = $sanexday->asr_arc2($AsrAlt2, $lat, $Dec, $pi);
$AsrTime = $sanexday->asr_time($local_noon, $AsrArc);
$AsrTime2 = $sanexday->asr_time2($local_noon, $AsrArc2);
$asr_prayer3 = $sanexday->asr_prayer_time($AsrTime);
$asr_prayer2 = $sanexday->asr_prayer_time2($AsrTime2);

$Durinal_Arc = $sanexday->Durinal_Arc ($lat, $Dec, $pi);
$sun_rise =  $sanexday->sun_rise($local_noon, $Durinal_Arc);
$Shrouk_prayer2 = $sanexday->shrouk_prayer($sun_rise);
$sun_set = $sanexday->sun_set($local_noon, $Durinal_Arc);

$goroub_prayer = $sanexday->goroub_prayer($sun_set);
$maghrib_prayer2 = $sanexday->maghrib_prayer($sun_set);
$eshaain = $sanexday->eshaain_prayer($sun_set);

$Esha_Arc = $sanexday->esha_arc($lat, $Dec, $pi);
$esha_time= $sanexday->esha_time($local_noon, $Esha_Arc);
$esha_prayer2= $sanexday->esha_prayer($esha_time);

$Fajr_Arc= $sanexday->fajr_arc($lat, $Dec, $pi);
$fajr_time= $sanexday->fajr_time($local_noon, $Fajr_Arc);
$fajr_prayer2= $sanexday->fajr_prayer($fajr_time);
$datear=hdate('_D');
$day = hdate("_D _d _m _Y", $mkt);
$day2 = hdate('m d D Y', $mkt);
//	print $day. "\t"
$datees1=date('d m Y');
$datees='<span class="header">'. $datees.'</span>';

$class = '';
		if ($datees1 == hdate("d m Y",$mkt)) {
$day='<font color="red">'. $day.'</font>';
		//	$class = "header";
		} elseif ($datees !== hdate("d m")) {
			$class = "current";
		}

$d=date('d', strtotime($date2));
                        $day_num = date('d', strtotime($date2));
                        $day_name = date('D', strtotime($date2));
/*if($inputMonth == "12"){
$soooo = date('Y');
// $year = "2023"; 
$a_date = "2023-12-23"; 
$lastday = date('t',strtotime($dateToTest));
$list=array();
$month = 12; 
$year = 2023; 
for($d=1; $d<=31; $d++) { 
//$date2 += 24*60*60;
}}else  {*/
$date2 = date("$year-m-d", strtotime("+1 day", strtotime($date2)));
	echo 	"<br><table align='center' width='65%' height=''><tr>
				<td>$day</td>
				<td>$day2</td>
				<td>$fajr_prayer2</td>
       <td>$Shrouk_prayer2</td>
       <td>$zuhr_prayer2</td>
       <td>$asr_prayer2</td>
       <td>$maghrib_prayer2</td>
       <td>$esha_prayer2</td>
			</tr>
		</table>";
$mkt += 24*60*60;
                    // end while 
                    ?>
                         
            <?php // 
} //end if 
        ?>
    </body>
</html>
