<?php

	$date = $_GET['date'];
	if ($date==1) {
	$start = mysql_real_escape_string($_GET['date1']);
    $end = mysql_real_escape_string($_GET['date2']);
	}
	else {
	$m = date("m");	
	$start = date("Y-m-01");
	$end = date("Y-m-31");
	if ($m=='02') {
		  $end = date("Y-m-28");
		  
	}
	if ( ($m=='04') OR ($m=='06')  OR ($m=='09')  OR ($m=='11') ) {
		  $end = date("Y-m-30");
		  
	}
	}
		
	if ($date!=1) {
	   $ds = "1"; }
	   else {
		$ds = date("d", strtotime($start) );
	   }
	$ms = date("m", strtotime($start) );
	$ys = date("Y", strtotime($start) );
	
	
	$de = date("d", strtotime($end) );
	$me = date("m", strtotime($end) );
	$ye = date("Y", strtotime($end) );
	
		
	if ($date==3) {
	
	$start = $_GET['start_date'];
	$end = $_GET['end_date'];
		
	$ds = date("d", strtotime($start) );
	$ms = date("m", strtotime($start) );
	$ys = date("Y", strtotime($start) );
	
	
	$de = date("d", strtotime($end) );
	$me = date("m", strtotime($end) );
	$ye = date("Y", strtotime($end) );
	}
	?>
	