HEX
Server: LiteSpeed
System: Linux server137.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: bibuzptr (1123)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/bibuzptr/elearning.bibu-edu.us/current/admin/app/editgrades.php
<?php
session_start();
include_once('../../includes/db_connect.php');
header("Content-Type:application/json");
$date = date("Y-m-d H:i:s");
$year = date("Y");
// if(isset($_SESSION["OPENUNI^###DHSG"])){
//     $email = $_SESSION["OPENUNI^###DHSG"];
    // $chkuser = mysqli_query($con,"SELECT * FROM admins WHERE admin_email='$email'");
    // while($row = mysqli_fetch_assoc($chkuser)){
    //   $uid = $row["id"];
    //   $name = $row["admin_name"];
    // }
/*<===========================course Management=================================>*/
if(isset($_POST["unitid"])){
    extract($_POST);
 
    //New entry
    if(mysqli_num_rows(mysqli_query($con,"SELECT * FROM gradespast WHERE studentid='$studentid' AND unitid='$unitid'"))<1){
     if(mysqli_query($con,"INSERT INTO gradespast(studentid,courseid,unitid,attempted,earned,grade,points) VALUES('$studentid','','$unitid','$attempted','$earned','$grade','$points')")){
       echo json_encode(array("status" => 200, "message" => "SUCCESS"));
      }
      else{
        echo json_encode(array('status' => 300,'message' => mysqli_error($con)));
      }
    }
    else{
    if(mysqli_query($con,"UPDATE gradespast SET attempted='$attempted',earned='$earned',grade='$grade',points='$points' WHERE studentid='$studentid' AND unitid='$unitid'")){
         echo json_encode(array('status' => 200,'message' => 'SUCCESS'));
        }
        else{
          echo json_encode(array('status' => 300,'message' => 'ERROR'));
      }
    }
  }


//}
?>
<?php mysqli_close($con) ?>