<?php
include("include/dbconnect.php");
extract($_POST);
$msg="";
	     $heart = $_REQUEST['heart'];
    	$temp = $_REQUEST['temp'];
	   $pressure = $_REQUEST['pressure'];
     
		
    	
    	
echo $heart;
echo $temp;
echo $pressure;


////////////////////////////////////////////
if(!empty($_REQUEST['heart']) && !empty($_REQUEST['temp'])&& !empty($_REQUEST['pressure']))
{
    
   if($_REQUEST['heart']<50.00)
{
    	$mobile=9698252836;
	$mes='*Heart Beat Decreased: ';
	$message=$mes.$heart;
echo '<h3 style="color:#990033" align="center">'.$message.'</h3>';

echo '<iframe src="http://pay4sms.in/sendsms/?token= b81edee36bcef4ddbaa6ef535f8db03e&credit=2&sender= RandDC&message='.$message.'&number=91'.$mobile.'" style="display:block"></iframe>';
}
if($_REQUEST['heart']>=90 )
{
    	$mobile=9698252836;
	$mes='*Ambulance Alert: ';
	$message=$mes.$heart;
echo '<h3 style="color:#990033" align="center">'.$message.'</h3>';

echo '<iframe src="http://pay4sms.in/sendsms/?token= b81edee36bcef4ddbaa6ef535f8db03e&credit=2&sender= RandDC&message='.$message.'&number=91'.$mobile.'" style="display:block"></iframe>';
}

	$max_qry = mysql_query("select max(Id) maxid from healthtbl");
	$max_row = mysql_fetch_array($max_qry);
	$id=$max_row['maxid']+1;
	//$rdate = new DateTime();
   // $rdate->format('Y-m-d H:i');
	$rdate=date("Y-m-d H:i");
		$uqry="insert into healthtbl(Id,heart,temp,pressure,rdate) values($id,'$heart','$temp','$pressure','$rdate')";
		$res=mysql_query($uqry);
		
		if($res)
		{
		//header("location:register2.php");
		//$_SESSION['username'] = $uname;
		
		$msg="Success";
		
		}
		else
		{
		$msg="Could not be stored!";
		}
		
	
}
?>
<html>
<head>
<title><?php include("include/title.php"); ?></title>
</head>

<body>

</body>
</html>
