I have a bug but everything works great otherwise.
The dialog 'Confirm Form Resubmission' pops up every time the refresh happens. I use a javascript refresh which works without bugs in Chrome, but when I manual refresh I get that dialog. With firefox I need to resend no matter what. The refresh is unavoidable as it is my way to poll a text file that's updated by another computer every minute.
What can I do, to get rid of that dialog?
Here is my php variable
<?php
$password = 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d';
session_start();
if (!isset($_SESSION['loggedIn'])) {
$_SESSION['loggedIn'] = false;
}
if (isset($_POST['password'])) {
if (sha1($_POST['password']) == $password) {
$_SESSION['loggedIn'] = true;
} else {
die ('Incorrect password');
}
}
if (!$_SESSION['loggedIn']):
?>
<html><head><title>Login</title>
<style>
#formenclosure {
width: 300px;
height:300px;
margin-top:50px;
margin-left:auto;
margin-right:auto;
color:fff;
}
</style>
</head>
<body>
<div id="formenclosure">
<fieldset>
<legend>You need to login</legend>
<form method="post">
Password: <input type="password" name="password"> <br />
<input type="submit" name="submit" value="Login">
</form>
</fieldset>
</div>
</body>
</html>
<?php
exit();
endif;
?>
here is my refresh code and the require that goes on top of all the documents that you need protected.
<?php
require('access.php');
?>
<script>
function refresh() {
setInterval(function () {
location.reload(true)
}, 60000); // reload page every 60 seconds
}
</script>