<commit_before><?php 
 
class DALQueryResult {
     
  private $_results = array();
 
  public function __construct(){}
 
  public function __set($var,$val){
    $this->_results[$var] = $val;
  }
 
  public function __get($var){  
    if (isset($this->_results[$var])){
      return $this->_results[$var];
    }
    else{
      return null;
    }
  }
}
 
class DAL {
 
  public function __construct(){}
  
  //---------- Customer Module ---------->
  public function checkPersonExists($id) {
    $sql = "SELECT * FROM directory where user_id = '$id'";
    $result = $this->query($sql);
    if (mysql_num_rows($result) > 0)
      return true;
    else
      return false;
  }

  public function getPersonMachines($name){
    $sql = "SELECT machine.mach_id as mach_id, manufacturer.mfr as mfr, machine.model as model, machine.serial_num as serial, machine.warr_status as warr_status, machine.purchaser as purchaser
            FROM machine 
            INNER JOIN manufacturer ON manufacturer.mfr_id=machine.mfr_id
            INNER JOIN directory ON directory.user_id=machine.user_id";
    return $this->query($sql);
  }

  public function getPersonInfo($name){
    if ($name = 'all') {
      $sql = "SELECT * FROM directory";
    } else {
      $sql = "SELECT * FROM directory WHERE user_id = '$name'";
    }
    return $this->query($sql);
  }

  public function getPersonCheckups($name){
    return false;
  }
  // <-------- /Customer Module -----------

  //---------- Staff Module -------------->
  public function checkStaffMemberExists($name) {
    return false;
  }
  /*
  public function getStaffInfo($name){          //Function outlined
    if ($name = 'all'){
      $sql = "SELECT * FROM ";
    } else {
      $sql = "SELECT * FROM WHERE = '$name'";
    }
    }
  }*/

  public function getStaffUserInfo() {
    $sql = "SELECT * FROM auth"; // id_user,fname,lname,email,type FROM auth";
    return $this->query($sql);
  }

  // <-------- /Staff Module --------------

  private function dbconnect() {
    $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)
        or die ("<br/>Could not connect to MySQL server");
         
    mysql_select_db(DB_DB,$conn)
        or die ("<br/>Could not select the indicated database");
     
    return $conn;
  }
   
  private function query($sql){
 
    $this->dbconnect();
 
    $res = mysql_query($sql);
 
    if ($res){
      if (strpos($sql,'SELECT') === false){
        return true;
      }
    }
    else{
      if (strpos($sql,'SELECT') === false){
        return false;<commit_msg>Update join statement<commit_after><?php 
 
class DALQueryResult {
     
  private $_results = array();
 
  public function __construct(){}
 
  public function __set($var,$val){
    $this->_results[$var] = $val;
  }
 
  public function __get($var){  
    if (isset($this->_results[$var])){
      return $this->_results[$var];
    }
    else{
      return null;
    }
  }
}
 
class DAL {
 
  public function __construct(){}
  
  //---------- Customer Module ---------->
  public function checkPersonExists($id) {
    $sql = "SELECT * FROM directory where user_id = '$id'";
    $result = $this->query($sql);
    if (mysql_num_rows($result) > 0)
      return true;
    else
      return false;
  }

  public function getPersonMachines($name){
    $sql = "SELECT machine.mach_id as mach_id, manufacturer.mfr as mfr, machine.model as model, machine.serial_num as serial, machine.warr_status as warr_status, machine.purchaser as purchaser
            FROM machine 
            INNER JOIN manufacturer ON manufacturer.mfr_id=machine.mfr_id
            INNER JOIN directory ON directory.user_id=machine.user_id";
    return $this->query($sql);
  }

  public function getPersonInfo($name){
    if ($name = 'all') {
      $sql = "SELECT * FROM directory";
    } else {
      $sql = "SELECT * FROM directory WHERE user_id = '$name'";
    }
    return $this->query($sql);
  }

  public function getPersonCheckups($name){
    return false;
  }
  // <-------- /Customer Module -----------

  //---------- Staff Module -------------->
  public function checkStaffMemberExists($name) {
    return false;
  }
  /*
  public function getStaffInfo($name){          //Function outlined
    if ($name = 'all'){
      $sql = "SELECT * FROM ";
    } else {
      $sql = "SELECT * FROM WHERE = '$name'";
    }
    }
  }*/

  public function getStaffUserInfo() {
    $sql = "SELECT auth.id_user as user_id,auth.fname as fname,auth.lname as lname,auth.email as email,auth.type as type,user_type.type as utype 
    FROM auth
    INNER JOIN user_type ON auth.type=user_type.type";
    return $this->query($sql);
  }

  // <-------- /Staff Module --------------

  private function dbconnect() {
    $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)
        or die ("<br/>Could not connect to MySQL server");
         
    mysql_select_db(DB_DB,$conn)
        or die ("<br/>Could not select the indicated database");
     
    return $conn;
  }
   
  private function query($sql){
 
    $this->dbconnect();
 
    $res = mysql_query($sql);
 
    if ($res){
      if (strpos($sql,'SELECT') === false){
        return true;
      }
    }
    else{
      if (strpos($sql,'SELECT') === false){
        return false;
{'fraction_non_alphanumeric': 0.16296438146304099, 'fraction_numerical': 0.00038299502106472615, 'mean_word_length': 2.3288718929254304, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, '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': '4892322', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1571, 'n_words': 412}