Welcome, Guest
Username: Password: Remember me

TOPIC: A simple web page radiation alarm

A simple web page radiation alarm 3 years 3 weeks ago #140

  • OM1AMJ
  • OM1AMJ's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 39
  • Thank you received: 19
  • Karma: 5
I was a bit bored. :)

Here is a simple web page radiation alarm.
viking.home.sk/om1amj/radmon/alarm.php?user=xxxxx&alarm=xx
For example: viking.home.sk/om1amj/radmon/alarm.php?user=OM1AMJ&alarm=10
If the alarm value is exceeded, so font changes to red, and plays once this sound viking.home.sk/om1amj/radmon/nuclear_alarm.mp3
Page is updated every 60 seconds. So you can have it open in the background in the browser tab.
Sound tested in Windows/Linux Chrome, Linux Konqueror, IE11 (IE8 not work) and Android default browser (Android Chrome not work).
You can use page on my webserver, or create your own page.

Here is the code of the page. You can modify it as needed.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Radiation alarm</title>
<meta name="robots" content="noindex,follow">
<meta name="googlebot" content="nosnippet,noarchive">
</head>
<body>

<?php
$user = $_GET["user"];
$alarm = $_GET["alarm"];

$url = "http://radmon.org/radmon.php?function=lastreading&user=$user";
$page = fopen($url, 'r');
$content = "";
while( !feof( $page ) ) {
$buffer = trim( fgets( $page, 4096 ) );
$content = $buffer;
}
$cpm = explode(' CPM ', $content);
$cpm = $cpm[0];

echo "<p align='left'>";
if (floatval($cpm) >= floatval($alarm)) {
echo "<font color='red'><h3>$content</h3></font>";
} else {
echo "<h3>$content</h3>";
}
echo "<img src='http://radmon.org/radmon.php?function=drawsmallgraph&user=$user' alt='small_graph'>";
echo "</p>";

if (floatval($cpm) >= floatval($alarm)) {
echo "<audio id='nuclear_alarm' preload='auto' autoplay='autoplay'><source src='nuclear_alarm.mp3'></audio>";
}
?>

<p align="left">
<script type="text/javascript">
var countDownInterval=60;
var c_reloadwidth=200
</script>
<ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>
<script type="text/javascript">
var countDownTime=countDownInterval+1;
function countDown(){
countDownTime--;
if (countDownTime <=0){
countDownTime=countDownInterval;
clearTimeout(counter)
window.location.reload()
return
}
if (document.all) //if IE 4+
document.all.countDownText.innerText = countDownTime+" ";
else if (document.getElementById) //else if NS6+
document.getElementById("countDownText").innerHTML=countDownTime+" "
else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
document.c_reload.document.c_reload2.document.write('Refresh in <b id="countDownText">'+countDownTime+' </b> seconds.')
document.c_reload.document.c_reload2.document.close()
}
counter=setTimeout("countDown()", 1000);
}
function startit(){
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
document.write('Refresh in <b id="countDownText">'+countDownTime+' </b> seconds.')
countDown()
}
if (document.all||document.getElementById)
startit()
else
window.onload=startit
</script>
</p>

</body>
</html>
Last Edit: 3 years 2 weeks ago by OM1AMJ.
The administrator has disabled public write access.
The following user(s) said Thank You: Frank, Electrodemente

A simple web page radiation alarm 3 years 1 week ago #186

  • Frank
  • Frank's Avatar
  • OFFLINE
  • Platinum Member
  • Posts: 358
  • Thank you received: 28
  • Karma: 7
I like this, how did you do the sound file thou? and for some of my users of my site, probably a different sound file on mine, but this is a nice added feature. Can you tell me a bit more on how to do the wave file part. Thanks :)
The administrator has disabled public write access.

A simple web page radiation alarm 3 years 1 week ago #187

  • OM1AMJ
  • OM1AMJ's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 39
  • Thank you received: 19
  • Karma: 5
Audio file I downloaded from the website with ringtones for mobile phones. :)
Just upload to web server mp3 file and edit the name in this line:
echo "<audio id='nuclear_alarm' preload='auto' autoplay='autoplay'><source src='nuclear_alarm.mp3'></audio>";
For your own webpage you can create and edit PHP file. Source code is the first post. ;)
The administrator has disabled public write access.

A simple web page radiation alarm 2 years 8 months ago #918

  • Tocsin_bang
  • Tocsin_bang's Avatar
  • OFFLINE
  • Senior Member
  • Posts: 40
  • Thank you received: 1
  • Karma: 1
On my page, the alarm sounds when the page loads, the same appears to happen on your own page, It happens with Chrome an IE11, and ideas how to prevent that?
The administrator has disabled public write access.

A simple web page radiation alarm 2 years 8 months ago #920

  • OM1AMJ
  • OM1AMJ's Avatar
  • OFFLINE
  • Junior Member
  • Posts: 39
  • Thank you received: 19
  • Karma: 5
Hello.
At the end of the link is a parameter "alarm = 10"
Try to change to a higher number than the current CPM.
This parameter is to set the limit when the alarm is triggered.
Last Edit: 2 years 8 months ago by OM1AMJ.
The administrator has disabled public write access.

A simple web page radiation alarm 7 months 3 weeks ago #3131

  • Electrodemente
  • Electrodemente's Avatar
  • OFFLINE
  • New Member
  • Posts: 12
  • Thank you received: 2
  • Karma: 0
:sick:

Hahahahaha

I hope I don´t get the scary sound you show when Im in bed....


Well done!
Best Regards.

ElectroDemente
The administrator has disabled public write access.
Time to create page: 0.069 seconds
Powered by Kunena Forum