Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.144.235.141
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/cngray/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/cngray/www/BBRemove.php
<?php
        session_start();
        if(!isset($_SESSION['username'])){
                header("location:BBWelcome.php");
        } else {
?>

<html>
<center>
<?php
	

	$username = $_SESSION['username'];
        $pass = $_SESSION['pass'];
        $check = $_SESSION['check'];
        $pro = $_SESSION['pro']; 
        $course = $_SESSION['course'];
	$students = $_POST['ST'];
        $_SESSION['username'] = $username;
        $_SESSION['pass'] = $pass;
        $_SESSION['check'] = 1;
	$_SESSION['course'] = $course;
        $host = 'localhost';
        $user = 'cngray';
        $passwd = 'vwccscngray';
                                        
        $database = 'cngray';
        $connect = mysqli_connect($host, $user, $passwd);   
        mysqli_select_db($connect, $database);


	$class = str_replace(' ', '', $course);
        $Cquery = "select Student from $class";
        $CResult = mysqli_query($connect, $Cquery);
        if($CResult)
       	{
		$i = 0;
        	$stu = array();
        	while($row = mysqli_fetch_row($CResult))
        	{
        		foreach($row as $field)
                	{
                		$stu[$i] = $field;
                        	$i++;
                	}
        	}
	}else
		print "Fail to get students";
	
		if(empty($students))
			print "<br>Return to page and select a student.<br>";
		else
		{
			$names = array();
			foreach((array)$students as $a)
			{
				$name = $stu[$a];
				
				$Rquery = "delete from $class where Student like '$name'";
				$Rresult = mysqli_query($connect, $Rquery);
				if($Rresult)
					print "<br>$name removed from Class.<br>";
				else
					print "<br>$name not removed fromm class<br>";
			}
		}
	?>
	<br><INPUT Type=button VALUE="Back" onClick="location.href = 'BBAR.php'">
        <?php

	mysqli_close($connect);
}
?>

Stv3n404 - 2023