( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/..//tmpr/../gold/gold.php
<?php
include('../Connections/videoondemand.php'); 
require_once("includes/inc_files.php");







 function dueDate($billingcycle)
{
    switch($billingcycle)
    {
        case "Monthly":         $months = 1; break;
        case "Quarterly":       $months = 3; break;
        case "Semi-Annually":   $months = 6; break;
        case "Annually":        $months = 12; break;
   
        default:                $months = 1; break;
    }


    $today = date('Y-m-d H:i:s');
    $next_due_date = strtotime($today.' + '.$months.' Months');
  
   return date('Y-m-d H:i:s', $next_due_date);

}



$DBHost = "localhost";
$DBName = "ezikitv";
$DBUser = "root";
$DBPassword = "";
$videoondemand = mysql_pconnect($DBHost, $DBUser, $DBPassword);
mysql_select_db($DBName, $videoondemand) or die("Opps some thing went wrong");
$link = $videoondemand;




 
$number = $_GET['s'];
$message = $_GET['m'];

/*if ($number != "MPESA"){
exit("ONA:That is an invalid Message");	

}*/

$rand = rand(12121212,8868686888);

 $message = "$rand Confirmed.
You have received Ksh80000 from
SANTOS OKOTTAH 0722407655
on 4/10/10 at 10:29 PM
New M-PESA balance is Ksh50000"; 

$tid = explode(" ", $message);
$tid = $tid[0];

$pattern = '/(\d{3}([\-\.\*\s_]?\d{3})([\-\.\*\s_]?\d{6}))|\d(([\.\*]\d){9})|(\(\d{3}\)\s\d{3}\-\d{4})|(\d{3}\s\d{3}\s\d{2}\s\d{2})|(\d{3}\s\d{4}\sx\d{3})/';
 
preg_match($pattern, $message, $match);
/*print_r($match); */
$usernumber = $match[1];
$message  =strtolower($message);

$money = strstr($message, 'ksh');
 //echo $money;

// get all the numbers in the sms
/*preg_match_all('!\d+!',  $money, $matches);
print_r($matches);
*/
//get the first number depicting amount depositred

preg_match("/^(\w+)/",$money,$matches);
 //remove word ksh
$money = preg_replace("/ksh/","",$matches[1]);
 /*
function magicWords($words, $string) {
  $from = $to = array();
  foreach($words as $word) {
    $from[] = "/\b$word\b/i"; // \b represents a word boundary
    $to[] = '<a href="#' . strtolower($word) . '">${0}</a>';
  }

  return preg_replace($from, $to, $string);

}*/

/*$words = array('go', 'walk');

echo magicWords($words, "Lets go walking on a Walk");


$string = 'here are a few words!';

if(preg_match("/(here|few|a)/i", $string)){
  echo 'We found a match!';
}*/


  $sql = "SELECT `catalogid`,`catalogname`,`plan` FROM users WHERE  tel='0722407655'"; 
 $result = mysql_query($sql) or die (mysql_error()); 
 list($catalogid,$catalogname,$plan) = mysql_fetch_row($result);


$user = User::find_by_id($catalogid);


 
$rs3 = mysql_query("select count(*) as counter from gold_transaction where catalogid=$catalogid and message=\"$message\"");
//check if similar message had been sent ealrir
while($row4 = mysql_fetch_assoc($rs3))
{	 $counter = $row4["counter"];

					  if($counter < 1)
										  {
								 						  
										
 //first timer
 	$checknumberinacc = mysql_query("select count(*) as counter from users where catalogid=$catalogid");													while($check = mysql_fetch_assoc($checknumberinacc))
{	 $countercheck = $check["counter"];

					  if($countercheck < 1)
										  {
											   $adddate = date("Y-m-d");
											  mysql_query("insert into users (tel,tokens,date,admin) VALUES ('$usernumber','$money','$adddate','999')"); 
											  
											  $firstTime = "yes";
									
										  }
										 
										  
}
	
 
  //end first timer
 	  
											  
											  
											  
											  									  
											  
											  
											  
											  
											  
										 $leo = date('Y-m-d H:i:s'); 
										 mysql_query("insert into gold_transaction (catalogid,tokens,package_name,message,transactionid,status,datetime) VALUES ('$catalogid','$money','MPESA DEPOSIT','$message','$tid','c','$leo')"); 			
															
															
															  $resultTotalThen = mysql_query("select * from users where catalogid=$catalogid;");
						while($totalthen = mysql_fetch_assoc($resultTotalThen))
						                                       
															    {	
												if($firstTime == "yes")
												{				
							$newamount =  $money ;}
							else
							{ 
							
		 					  $newamount = $totalthen["tokens"] + $money ;
							}
							                                  
												 mysql_query("UPDATE users set tokens=$newamount where catalogid=$catalogid");
												 
												 	
													
											echo "GOLD ACCESS: Congratulations, you successfully credited Ksh$money to your Gold Access Account. Your subscription will be renewed  automatically as per your $plan plan shortly . Account Balance: Ksh$newamount.  Enjoy your viewing. Call 0722407698 for any billing queries. http://thebrandingapp.com/videos/v/billing"; 			
													
													
					
			 
	
	
	if ($plan=="Monthly") {
	 
		User::buy_package_sms($catalogid, $newamount, '100', 'GOLD100', '1 Month GOLD Access', $user->level_expiry, $user->expiry_datetime, 'subscribe.php?catalogid='.$catalogid);
	}
 
 
	if ($plan=="Quartely") {
	 
		User::buy_package_sms($catalogid, $user->tokens, '300', 'GOLD300', '3 Months GOLD Access', $user->level_expiry, $user->expiry_datetime, 'subscribe.php?catalogid='.$catalogid);
	}
 
 			
					
		if ($plan=="Semi-Annually") {
	 
		User::buy_package_sms($catalogid, $user->tokens, '600', 'GOLD600', '6 Months GOLD Access', $user->level_expiry, $user->expiry_datetime, 'subscribe.php?catalogid='.$catalogid);
	}
 			
				
	
	
	
	
 			
					
					
					
													
													
													
														  
															    }
											
											
											
											
											
											
											
											/*echo "Successfully Received your payment";*/
											
											}	
										  else
										  {
									
										   exit();
										  
										  }

}

 
?>