MMCT TEAM
Server IP : 2a02:4780:3:1493:0:3736:a38e:7  /  Your IP : 216.73.216.139
Web Server : LiteSpeed
System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/smsoft.in/public_html/demo/src/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/smsoft.in/public_html/demo/src/../onlinelink.php
<?php 

    // First we execute our common code to connection to the database and start the session 
    require("common.php"); 
     
    // At the top of the page we check to see whether the user is logged in or not 
    if(empty($_SESSION['user'])) 
    { 
        // If they are not, we redirect them to the login page. 
        //header("Location: login.php"); 
         
        // Remember that this die statement is absolutely critical.  Without it, 
        // people can view your members-only content without logging in. 
       // die("Redirecting to login.php"); 
    } 
     
    // Everything below this point in the file is secured by the login system 
     
    // We can display the user's username to them by reading it from the session array.  Remember that because 
    // a username is user submitted content we must use htmlentities on it before displaying it to the user. 
?> 



<?php

// echo $_SESSION['user'];

   $tid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);

$tttt="";
$tcms="";

          //include "config/config.php";
include "config/config.php";
if (isset($_SESSION['key']))
  if ($_SESSION['key'] != NULL){
      $sid=$_SESSION['key'];                  
  }
include_once 'sms.php';
$today= date("Y-m-d");
//$reci=$_POST["optionsRadios"];
$hdr=array();
$h=array();

//main vrb
$headid=array();
$headamt=array();
$cmsn=array();
$ind=0;




	
$subAr=array();
$gt=0;

$totaa=0;



 if (isset($_SESSION['subAr']))
  if ($_SESSION['subAr'] != NULL)
  {
      $subAr=$_SESSION['subAr']; 	
      

  }
if (isset($_SESSION['headAr']))
  if ($_SESSION['headAr'] != NULL){
      $headAr=$_SESSION["headAr"]; 

  }

$stud_res=mysqli_query($con,"select * from `stud_basic` where `Stud_Id` = '$sid'");
$sres=mysqli_fetch_array($stud_res);

$Name=$sres['Name'];
$mobile=$sres['Phone'];
$email=$sres['Email'];

   
$paymentmode="Online";
//echo $paymentmode."<br>";
//$Fine=$_POST["Fine"]; 
//$total=$_POST['total'];

 //$Grand_Total=$_POST["Grand_Total"];
//echo "G=$Grand_Total";
//echo "<br>";


$dn="";
if($paymentmode == "Online")
{

$flag=5;	
}

foreach ($subAr as $id) 
{
	//echo "subhead=$id<br>";
$sub_res1=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$id' and `Stud_Id` = '$sid'");
 $sub1=mysqli_fetch_array($sub_res1);
array_push($hdr, $sub1['Head_Id']);
}


 foreach ($subAr as $key => $value) 
 {
        $h[$hdr[$key]][] = $value;
 }


    
    foreach ($headAr as $headId) 
    {
    	//echo "head=$headId<br>"; //
    		$subheadid="";
    		$c_due=0;
    		 $totaa=0;
    	for ($i=0; $i < count($h[$headId]); $i++)
    	{ 
		
    		
$id1=$h[$headId][$i]; //sub head
$sub_res=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$id1' and `Stud_Id` = '$sid'");
 		$sub=mysqli_fetch_array($sub_res);
 		 
 		//echo "<br>Head = $sub[Head_Id]<br>";   //Head Id
		//echo "Subhead $sub[Subhead_Id]<br>"; //Subhead ID 
		//echo "TT=$sub[Total_Amount]<br>"; //Total Amount 
		//echo "PA=$sub[Paid]<br>"; //Paid Amount
		//echo "Bal=$sub[Balance]<br>"; //Balance   
		//$tttt=$tttt+$sub['Total_Amount'];
  
if($flag==1) 
		{

		//if(!mysqli_query($con,"UPDATE `stud_basic2` SET `Paid` = '$sub[Balance]', `Balance` = '0' WHERE `Subhead_Id` = '$id1' and 
		//`Stud_Id`='$sid'"))
						{
	    			  echo("Error description: " . mysqli_error($con));
						}
		}

			$subheadid=$subheadid."/".$sub['Subhead_Id'];
        $subb_res=mysqli_query($con,"select * from `sub_head` where Sub_Id = '$sub[Subhead_Id]'");
        $subb=mysqli_fetch_array($subb_res);
        $totaa=$totaa+$subb['Amount'];
			//echo "<br>$subheadid";
			
    	} // subheadloop
    		$rep_code_res=mysqli_query($con,"select * from `head` where Head_Id = '$headId'");
    		$rep_code=mysqli_fetch_array($rep_code_res);
    		if(!$rep_code_res1=mysqli_query($con,"select MAX(`ReciptCounter`) from `paid_fees` where `Head_Id` = '$headId'"))
    		{
    			  echo("Error description: " . mysqli_error($con));

    		}    		
    		$rep_code1=mysqli_fetch_array($rep_code_res1);
    		$cnt=$rep_code1['0']+1;
    		$ReciptCounter="$rep_code[ReciptName]"."-"."$cnt";
			//echo "<br>$ReciptCounter<br>";
     $due_res=mysqli_query($con,"SELECT * FROM `head` where `Head_Id` = '$headId'");
  $due=mysqli_fetch_array($due_res);
  if($due['Last_Date'] < $today)
  {
    $date1=date_create("$due[Last_Date]");
    $date2=date_create("$today");
    $diff=date_diff($date1,$date2);
    $difff= $diff->format("%a");
    $c_due=$due['Fine_Amount']*$difff;
	//echo "HID1=$sub[Head_Id]<br>";
	//echo "IND=$ind";
	
	
    //echo "due=$c_due<br>";
    
  }
  $headid[$ind]=$sub['Head_Id'];
  //echo "totaa= $totaa";
  $g_t=$totaa+$c_due;
  $tttt=$tttt+$g_t;
  $cms_res=mysqli_query($con,"SELECT * FROM  `commission`");
  $cmss=mysqli_fetch_array($cms_res);
  //echo $cmss['0'];
  $cms_amount=$cmss['Commission'];
  $cms=($g_t*$cms_amount)/100;
  $cms=round($cms);
  //echo "commission=$cms<br>";
  $tcms=$tcms+$cms;
  $headamt[$ind]=$g_t;
  $cmsn[$ind]=$cms;
  //echo "due+ Total=$g_t<br><br><br>";
  $ind++;
  $g_t=$g_t+$cms;
  
$ck_res= mysqli_query($con,"select * from onlinetemp where Subhead_Ids = '$subheadid' and Stud_Id = '$sid'");
   $ro=mysqli_num_rows($ck_res);
   if($ro==0)
   {
 
  
  
  if(mysqli_query($con,"INSERT INTO `onlinetemp` 
			(`TID`,`Stud_Id`, `Head_Id`, `Subhead_Ids`, `Paid_date`, `Mode`,`DateNumber`, `Fine_Amount`, `Online_Charge`, `Total_Amount`, `Grand_Total`, `status`,`user`) 
			VALUES 
			('$tid','$sid', '$headId', '$subheadid', '$today','Online','', '$c_due', '$cms', '$totaa', '$g_t', 'pending','USERNAME')"))
    	{
    		
    	}
      else
      {
         echo("Error description: " . mysqli_error($con));
      }
   }
   else
   {
	   
	   //header("Location: pay_fees.php"); 
   }
	
   }
    $tttt= $tcms+$tttt;
   //echo "<br><br>GT=$tttt<br>";

?>


<?php
// Merchant key here as provided by Payu
$MERCHANT_KEY = "BC50nb";

// Merchant Salt as provided by Payu
$SALT = "Bwxo1cPe";

// End point - change to https://secure.payu.in for LIVE mode
$PAYU_BASE_URL = "https://test.payu.in";

$action = '';

$posted = array();
if(!empty($_POST)) {
    //print_r($_POST);
  foreach($_POST as $key => $value) {    
    $posted[$key] = $value; 
	
  }
}

$formError = 0;

	if(empty($posted['txnid'])) {
  // Generate random transaction id
  $txnid = $tid;
  $_SESSION['txnid']=$txnid;
} else {
  $txnid = $posted['txnid'];
 
  
  
}
 



 
//print_r($headid);
//print_r($headamt);
		//print_r($cmsn);
		$loop=sizeof($headid);
		//echo "Loop=$loop";
			
		
		$pi="";
		$arg="";
		
		for($t=0;$t<$loop;$t++)
		{
			$hd1=mysqli_query($con,"SELECT * FROM `head` WHERE `Head_Id` = '$headid[$t]' ");
			$hd2=mysqli_fetch_array($hd1);
			$hdd1=mysqli_query($con,"SELECT * FROM `bankaccounts` WHERE `Id` = '$hd2[Bank_Code]' ");
			$hdd2=mysqli_fetch_array($hdd1);
		 	//echo "<br>$hdd2[Bank_Name]<br>$hdd2[MerchantKey]<br>";
		 			$myObj= new stdClass();

				$myObj->name = "$Name";
				//$myObj->merchantId = "$hdd2[MerchantKey]"; 
				$myObj->merchantId = "4825051";
				$myObj->value = "$headamt[$t]";
				$myObj->commission = "$cmsn[$t]";
				$myObj->description = "payment $t";

				$myJSON = json_encode($myObj);
				//echo "<br>$t<br>$myJSON<br>";
				// Turn off error reporting
error_reporting(0);

// Report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Report all errors
error_reporting(E_ALL);

// Same as error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
				
	if($t>=0)
	{
		$arg=",";
	}
	if($t==$loop-1)
	{
		$arg="";
	}
	
				$pi="$pi"."$myJSON"."$arg";
			
		}
		$qt='"';
		//echo $qt;
		 //echo "$pi<br>";
$final='{"paymentParts" : ['.$pi.']}';
//echo "$final<br>";
							
		
$posted['productinfo'] = json_encode(json_decode($final));
								//print_r($posted['productinfo']);

$hash = '';

$posted['udf1'] = '12';
// Hash Sequence
$hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
if(empty($posted['hash']) && sizeof($posted) > 0) {
  if(
          empty($posted['key'])
          || empty($posted['txnid'])
          || empty($posted['amount'])
          || empty($posted['firstname'])
          || empty($posted['email'])
          || empty($posted['phone'])
          || empty($posted['productinfo'])
          || empty($posted['surl'])
          || empty($posted['furl'])
		  || empty($posted['service_provider'])
  ) {
    $formError = 1;
  } else {
    //$posted['productinfo'] = json_encode(json_decode('[{"name":"tutionfee","description":"","value":"500","isRequired":"false"},{"name":"developmentfee","description":"monthly tution fee","value":"1500","isRequired":"false"}]'));
	$hashVarsSeq = explode('|', $hashSequence);
    $hash_string = '';	
	foreach($hashVarsSeq as $hash_var) {
      $hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
      $hash_string .= '|';
    }

    $hash_string .= $SALT;


    $hash = strtolower(hash('sha512', $hash_string));
    $action = $PAYU_BASE_URL . '/_payment';
  }
} elseif(!empty($posted['hash'])) {
  $hash = $posted['hash'];
  $action = $PAYU_BASE_URL . '/_payment';
}
?>
<html>
  <head>
  <script>
    var hash = '<?php echo $hash ?>';
    function submitPayuForm() {
		 document.getElementById("info").style.display = "none";

      if(hash == '') {
        return;
      }
      var payuForm = document.forms.payuForm;
      payuForm.submit();
    }
  </script>
  </head>
  <body onload="submitPayuForm()">
 
    <?php if($formError) { ?>
	
         
    <?php } ?>
    <form action="<?php echo $action; ?>" method="post" name="payuForm">
      <input type="hidden" name="key" value="<?php echo $MERCHANT_KEY ?>" />
      <input type="hidden" name="hash" value="<?php echo $hash ?>"/>
      <input type="hidden" name="txnid" value="<?php echo $txnid ?>" />
      <table align="center">
        <tr>
          <td align="center"><b>Payment Preview</b></td>
        </tr>
        <tr>
          <!-- <td>Amount: </td> -->
          <td><input name="amount" value="<?php echo $tttt; ?>" type="hidden" readonly="true"/></td>
          <!-- <td>First Name: </td> -->
          <td><input name="firstname" id="firstname" value="<?php echo "$Name"; ?>" type="hidden" readonly="true" /></td>
        </tr>
        <tr>
          <!--  <td>Email: </td>  -->
          <td><input name="email" id="email" value="<?php echo "$email"; ?>" type="hidden" readonly="true" /></td>
          <!-- <td>Phone: </td>  -->
          <td><input name="phone" value="<?php echo "$mobile"; ?>" type="hidden" readonly="true"/></td>
        </tr>
        <tr>
          <!--  <td>Product Info: </td> -->
		  
          <td colspan="3"><textarea id="info" name="productinfo"><?php echo (empty($posted['productinfo'])) ? '' : $posted['productinfo'] ?></textarea></td>
        </tr> 
        <tr>
           <!--  <td>Success URI: </td> -->
          <td colspan="3"><input name="surl" value="http://demo.smsoft.in/online_calcu.php" size="64" type="hidden" /></td><!--Here u have to change url -->
        </tr>
        <tr>
          <!--  <td>Failure URI: </td> -->
          <td colspan="3"><input name="furl" value="http://demo.smsoft.in/pay_fees_process_2.php" size="64" type="hidden"/></td><!--Here u have to change url -->
        </tr>

        <tr>
          <td colspan="3"><input type="hidden" name="service_provider" value="payu_paisa" size="64" /></td>
        </tr>

      
          <!--  <td>UDF1: </td> -->
          <td><input name="udf1" value="<?php echo (empty($posted['udf1'])) ? '' : $posted['udf1']; ?>" type="hidden" /></td>
        </tr>
        <table border="3" width="600" align="center">
		<tr>
			<td>
				<h1 align="Middle"><?php include "school.txt";?> / Images With Header</h1>
				<hr>
			</td>
		</tr>
<?php


$date = date('FORMAT'); // FORMAT Eg : Y-m-d H:i:s

$current_date =  date('d-m-Y H:i:s');
$r1=mysqli_query($con,"select * from `stud_basic` where `Stud_Id` = '$sid'");
$row1=mysqli_fetch_array($r1);
?>
<tr>
	<td>
	<!--	<p align="left">Recipt Number : <?php //echo $ReciptCounter; ?> -->
		<p align="right"> <?php echo $current_date;?></p> 
<table  border="" width="800">
						  <thead>
							  <tr>
								  <th>Name</th>
								  <th>Class/Division</th>
								  <th>Reg_No</th>
								  <th>Phone No</th>
							  </tr>
						  </thead>   
						  <tbody>
						  	<?php 

						  		
						  	?>
						<tr>
						<td align="center"><?php echo "$row1[Name]"; ?></td>
						<td align="center"><?php echo "$row1[Class]"; ?>/<?php echo "$row1[Division]"; ?></td>
						<td align="center"><?php echo "$row1[Reg_No]"; ?></td>
						<th align="center"><?php echo "$row1[Phone]"; ?></th>
						</tr>
						
					
						</tbody>
					  </table>

					</td>
				</tr>
				<tr>
					<td>
						<?php
						foreach ($headAr as $headId) 
    {
    	//echo "head=$headId<br>"; //
    		$subheadid="";
    		$head_total=0;
    	 
    	$head_dis_res=mysqli_query($con,"select * from `head` where `Head_Id` = '$headId'");
 		$head_dis=mysqli_fetch_array($head_dis_res); ?>
  		 <h3><?php echo "$head_dis[Name]"; ?></h3>
    	<?php	 
    	for ($i=0; $i < count($h[$headId]); $i++)
    	{ 
    		
    	$id1=$h[$headId][$i]; //sub head
    	$sub_dis_res=mysqli_query($con,"select * from `sub_head` where `Sub_Id` = '$id1'");
 		$sub_dis=mysqli_fetch_array($sub_dis_res); ?> 
 			<table border="0" width="800">
 				<tr>
 					<td>
 						<?php $reci="detailed"; if($reci == "detailed") 
 						{
 							$c=$i+1;
 							?>
  		 <?php echo "$c. $sub_dis[Name]";?> </td><td align="right"> <?php  echo "$sub_dis[Amount]"; } 
  		 $head_total=$head_total+$sub_dis['Amount'];
  		 ?> 

    	</td>
    </tr>
</table>
    	<?php	
      
    	$sub_res=mysqli_query($con,"select * from `stud_basic2` where `Subhead_Id` = '$id1' and `Stud_Id` = '$sid'");
 		$sub=mysqli_fetch_array($sub_res);
 		 
 		/* $sub['Head_Id']   //Head Id
		$sub['Subhead_Id'] //Subhead ID 
		$sub['Total_Amount']  //Total Amount 
		$sub['Paid'] //Paid Amount
		$sub['Balance'] //Balance   */

		}
		 // subheadloop
    		 
			 ?>
			  
			 <h4 align="right"><?php echo "Total  -  $head_total";   ?></h4>
			 <hr class="style6">


			 <?php

			 $gt=$gt+$head_total;
			 $message="Dear $row1[Name] We Received Rs $gt on $current_date in the Mode of $paymentmode Thanking You";

    } // head loop
?>


<h3 align="right"><?php echo " Total  -  $gt";   ?></h3>

<h3 align="right"><?php echo " Fine  -  $c_due";   ?></h3>

<h3 align="right"><?php echo "Online Charges  -  $tcms"; $gt=$tcms+$gt+$c_due; 			$_SESSION['tcms']=$tcms;
$_SESSION['gt']=$gt;  ?></h3>

<h3 align="right"><?php echo "Grand Total  -  $gt";   ?></h3>
<?php
$f = new NumberFormatter("en", NumberFormatter::SPELLOUT);

 ?>
<h3 align="right"><?php echo "In Words : ".$f->format($gt)." Only";   ?></h3>
</td></tr>
<tr>
          <?php if(!$hash) { ?>
            <td colspan="4" align="center"><input type="submit" value="Submit" /></td>
          <?php } ?>
        </tr>
</table>
*
        
      </table>
    </form>
	
	
<?php 
	
		

?>
	</body>
</html>

MMCT - 2023