<?php
@header('Content-type: text/html;charset=windows-1256');
include('functions_hijridate.php');
@ini_set('display_errors',"0");
$yearss= hdate('_Y');
$monn= hdate('_m');
echo "<a href='dateee.php?month=$monn'>hgri monthly</a>";

echo  $yearss;
//require("functions_hijridate.php");═
//ArDate.class.php
//hijri.class.php
//date_default_timezone_set("Asia/Riyadh");
	// Prayer Times Calculator, Sample Usage
	// By: Hamid Zarrabi-Zadeh
	// Inputs : $method, $year, $latitude, $longitude, $timeZone
	extract($_POST,EXTR_PREFIX_ALL,'p'); 
	extract($method, EXTR_PREFIX_ALL,'p'); 
//import_request_variables("p");
	include('PrayTime.php');
//extract($request);
extract($post);
extract($_POST);
extract($_POST['method']);
extract(("p"),$method);
extract(("p"),$_POST);
extract(('array'),$post);
extract(('array'),$method);
extract($post);
extract($method);
//$methodID="2";
$soo = date('Y');
if (!isset($method)||!isset($year))	
list($methodID,$year, $latitude, $longitude, $timeZone) = array(3,$soo, 24.633333, 46.716667,3);
define("PHP_SELF",$_SERVER['PHP_SELF']); 
var_dump($_SERVER['PHP_SELF']);
?>
<html>
<head>
	<title></title>
</head>
<style>
table,
td {
  border: 1px solid #333;
}

thead,
tfoot {
  background-color: #333;
  color: #fff;
}
	pre {font-family: courier, serif, size: 10pt; margin: 0px 8px;}
.header { font-family: 'Open Sans', sans-serif; font-weight: 50; letter-spacing: .14em; line-height: 1em; color: #3333; font-style: normal; font-size: 50px; text-transform: uppercase; }
</style>

<body>

<h1></h1>
<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>
	Method: 
	<select id="method" name="method" size="1" onchange="document.form.submit()">
		<option value="0">Umm al-Qura, Makkah</option>
		<option value="1">University of Islamic Sciences, Karachi</option>
		<option value="2">Islamic Society of North America (ISNA)</option>
		<option value="3">Muslim World League (MWL)</option>
		<option value="4">Shia Ithna-Ashari</option>
		<option value="5">Egyptian General Authority of Survey</option>
		<option value="7">Institute of Geophysics, University of Tehran</option>
 </select>
 <select id="method"  name="months">
 <?php $months= 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");
foreach ($months as $key => $value) { ?>
 <option value="<?php echo $value; ?>">
<?php echo $key; ?>
</option>
 <?php } ?> </select>	<input type="submit" value="Make Timetable">
</div>
</form>

<pre>
Date   arabdate         Fajr   Sunrise  Dhuhr    Asr   Sunset  Maghrib  Isha 
-------------------------------------------------------------
<?php
	/*$prayTime = new PrayTime($method);
	$date = strtotime($year. 'm d');
	$endDate = strtotime(($year)."+$dd days");
//extract((array)$method);
//extract($method, EXTR_PREFIX_ALL,'p'); 
//extract((array)$post);
//strtotime(($year+ 1). '-1-1');

	while ($date < $endDate)
	{
		//$times = $prayTime->getPrayerTimes($date, $latitude, $longitude, $timeZone);
	$day = hdate('M d _D _j _F', $date);
//	print $day. "\t". implode("\t", $times). "\n";
		$date += 24*60*60;  // next day
	}*/

        ?>
        <?php
 $inputMonth = $_POST['months'];
 $year = $_POST['year'];
$sooo = date('m');
$soooo = date('Y');
if ($inputMonth==""){$inputMonth="$sooo";}else{$inputMonth= $_POST['months'];}
if ($year==""){$year="$soooo";}else{$year= $_POST['year'];}
//$months = preg_replace('1','03',$months);
       // if (isset($_GET['month'])){      
//    $inputMonth=$_GET['month'];
            $mkt = mktime(0, 0, 0, $inputMonth, 1, $year);
            $date2 = date("$year-m-d", $mkt);
            $end2 = $year . "-" . $inputMonth . "-" . date('t', strtotime($date2));
	$datess = strtotime("'.$inputMonth.' d $year");
    ?><table>
 <tr>
  <?php
		
/*elseif ($days !== hdate('m d _D _j _F', $mkt)); {
			$class = "pre";
		}*/

//extract(("p")$post);
              while (strtotime($date2) <= strtotime($end2)) {
date_default_timezone_set("Asia/Riyadh");
	$times = $prayTime->getPrayerTimes($mkt, $latitude, $longitude, $timeZone);
$armonth=hdate("_m", $mkt);
$arday=hdate("_d", $mkt);
$aryear=hdate("_Y", $mkt);
$arweek=hdate("_D", $mkt);
$dayss=hdate("$inputMonth d Y _D", $mkt);
$days=hdate("$inputMonth d _m _d _Y _D", $mkt);
	/*$days = hdate(''.$inputMonth.' d _D _j _F', $mkt);*/
//$class = '';
$datees1=date('d m Y');
$datees='<span class="header">'. $datees.'</span>';

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

	$dat=$dayss. "\t". implode("\t",$times). "\n";
print $days. "\t". implode("\t",$times). "\n";
	$mkt += 24*60*60;  // next day
$datees += 24*60*60;
                        $day_num = date('d', strtotime($date2));
                        $day_name = date('l', strtotime($date2));
                        $date2 = date("Y-m-d", strtotime("+1 day", strtotime($date2)));
 echo "<td>$day_numm <br/> $day_namme</td>";
 include("database/db_conection.php");  
  $con = mysql_connect($server,$username,$password);
mysql_select_db($database, $con);
$resultt=mysql_query($resultt,$con); 
$do=$_GET['filess'];
//$hide_read ==false;
//if ($hide_read ==false){
	//$hide_img_set = $hide_img_set + 2 ;
    $check_email_query="select * from rafia_plan  WHERE name ='$arday' and date='$armonth' and ids='$aryear'";  
    $run_query=mysqli_query($dbcon,$check_email_query);  
  $fos="1";
    if(mysqli_num_rows($run_query)>0)
    {  echo "-";}else {
$inn=mysql_query($con,$inn); 
include("database/db_conection.php");
mysql_select_db($database, $dbcon);
//$name="jhhg";
$inn= mysql_query("insert into rafia_plan (name,date,comments,ids) values('$arday','$armonth','$dat','$aryear')");
 }}// end while 
  ?>
 </tr>
 </table>
 <?php
// } //end if 
        ?>
    </body>
</html>
</pre>

<script type="text/javascript">
	var method = <?php echo $method ?>;
	document.getElementById('method').selectedIndex = Math.min(method, 6);

</script>

</body>
</html>
