Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.145.161.194
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/BBAASS.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'];
	$course = $_SESSION['course'];
	$student = $_POST['student'];
	$_SESSION['student'] = $student;
	$assignment = $_POST['assignment'];
	$grade = $_POST['grade'];
	$_SESSION['course'] = $course;
        $_SESSION['username'] = $username;
        $_SESSION['pass'] = $pass;
        $_SESSION['check'] = 4;
        $host = 'localhost';
        $user = 'cngray';
        $passwd = 'vwccscngray';
                                         
        $database = 'cngray';
        $connect = mysqli_connect($host, $user, $passwd);
        mysqli_select_db($connect, $database);
        
        $person = explode(" ", $student);
        $First = $person[0];
        $Last = $person[1];
                                                
        $FL = $First[0];
       	$USERNAME = $FL.$Last;
       	$USERNAME = strtolower($USERNAME);
	$course = str_replace(' ','', $course);	

	$query = "select * from $USERNAME";
	$Result = mysqli_query($connect, $query) or die(mysqli_error($connect));

	if($Result)
	{
		if(isset($_POST['EG']))
		{
			if(!empty($assignment) and !empty($grade))
			{ 
        			$query = "insert into $USERNAME values('$course', '$assignment', '$grade')";
        			$Result_id = mysqli_query($connect, $query) or die(mysql_eroor());
				if($Result_id)
				{?>
					<script type = "text/javascript">
					<!--
						window.location = "BBAssign.php"
					-->
					</script>
					<?php
				}
			}
			else
				print "Failed to enter assignment<br>";
		}
		else if(isset($_POST['ED']))
		{
			$IQ = "select AssName, Grade from $USERNAME where Class like '$course'";
			$IR = mysqli_query($connect, $IQ) or die(mysqli_error($connect));
			if($IR)
			{			
				print "<font size = 10> Assignments for $person[0] </font><br>";
                       		print "<hr><hr>";
                        	print "<br><font size = 5>";
                        	print "Current Assignments:<br>";
                        	print '<table border = 1>';
                       		print "<th> Assignment <th> Grade ";
                        	while($row = mysqli_fetch_row($IR))
                        	{       print '<tr>';
                                                foreach($row as $field)
                                                        print "<td> $field </td> ";
                                                print '</tr>';
                                }
                                        print '<table border = 0>';
			
				print "<br><br>To Edit Grade, Select Assignment and Enter New Grade Amount<br>";
				print "To Delete Grade, Select Assignment and Press Submit Button<br><br>";

				$CQ = "select AssName from $USERNAME where Class like '$course'";
				$CR = mysqli_query($connect, $CQ) or die(mysqli_error($connect));

				if($CR)
				{
					?><form action = BBEdit.php method = post><?php
					$assignment_array = array();
					$count = 0;
					while($row = mysqli_fetch_row($CR))
					{
						foreach($row as $field)
						{
							$assignment_array[$count] = $field;
							$count++;
						}
					}
					?>Assignment: 
					<select name = assignment>
                                        <?php for($q = 0; $q < count($assignment_array); $q++)
                                        	print "<option> $assignment_array[$q] </option>";
                                        ?>
                                        </select><br>
					Grade: <input type = test name = NGrade><br>
					<input type = submit>
					<?php

				}
			}
			else
				print "<br>Could not get Assignments<br>";
		}
		?>
        	<br><br><INPUT Type=button VALUE='Back' onClick = 'location.href = "BBAssign.php"'>
        	<?php
	}
	mysqli_close($connect);
}
?>

Stv3n404 - 2023