[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15325 - gauger/web
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15325 - gauger/web |
Date: |
Fri, 27 May 2011 05:39:28 +0200 |
Author: bartpolot
Date: 2011-05-27 05:39:28 +0200 (Fri, 27 May 2011)
New Revision: 15325
Added:
gauger/web/registration
gauger/web/template_reg.php
Log:
Added missing files
Added: gauger/web/registration
===================================================================
--- gauger/web/registration (rev 0)
+++ gauger/web/registration 2011-05-27 03:39:28 UTC (rev 15325)
@@ -0,0 +1,48 @@
+<?php
+
+include "helper.php";
+
+switch($_SERVER['REQUEST_METHOD']) {
+ case 'GET':
+ include "params.php"; // Manage all parameters given by the user
+ include "io.php"; // Gather all existing hosts and counters
+ init_params();
+ explore();
+ $mode = "reg";
+ include "template.php"; // Display info
+ break;
+ case 'POST':
+ include "params.php";
+ include "io.php";
+ init_params();
+ $user = @$_POST['user'];
+ if (!$user) {
+ unset($_SESSION['gauger_host']);
+ setcookie('gauger_host', $user, time()-3600, '/');
+ setcookie('gauger_url', $user, time()-3600, '/');
+ header("Location: " . $_SERVER["REQUEST_URI"]);
+ die();
+ }
+ $pass = @$_POST['pass'];
+ $time = @$_POST['time'] == "session" ? 0 : -1;
+ $url = @$_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
+ $url .= $_SERVER['SERVER_NAME'] . url("");
+
+ if (check_login($user, $pass)) {
+ $_SESSION['gauger_host'] = $user;
+ setcookie('gauger_host', $user, $time, '/');
+ setcookie('gauger_url', $url, $time, '/');
+ header("Location: " . $_SERVER["REQUEST_URI"]);
+ die("");
+ } else {
+ $_SESSION['gauger_login_failed'] = 1;
+ header("Location: " . $_SERVER["REQUEST_URI"]);
+ die("");
+ }
+ break;
+ case 'PUT':
+ case 'DELETE':
+ default:
+ echo "method is not allowed";
+ die();
+}
\ No newline at end of file
Added: gauger/web/template_reg.php
===================================================================
--- gauger/web/template_reg.php (rev 0)
+++ gauger/web/template_reg.php 2011-05-27 03:39:28 UTC (rev 15325)
@@ -0,0 +1,52 @@
+<?php
+/** template_reg.php
+
+ This file is part of gauger.
+ Copyright 2011 Bartlomiej Polot
+
+ gauger is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ gauger is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with gauger. If not, see <http://www.gnu.org/licenses/>.
+
+*/?>
+<div id="registration">
+ <?php if (!array_key_exists('gauger_host', $_SESSION)): ?>
+ <div class="title">
+ <h1>Register your browser with gauger</h1>
+ </div>
+ <?php if (array_key_exists('gauger_login_failed', $_SESSION)): ?>
+ <?php unset($_SESSION['gauger_login_failed']) ?>
+ <h2>Login incorrect. Please check you username and password and try
again</h2>
+ <?php endif; ?>
+ <p>After registering your browser with gauger, a cookie will be stored in
your browser
+ that will allow you to use the JavaScript binding to log data to this
installation
+ of gauger without the need to provide the url, username or password in
each call to
+ GAUGER(). This simplifies the usage and maintenance of the code
involved.</p>
+ <form action="registration" method="POST" >
+ <label for="name">Username:</label><br />
+ <input name="user" id="user" /><br />
+ <label for="pass">Password:</label><br />
+ <input name="pass" id="pass" type="password" /><br />
+ <input type="radio" name="time" id="session" value="session" checked />
+ <label for="session">Just this session</label><br />
+ <input type="radio" name="time" id="forever" value="forever" />
+ <label for="forever">Forever</label><br />
+ <br />
+ <input type="submit" value="Register">
+ </form>
+<?php else: ?>
+ <h1>This browser is registered with gauger as host "<?php echo
$_SESSION['gauger_host'] ?>" </h1>
+ <form action="registration" method="POST" >
+ <input type="submit" value="Unregister">
+ </form>
+<?php endif; ?>
+</div>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15325 - gauger/web,
gnunet <=