summaryrefslogtreecommitdiff
path: root/includes/inc_auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/inc_auth.php')
-rwxr-xr-xincludes/inc_auth.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/includes/inc_auth.php b/includes/inc_auth.php
new file mode 100755
index 0000000..92f0fc8
--- /dev/null
+++ b/includes/inc_auth.php
@@ -0,0 +1,32 @@
+<?php
+
+global $user, $pass;
+
+session_start();
+
+if (isset($_COOKIE['istream']))
+{
+ $authorized=true;
+}
+
+# checkup login and password
+if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']))
+{
+ if (($user == $_SERVER['PHP_AUTH_USER']) && ($pass == ($_SERVER['PHP_AUTH_PW'])) && isset($_SESSION['auth']))
+ {
+ $authorized = true;
+ setcookie ("istream", "true", time()+60*60*24*30);
+ }
+}
+
+# login
+if (!$authorized)
+{
+ header('WWW-Authenticate: Basic Realm="Login please"');
+ header('HTTP/1.0 401 Unauthorized');
+ $_SESSION['auth'] = true;
+ echo "Login";
+ exit;
+}
+
+?>