<?php ob_start();
 session_start();
include($_SERVER['DOCUMENT_ROOT'].'/includes/connection.php');
//mysql_query("delete from moon_calendar");
  
   ?>
  <!-- <style type="text/css">
.txt2{  font-size:1.2em; color:#000000; font-weight:bold; text-align:left;}
  .brd2{ font-size:15px; color:#766e6e; font-weight:bold;  text-transform:capitalize; vertical-align:middle;line-height:25px;}
.Title2{ color:#e7ddab;  letter-spacing:1px; font-size:20px; font-weight:bold;	width:100%; max-width:100%; height:100%;text-align:center; }

 .rTable2 {   	display: table;table-layout: fixed;    	width:100%; max-width:100%; height:100%;text-align:center; border: 1px solid #766e6e; } .rTableRow2 {   	display: table-row; overflow: hidden;
  clear: both;   }  .rTableHead2 {  text-align:center;   	display: table-cell;border: 1px solid #766e6e;     	 vertical-align:middle; padding-top:5px; padding-bottom:5px; }
   .rTableCell2 {  text-align:left;padding-left:3px; display: table-cell; color:#000000; font-weight:bold;   text-transform:capitalize;     	border: 1px solid #766e6e; vertical-align:middle; padding-top:3px; padding-bottom:3px;}  </style>-->
<?php
  
$year=$_REQUEST['year'];
$month=$_REQUEST['month'];
$monthname=strtoupper(date("F",strtotime($year."-".$month."-01")));

 $calendar= '<p style="text-align:center; font-size:x-large; color:#ffffff;"><b>ASPECTS CALENDAR - '.$monthname.'&nbsp;'.$year.'</b></p><div class="rTable2">';

	/* table headings */
	$headings = array('SUN','MON','TUE','WED','THU','FRI','SAT');
	$calendar.= '<div class="rTableRow2" style="text-align:center; " ><div class="rTableCell2" style="text-align:center; color:#ebe1b2;"><strong>'.implode('</strong></div><div class="rTableCell2" style="text-align:center; color:#ebe1b2;"><strong>',$headings).'</strong></div></div>';
 
    $running_day = date('w',mktime(0,0,0,$month,1,$year));
	$days_in_month = date('t',mktime(0,0,0,$month,1,$year));
	$days_in_this_week = 1;
	$day_counter = 0;
	$dates_array = array();

	/* row for week one */
	$calendar.= '<div class="rTableRow2"> ';

	/* print "blank" days until the first of the current week */
	for($x = 0; $x < $running_day; $x++):
		$calendar.= '<div class="rTableCell2" style="text-align:center; vertical-align:top; background-color:#84500d;">&nbsp;</div>';
		$days_in_this_week++;
	endfor;
		
		for($list_day = 1; $list_day <= $days_in_month; $list_day++):
	
	 $cal_date=$month."/".$list_day."/".$year;
	  $date=date('Y-m-d',strtotime($cal_date));
		 
		 $catquery=mysql_query("select * from aspects_calendar where  aspectsdate like '%".$date."%'   order by sno asc");
  $linktxt="";
 	while($noticia = mysql_fetch_array($catquery))
 	{ 
    
  $conjunction="";
$opposition="";
$trine="";
$square="";
$sextile="";
$mercury="";
$sun="";
$moon="";
 $venus="";
 $mars="";
 $jupiter="";
 $saturn="";
 $uranus="";
 $neptune="";
 $pluto="";
 $rmks1="";
 if ($noticia['conjunction']==true)
{

$conjunction ="<img src='https://www.findyourfate.com/astrology/year2017/images/cnj.png' alt='Conjunction' title='Conjunction' width='20' height='20' >";
}
 if ($noticia['opposition']==true)
{

$opposition ="<img src='https://www.findyourfate.com/astrology/year2017/images/ops.png'  alt='Opposition' title='Opposition' width='20' height='20' >";
  }

if ($noticia['trine']==true)
{

$trine = "<img src='https://www.findyourfate.com/astrology/year2017/images/trn.png'  alt='Trine' title='Trine' width='20' height='20' >"; 
  }

if ($noticia['square']==true)
{

$square ="<img src='https://www.findyourfate.com/astrology/year2017/images/sqr.png' alt='Square' title='Square' width='20' height='20' >";
  }

if ($noticia['sextile']==true)
{

$sextile ="<img src='https://www.findyourfate.com/astrology/year2017/images/stle.png'  alt='Sextile' title='Sextile' width='20' height='20' > ";
  }
 
 
if ($noticia['sun']==true)
{

$sun ="<img src='https://www.findyourfate.com/astrology/year2017/images/sun.png' alt='Sun' title='Sun' width='20' height='20' >";
  
 }
if ($noticia['moon']==true)
{

$moon  ="<img src='https://www.findyourfate.com/astrology/year2017/images/moon.png'  alt='Moon' title='Moon' width='20' height='20' >";
 
 }
if ($noticia['mercury']==true)
{

$mercury ="<img src='https://www.findyourfate.com/astrology/year2017/images/mer.png'  alt='Mercury' title='Mercury' width='20' height='20' >";
  
 }
 if ($noticia['venus']==true)
{

$venus="<img src='https://www.findyourfate.com/astrology/year2017/images/ven.png'  alt='Venus' title='Venus' width='20' height='20' >";
  
 }
if ($noticia['mars']==true)
{

$mars = "<img src='https://www.findyourfate.com/astrology/year2017/images/mars.png'  alt='Mars' title='Mars' width='20' height='20' >";
  
 }
 if ($noticia['jupiter']==true)
{

$jupiter="<img src='https://www.findyourfate.com/astrology/year2017/images/jup.png'  alt='Jupiter' title='Jupiter' width='20' height='20' >";
  
 }

if ($noticia['saturn']==true)
{

$saturn ="<img src='https://www.findyourfate.com/astrology/year2017/images/sat.png'  alt='Saturn' title='Saturn' width='20' height='20' >";
 
 }
if ($noticia['uranus']==true)
{

$uranus ="<img src='https://www.findyourfate.com/astrology/year2017/images/ura.png'  alt='Uranus' title='Uranus' width='20' height='20' >";
 
 }
if ($noticia['neptune']==true)
{

$neptune ="<img src='https://www.findyourfate.com/astrology/year2017/images/nep.png'  alt='Neptune' title='Neptune' width='20' height='20' >";
  
 }
if ($noticia['pluto']==true)
{

$pluto ="<img src='https://www.findyourfate.com/astrology/year2017/images/pluto.png'  alt='Pluto' title='Pluto' width='20' height='20' >";
  
 }
 if ($noticia['rmks1']=="Sun")
{

$rmks1 ="<img src='https://www.findyourfate.com/astrology/year2017/images/sun.png' alt='Sun' title='Sun' width='20' height='20' >";
  
 }
if ($noticia['rmks1']=="Moon")
{

$rmks1  ="<img src='https://www.findyourfate.com/astrology/year2017/images/moon.png'  alt='Moon' title='Moon' width='20' height='20' >";
 
 }
 
if ($noticia['rmks1']=="Mercury")
{
 $rmks1 ="<img src='https://www.findyourfate.com/astrology/year2017/images/mer.png'  alt='Mercury' title='Mercury' width='20' height='20' >";
  
 }
if ($noticia['rmks1']=="Venus")
{
$rmks1="<img src='https://www.findyourfate.com/astrology/year2017/images/ven.png'  alt='Venus' title='Venus' width='20' height='20' >";
  
 }
if ($noticia['rmks1']=="Mars")
{
$rmks1 = "<img src='https://www.findyourfate.com/astrology/year2017/images/mars.png'  alt='Mars' title='Mars' width='20' height='20' >";
  
 }
if ($noticia['rmks1']=="Jupiter")
{
$rmks1="<img src='https://www.findyourfate.com/astrology/year2017/images/jup.png'  alt='Jupiter' title='Jupiter' width='20' height='20' >";
  
 }

if ($noticia['rmks1']=="Saturn")
{
$rmks1 ="<img src='https://www.findyourfate.com/astrology/year2017/images/sat.png'  alt='Saturn' title='Saturn' width='20' height='20' >";
 
 }
if ($noticia['rmks1']=="Uranus")
{
$rmks1 ="<img src='https://www.findyourfate.com/astrology/year2017/images/ura.png'  alt='Uranus' title='Uranus' width='20' height='20' >";
 
 }
if ($noticia['rmks1']=="Neptune")
{
  $rmks1 ="<img src='https://www.findyourfate.com/astrology/year2017/images/nep.png'  alt='Neptune' title='Neptune' width='20' height='20' >";
  
 }
if ($noticia['rmks1']=="Pluto")
{
  $rmks1 ="<img src='https://www.findyourfate.com/astrology/year2017/images/pluto.png'  alt='Pluto' title='Pluto' width='20' height='20' >";
  
 }
 
 if(   ($year==2016) || ($year==2017) || ($year==2018) || ($year==2019) || ($year==2020))
 {
		 if ( ($noticia['moon']==true) && ($noticia['sun']==true))
		{
			$linktxt.=$moon.$rmks1.$conjunction.$opposition.$trine.$square.$sextile.$sun.$mercury.$venus.$mars.$jupiter.$saturn.$uranus.$neptune.$pluto."<br>";
		}
		else  
		{
			$linktxt.=$moon.$sun.$rmks1.$conjunction.$opposition.$trine.$square.$sextile.$mercury.$venus.$mars.$jupiter.$saturn.$uranus.$neptune.$pluto."<br>";
		}
 }
 
else
{
	$linktxt.=$rmks1.$conjunction.$opposition.$trine.$square.$sextile.$moon.$sun.$mercury.$venus.$mars.$jupiter.$saturn.$uranus.$neptune.$pluto."<br>";
}
 	               
 }
		$calendar.= '<div class="rTableCell2" style="text-align:center; vertical-align:top; background-color:#84500d;">';
			/* add in the day number */
			$calendar.= $list_day."<div><br>".$linktxt."</div>";

			/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !!  IF MATCHES FOUND, PRINT THEM !! **/
			 $calendar.= str_repeat('<p> </p>',1);
			
		$calendar.= '</div>';
		if($running_day == 6):
			$calendar.= '</div>';
			if(($day_counter+1) != $days_in_month):
				$calendar.= '<div class="rTableRow2">';
			endif;
			$running_day = -1;
			$days_in_this_week = 0;
		endif;
		$days_in_this_week++; $running_day++; $day_counter++;
	endfor;

	/* finish the rest of the days in the week */
	if($days_in_this_week < 8):
		for($x = 1; $x <= (8 - $days_in_this_week); $x++):
			$calendar.= '<div class="rTableCell2" style="text-align:center; vertical-align:top; background-color:#84500d;"> </div>';
		endfor;
	endif;

	/* final row */
	$calendar.= '</div>';

	/* end the table */
	$calendar.= '</div><br>';
	
	/* all done, return result */
	echo  $calendar;
 
mysql_close($link);
?>			