MMCT TEAM
Server IP : 2a02:4780:3:1378:0:3736:a38e:10  /  Your IP : 3.138.123.118
Web Server : LiteSpeed
System : Linux sg-nme-web1278.main-hosting.eu 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : NONE
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/../Applied_fees_process.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(!isset($_SESSION['user']) && !isset($_SESSION['Mng_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
if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{

$head_id=$_SESSION["h"];
 $y=$_SESSION["c"];
$z=$_SESSION["d"];
//echo"<pre>"; print_r($_SESSION); exit;

include "config/config.php";
$a=$_POST["a"];

foreach ($a as $sid ) 
{
//echo "$sid<br>";
$r7=mysqli_query($con,"SELECT * FROM `head` WHERE `Head_Id` = '$head_id' ");
	while($row7=mysqli_fetch_array($r7))
	{
		//echo "$row7[Name]<br>";
		$subhead=explode("/",$row7['SubHeads']);
		
		foreach($subhead as $sub)
		{
			$r8=mysqli_query($con,"SELECT * FROM `sub_head` WHERE `Sub_Id` = '$sub' ");
			$row8=mysqli_fetch_array($r8);
			//echo "$row8[Sub_Id]<br>";
			$sel_b2=mysqli_query($con,"SELECT * FROM `stud_basic2` where Stud_Id=$sid and Head_Id=$head_id and `Subhead_Id` = '$sub'");
			//echo mysqli_num_rows($sel_b2); exit;
			if(mysqli_num_rows($sel_b2)>0)
			{
			    $sub_amount=$row8['Amount'];
			    mysqli_query($con,"UPDATE stud_basic2 SET Total_Amount=Balance+$sub_amount,Paid=0,Balance=Balance+$sub_amount where Stud_Id=$sid and Head_Id=$head_id and `Subhead_Id` = '$sub' ");
			}
			else
			{
                $r=mysqli_query($con,
                "INSERT INTO `stud_basic2` 
                ( `Stud_Id`, `Head_Id`, `Subhead_Id`, `Total_Amount`, `Paid`, `Balance`, `discription`) 
                VALUES 
                ('$sid', '$head_id', '$row8[Sub_Id]', '$row8[Amount]', '0', '$row8[Amount]', '')");
			}

		}
		
	}


}

?>
<script>
document.location="Apply_fees_code.php";
</script>
<?php
}else
{
	?>
<script>
document.location="dashboard.php";
</script>
<?php
}
?>

MMCT - 2023