Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sign out button #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ For this site to be secure you **MUST** use `https`. If not, your credentials wi

## change log

### 1.3.1
Add sign out button to auth page

### 1.2.2
Delete unused files, generally tidy things up

### 1.2.1
Files tidied up.

Expand Down
22 changes: 21 additions & 1 deletion auth/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<?php $cam = 1;

function logout()
{
setcookie("auth", "goAway", 1);
header('Location: ../?signOut=1');
}

if(array_key_exists('test',$_POST)){
logout();
}

$config = include(dirname(__DIR__, 1)."/setup/config.php");
if ( ( isset($_COOKIE['auth']) ) && ( $_COOKIE['auth'] == $config['auth'] )){
echo <<<CAMERA
Expand Down Expand Up @@ -164,6 +175,12 @@ function load_${cam}()

</div> </div>
<!-- Footer -->
<center>
<form method="post">
<input type="submit" name="test" id="test" value="Sign Out" /><br/>
</form>

</center>
<footer class="w3-container w3-dark-grey w3-padding-32 w3-margin-top">
<p>Made by <b>Oliver Hynds</b>, <b>Robert Bradshaw</b> and <b>Ben Griffiths</b></p>
</footer>
Expand All @@ -175,6 +192,9 @@ function load_${cam}()


} else {
header("Location:". $config['site_url']);
header("Location: ../");
};
?>



6 changes: 5 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!DOCTYPE html>
<html>

<?php
if (isset($_GET["signOut"])) { setcookie("auth", "Signed out", 1); }
?>

<head>
<title>Remote Viewer</title>
<meta charset="UTF-8">
Expand Down Expand Up @@ -50,7 +54,7 @@
<br><br>
<p>
<?php
$config = include("setup/config.php");https://remotehound.ddns.net/auth/
$config = include("setup/config.php");
if (isset($_POST["username"]) && isset($_POST["password"])){
if ($_POST["username"] == $config['username'] && $_POST["password"] == $config['password']){
if ($config["use_recaptcha"] == "True") {
Expand Down