Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 0 additions & 130 deletions UI/code/musicChoice.php

This file was deleted.

Binary file added frontend/audio/Fracture.mp3
Binary file not shown.
Binary file added frontend/audio/In My Time.mp3
Binary file not shown.
Binary file added frontend/audio/Just_The_Two_Of_Us.mp3
Binary file not shown.
Binary file added frontend/audio/Sleep Music.mp3
Binary file not shown.
Binary file added frontend/audio/Sunday Vibes.mp3
Binary file not shown.
Binary file added frontend/audio/Sunny.mp3
Binary file not shown.
Binary file added frontend/audio/Sunset at the Veranda.mp3
Binary file not shown.
Binary file added frontend/audio/Viento Estelar.mp3
Binary file not shown.
36 changes: 36 additions & 0 deletions frontend/audioPlayer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
session_start();
$host = 'localhost';
$user = 'dissertation';
$pass = '091164383707572306304pass';
$db = 'dreamHacker';

$link = mysqli_connect($host,$user,$pass, $db);

// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}

// Escape user inputs for security
$song = mysqli_real_escape_string($link, $_REQUEST['song']);
//$location = mysqli_real_escape_string($link, $_REQUEST['exampleRadios']);
$location = 'audio/' . $song .'.mp3';


// Attempt insert query execution
//$sql = "INSERT INTO audio (song, location) VALUES ('$song','$location')";
$sql = "UPDATE audio SET song = '$song', location = '$location' WHERE id = 2";

if(mysqli_query($link, $sql)){
$_SESSION['message'] = "You have Succesfully changed the audio!";
header("location: sucess.php");
}
else{
$_SESSION['message'] = "ERROR: Could not able to execute: " . $sql. " . mysqli_error($link)";
header("location: sucess.php");
}

?>
16 changes: 16 additions & 0 deletions UI/code/css/main.css → frontend/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ mainPoint {
text-align: center;
border: 1px dotted grey;
}

footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
}

.centered {
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
3 changes: 2 additions & 1 deletion UI/code/history.php → frontend/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
</thead>
<tbody>
<tr>
<td scope="row"> <?= $record['date'] ?></td>
<?php $date = substr($record['date'], 0, 10); ?>
<td scope="row"> <?= $date ?></td>
<td> <?= $record['remSleep'] ?></td>
<td> <?= $record['heartRate'] ?></td>
<td> <?= $record['hrsSlept'] ?></td>
Expand Down
69 changes: 69 additions & 0 deletions frontend/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
define("ROOTPATH", 'C:/Apache24/htdocs/dreamHacker');
//include ROOTPATH . '/database/db.php';
session_start();
?>

<html lang="en">
<head>
<!-- Meta Data -->

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Dream Hacker</title>

<meta name="description" content="Home page for Dream Hacker">

<meta name="author" content="Real Time Group">

<!-- Styler -->
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
li {
display: inline;
margin: 1%;
padding: 1%;
font-size: 36px;
border-radius: 20px;
border: 1px grey solid;

}

ul {
list-style-type: none;
text-align: center;
}
</style>

</head>

<body>
<div class='container' align=center>
<img src="pictures/dreamHacker.png" width="400" height="150">
<hr>
</div>

<div class='centered'>
<ul class='w3-ul w3-hoverable'>
<a href="liveReading.php"><li> Live Reading</li></a>
<a href='musicChoice.php'><li> Choose Audio</li></a>
<a href='history.php'><li> Histroy</li></a>
</ul>
</div>
<footer>
<div class="container">
<hr>
<h3>What is Dream Hacker</h3>
<p> Dream Hacker is program designed to help you sleep better. Based on numerous research on music and the effects it has on sleep our projects monitors our users heart rate and plays music. Once Dream Hacker detects the user is has entered REM sleep, when people are most susceptible to external stimuli, it will play calming music.</p>
<hr>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
</body>
</html>
45 changes: 34 additions & 11 deletions UI/code/liveReading.php → frontend/liveReading.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
<?php
define("ROOTPATH", 'C:/Apache24/htdocs/dreamHacker');
//include ROOTPATH . '/database/db.php';
include ROOTPATH . '/database/db.php';
require ROOTPATH . '/functions/paginator.php';
session_start();

$conn = mysqli_connect($host, $user, $pass, $db);
$query = "SELECT * FROM audio";

//these variables are passed via URL
$limit = ( isset( $_GET['limit'])) ? $_GET['limit'] : 1; // items per page
$page = (isset ($_GET['page'])) ? $_GET['page'] : 1; //starting page
$links = 10;

$paginator = new Paginator ( $mysqli, $query); //__constructor is called
$results = $paginator->getData( $limit, $page);


$dataPoints = array();
$y = 5;
for($i = 0; $i < 10; $i++){
Expand Down Expand Up @@ -89,28 +102,38 @@ function updateChart() {
</div>
</div>
</div>
<?php
$y=0;
if ($y == ($results->data)){
echo'
<div class="app-container">
<div class="row">
<h1>No results found</h1>
</div>
<hr>
</div>';
}
else {
for ($p = 0; $p < count($results->data); $p++): ?>
<?php
$record = $results->data[$p];
?>
<div class="container">
<div class="conatiner">
<div class = "row">
<div class = "col-md-8 vl">
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
</div>
<div class = "col-md-4" align=center>
<h4>Time In bed</h4>
<p id='bed'>4 hours</p>
<hr>
<h4>Song Choosen</h4>
<p id='song'>Vivaldi</p>
<hr>
<h4>Rem Sleep Detected</h4>
<p id='rem'>Yes</p>
<h4><strong>Song Choosen</strong></h4>
<p id='song'><?= $record['song'] ?></p>
<hr>
<p class='backButton w3-hover-red'> Stop Reading<p>
</div>
</div>
</div>
</div>
<?php endfor; }?>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</body>

</html>
</html>
Loading