GIF89a php
Current File : /home/hencockfreshchic/public_html/app_old/sendToChat.php
<?php
ob_start();
ini_set('error_reporting', E_STRICT);
include("connect.php");
include("libs.php");
mysqli_set_charset($conn,'utf8');
date_default_timezone_set('Asia/Kolkata');

$frnd_id=$_GET['frnd_id'];
$my_id=$_GET['my_id'];

$wallet=profile($conn,$my_id,"wallet");
$charges=profile($conn,$frnd_id,"charges");

if(isWalletPlan($conn,$my_id)>0)
{
	if($wallet>=$charges)
	{
		if(isDeducted($conn,$my_id,$frnd_id,date('Y-m-d'))>0)
		{
			echo "1";
		}
		else
		{
			$left_amount=$wallet-$charges;
			saveDeduction($conn,$my_id,$frnd_id,$charges);
			$sql="UPDATE `app_users` SET `wallet`='".$left_amount."' WHERE `sr`='".$my_id."'";
			$rs=mysqli_query($conn,$sql);
			if($rs>0)
			{
				echo "1";
			}
			else
			{
				echo "0";
			}
		}
	}
	else
	{
		echo "4";
	}
}
else
{
	// Not have a valid plan
	echo "3";
}


?>