Created
August 20, 2018 12:53
-
-
Save AsciencioAlex/71493f69ead5df444da2d016d259e502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Africa/Nairobi'); | |
// set up db connection | |
include("connection.php") | |
$TenantTransactionId = $_GET["TransactionType"]; | |
$SESSIONID = $_GET["SESSIONID"]; | |
$SERVICECODE = $_GET["SERVICECODE"]; | |
$ApplicationID = $_GET["ApplicationID"]; | |
$USSD_string = $_GET["USSD_string"]; | |
//$sql="INSERT INTO 'ams_mb' ('TenantTransactionId', 'TransactionType', '', 'ApplicationID', 'USSD_string') " VALUES (".$TransactionId.", '".$TransactionType."','".$USSD_string"','".$ApplicationId."')"; | |
switch($RequestType){ | |
case 1: | |
$message "Welcome to GateWay Property\n"; | |
$sql = "SELECT * FROM ams_mb where status=1"; | |
$qer = mysql_query($sql); | |
while($tab = mysqli_fetch_array($qer)){ | |
$message. = $tab['tenant_id']. ".$tab['name']."\n; | |
} | |
echo "&TenantTransactionId=".$TenantTransactionId."&TransactionType=2&SESSIONID=". | |
$SESSIONID."&ApplicationId=".$ApplicationId."USSD_string=".$message."TypeofMessage=0"; | |
break; | |
case 2: | |
// check balance | |
$balance = check_balance($SESSIONID); | |
// Check if amount is sufficient | |
$sql="select count(*) as isa from tenant where tenant_id=".$details[2] "and status=1", | |
$qer = mysql_query($sql); | |
$tab = mysqli_fetch_array($qer); | |
if($tab['isa']==0){ | |
$message=$details[2]."is not the list"; | |
} | |
else{ | |
if($balance>0){ | |
// remove the balance from the system | |
change_balance($SESSIONID, -1); | |
// update our db since the message is sent. | |
$sql="update tenant set point +1 where tenant_id=".$details[2]; | |
mysql_query($sql); | |
// send SMS to the tenant | |
$message = "You have completed payment of your rent".$details[2]."Thank you"; | |
$sms="Thank%you%for%paying%your%rent%has%been%submitted"; | |
rowbin_mail('GateWay Property', $SESSIONID, $sms); | |
else{ | |
$message="You do not have enough amount to complete your request"; | |
} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment