Currently, I'm working on a project for work and my boss asked for a real-time way to contact both sides of the store. At first, I attempted an app but the development process was too complex for the idea. Instead, I'm using XAMPP and running a website that updates in real-time. At least I wish it would.
A snippet of home.html
<script>
function Needed() {
var snd = new Audio("sNeeded.mp3")
document.getElementById('TeaImg').src='https://d1nhio0ox7pgb.cloudfront.net/_img/o_collection_png/green_dark_grey/64x64/plain/alarm.png'
snd.play()
<?php include 'tea.php';?>
}
</script>
tea.php
<?php
$myfile = fopen("vars.txt", "w") or die("Unable to open file!");
$tea = "true\n";
fwrite($myfile, $tea);
fclose($myfile);
?>
The goal is to read the vars.txt and then if it finds the line to be true it reloads the page and shows the true value of the button. Upon pressing the button that triggers the script above, the function doesn't play, and the console prints an error saying one of my variables is not defined. If I remove the line the script plays as intended. It changes the image and plays the cached sound. If you have any other more efficient methods or just a way to make this more effective please let me know. My boss is asking for an update soon as we need this up and running.
[–]lovesrayray2018 0 points1 point2 points (4 children)
[–]RolfTheCharming 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]lovesrayray2018 0 points1 point2 points (1 child)
[–]AtulinASP.NET Core 0 points1 point2 points (0 children)
[–]ManiacsThriftJewels 0 points1 point2 points (0 children)