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_update_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';
$school_code = $_SESSION['code'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') 
{
	$stud_id = trim($_POST["Std_Id"]);
 $Std_Name=$_POST["Std_Name"];
 $Sex=$_POST["Sex"];
 if($Sex=="")
 {
     $Sex='Male';
 }
$Reg_Number=$_POST["Reg_Number"];
$Class=$_POST["Class"];
$Division=$_POST["Division"];
$Phone=$_POST["Phone"];
$bus_info=$_POST["bus_info"];

if (!empty($_FILES['student_image']['name'])) {
    $fileinfo=PATHINFO($_FILES["student_image"]["name"]);
	$newFilename= $stud_id."." .$fileinfo['extension'];
	$valid_extensions = array('jpeg', 'jpg', 'png');
	
	if(in_array($fileinfo['extension'], $valid_extensions)) 
	{
	    if(!is_dir("images/students/". $school_code ."/")) {
			mkdir("images/students/". $school_code ."/");
		}
		
		$location="images/students/".$school_code."/".$newFilename;
		$upd_new = mysqli_query($con,"UPDATE `stud_basic` SET `Photos` = '$location' WHERE `stud_basic`.`Stud_Id` = '$stud_id'");
		if($upd_new) {
		    move_uploaded_file($_FILES["student_image"]["tmp_name"],$location);
		}
	}
	else {
	    echo"<script>alert('Student Photos should be jpg, jpeg and png only.'); window.location='Student_view.php';</script>";
	}
}

// echo "UPDATE `stud_basic` SET `Name` = '$Std_Name',  `Class` = '$Class', `Division` = '$Division', `Reg_No` = '$Reg_Number', `Phone` = '$Phone' WHERE `stud_basic`.`Stud_Id` = '$stud_id'"; exit;
mysqli_query($con,"UPDATE `stud_basic` SET `Name` = '$Std_Name',  `Class` = '$Class', `Division` = '$Division', `Reg_No` = '$Reg_Number', `Phone` = '$Phone', bus_info = '$bus_info' WHERE `stud_basic`.`Stud_Id` = '$stud_id'");

?>
<script>
alert("Update Successfull");
document.location="Student_view.php";
</script>

<?php

}else{
	
	header('location: dashboard.php');
}
?>













MMCT - 2023