Server IP : 172.16.15.8 / Your IP : 18.188.76.209 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 ] |
---|
<?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']; $stud = $_POST['NewS']; $course = $_SESSION['course']; $_SESSION['course'] = $course; $_SESSION['username'] = $username; $_SESSION['pass'] = $pass; $_SESSION['check'] = 1; $host = 'localhost'; $user = 'cngray'; $passwd = 'vwccscngray'; $database = 'cngray'; $connect = mysqli_connect($host, $user, $passwd); mysqli_select_db($connect, $database); $class = str_replace(' ','', $course); $query = "select * from $class"; $Result_id = mysqli_query($connect, $query); if($Result_id) { $names = explode(", ", $stud); for($i = 0; $i < count($names); $i++) { $person = explode(" ", $names[$i]); $First = $person[0]; $Last = $person[1]; $Pquery = "select * from BBUsers where FName = '$First' and LName = '$Last'"; $PResult = mysqli_query($connect, $Pquery) or die(mysqli_error($connect)); $Result = mysqli_fetch_row($PResult); if ($Result >= 1) { $WN = $First." ".$Last; $IC = "select * from $class where Student = '$WN' and Prof = '$pro' limit 1"; $PC = mysqli_query($connect, $IC) or die(mysqli_error($connect)); $PCResult = mysqli_fetch_row($PC); if($PCResult >= 1) {?> <script type = "text/javascript"> <!-- window.location = "BBAR.php" --> </script> <?php } else { $inClass = "insert into $class values('$pro', '$WN')"; $inClassResults = mysqli_query($connect, $inClass) or die(mysqli_error($connect)); if($inClassResults) {?> <script type = "text/javascript"> <!-- window.location = "BBAR.php" --> </script> <?php } else {?> <script type = "text/javascript"> <!-- window.location = "BBAR.php" --> </script> <?php } } } else { $WN = $First." ".$Last; $FL = $First[0]; $FL = strtolower($FL); $NU = $FL . $Last; $NU = strtolower($NU); $PW = $NU."12"; $EM = $NU."@comp.edu"; $Year = 4; $Iquery = "insert into BBUsers values('$First', '$Last', '$NU', '$PW', $Year, '$EM')"; $IResult = mysqli_query($connect, $Iquery); if($IResult) { $iq = "insert into $class values ('$pro', '$WN')"; $ir = mysqli_query($connect, $iq); $Create = "create table $NU(Class varchar(20), AssName varchar(20), Grade int)"; $CreateR = mysqli_query($connect, $Create) or die(mysqli_error($connect)); ?> <script type = "text/javascript"> <!-- window.location = "BBAR.php" --> </script> <?php } else {?> <script type = "text/javascript"> <!-- window.location = "BBAR.php" --> </script> <?php } } } } else print "connection failed"; ?> <br><INPUT Type=Button VALUE="Back" onclick = "location.href = 'BBAR.php'"> <?php mysqli_close($connect); } ?>