function DAOScheduler_getSchedules($weekNumber) { include_once 'DBUtils.php'; $mysqli = getMySQLi(); $query = "SELECT day_number, hour_number, username FROM schedules WHERE week_number = " . $weekNumber; $result = $mysqli->query($query); while ($row = $result->fetch_array()) { $user_arr[] = $row; } $result->close(); $mysqli->close(); return $user_arr; }
function DAOLogin_login($user, $password) { include_once 'DBUtils.php'; $mysqli = getMySQLi(); $query = "SELECT username FROM users WHERE username = ? AND password = ?"; $stmt = $mysqli->prepare($query); $stmt->bind_param("ss", $user, $password); $stmt->execute(); $loggedIn = false; $stmt->bind_result($name); if ($stmt->fetch()) { $stmt->close(); $mysqli->close(); return $name; } else { $stmt->close(); $mysqli->close(); return false; } }