/**
  * Gets the computers of the asked lab
  */
 public static function GetComputersByLab($lab_id)
 {
     $sql = "select * from Computers where LabID = " . $lab_id . " order by X1, Y1;";
     $results = DBConnection::ExecuteSelectQuery($sql);
     $computers = self::GetArrayFromDBTable($results);
     return $computers;
 }
Ejemplo n.º 2
0
 public static function Load($user_name, $password)
 {
     $user_name = addslashes(stripslashes($user_name));
     $password = md5($password);
     $sql = "select *\n\t\t\t\t\tfrom Users\n\t\t\t\t\twhere\n\t\t\t\t\t\t(UserName = '******') and\n\t\t\t\t\t\t(Password = '******');";
     $results = DBConnection::ExecuteSelectQuery($sql);
     if (count($results) == 0) {
         return null;
     }
     $row = $results[0];
     if ($row["DateActivated"] == null) {
         $date_activated = null;
     } else {
         $date_activated = new DateTime($row["DateActivated"]);
     }
     $user = new User((int) $row["ID"], $row["UserName"], $row["CsUser"], (int) $row["Warnnings"], $row["ActivationKey"], $date_activated, new DateTime($row["DateAdded"]));
     return $user;
 }
Ejemplo n.º 3
0
 public static function GetLabsOccupancy()
 {
     $sql = "select\n\t\t\t\t\tLabs.ID as LabID,\n\t\t\t\t\tLabs.Capacity,\n\t\t\t\t\t(\n\t\t\t\t\t\tselect count(Computers.LabID)\n\t\t\t\t\t\tfrom Computers\n\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t(Computers.LabID = Labs.ID) and\n\t\t\t\t\t\t\t((Computers.StatusID = 2) or (Computers.StatusID = 3))\n\t\t\t\t\t) as TotalUsed\n\t\t\t\tfrom Labs;";
     $results = DBConnection::ExecuteSelectQuery($sql);
     return $results;
 }
Ejemplo n.º 4
0
<?php

ini_set("display_errors", 1);
require_once "classes/db_connection.php";
$sql = "select * from Computers;";
$results = null;
try {
    DBConnection::Connect();
    $results = DBConnection::ExecuteSelectQuery($sql);
} catch (Exception $ex) {
}
if ($results != null) {
    foreach ($results as $row) {
        echo $row["ID"] . $row["ComputerName"] . "<br />";
    }
}
DBConnection::Close();
?>
done.