<commit_before><?php require_once('../../Connections/MySQL.php');

// Constantes de esta pagina
const HOW_MANY_YEARS_OLD = 3, HOW_MANY_SUBJECTS = 3, MAX_ID_SUBJECT_FROM_FIRST_YEAR = 11;

//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// verify that the user is admin
if ($_SESSION['MM_UserGroup'] != 'Admin') {
    die("No cuenta con permisos suficientes");
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string(dbconnect(), $theValue) : mysqli_escape_string(dbconnect(), $theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

//mysqli_report(MYSQLI_REPORT_ALL) ;
?>


<?php

  $action = (isset($_REQUEST["action"])&& $_REQUEST["action"] !=NULL)?$_REQUEST["action"]:'';
  $idMateria = GetSQLValueString($_REQUEST["materia"], "int");

	if($action == "ajax") {
    $allowed_student = [];

    $query = mysqli_query(dbconnect(), "
      SELECT COUNT(*)
      FROM lista_materia LM
      WHERE LM.IdListaMateria = $idMateria
    ;");

    $tieneListadoGenerado = mysqli_fetch_row($query);

    // Si tiene listado generado, voy a buscar los alumnos por IdMateria
    if ($tieneListadoGenerado[0] === 1) {
      $query = mysqli_query(dbconnect(), "
        SELECT * FROM
        alumnos A
        INNER JOIN alumno_materias AM ON A.IdAlumno = AM.IdAlumno
        WHERE AM.IdListaMateria = $idMateria
        ORDER BY A.Apellido ASC
      ");

      $allowed_student = mysqli_fetch_all($query, MYSQLI_ASSOC);<commit_msg>Saco comparacion de tipo y valor x solo valor<commit_after><?php require_once('../../Connections/MySQL.php');

// Constantes de esta pagina
const HOW_MANY_YEARS_OLD = 3, HOW_MANY_SUBJECTS = 3, MAX_ID_SUBJECT_FROM_FIRST_YEAR = 11;

//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// verify that the user is admin
if ($_SESSION['MM_UserGroup'] != 'Admin') {
    die("No cuenta con permisos suficientes");
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string(dbconnect(), $theValue) : mysqli_escape_string(dbconnect(), $theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

//mysqli_report(MYSQLI_REPORT_ALL) ;
?>


<?php

  $action = (isset($_REQUEST["action"])&& $_REQUEST["action"] !=NULL)?$_REQUEST["action"]:'';
  $idMateria = GetSQLValueString($_REQUEST["materia"], "int");

	if($action == "ajax") {
    $allowed_student = [];

    $query = mysqli_query(dbconnect(), "
      SELECT COUNT(*)
      FROM lista_materia LM
      WHERE LM.IdListaMateria = $idMateria
    ;");

    $tieneListadoGenerado = mysqli_fetch_row($query);

    // Si tiene listado generado, voy a buscar los alumnos por IdMateria
    if ($tieneListadoGenerado[0] == 1) {
      $query = mysqli_query(dbconnect(), "
        SELECT * FROM
        alumnos A
        INNER JOIN alumno_materias AM ON A.IdAlumno = AM.IdAlumno
        WHERE AM.IdListaMateria = $idMateria
        ORDER BY A.Apellido ASC
      ");

      $allowed_student = mysqli_fetch_all($query, MYSQLI_ASSOC);
{'fraction_non_alphanumeric': 0.17215240375024934, 'fraction_numerical': 0.0027927388789148215, 'mean_word_length': 3.77069457659372, 'pattern_counts': {'":': 12, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1557932', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1742, 'n_words': 339}