summaryrefslogtreecommitdiff
path: root/includes/inc_auth.php
diff options
context:
space:
mode:
authorroot <root@mediaserver.Belkin>2010-02-17 23:14:37 +0100
committerroot <root@mediaserver.Belkin>2010-02-17 23:14:37 +0100
commitf27608f2695d51f563adb6ebc8c475c6a8df53ba (patch)
treec1a909a310b10f267221029e3ba50462dbd3a63f /includes/inc_auth.php
downloadistreamdev-f27608f2695d51f563adb6ebc8c475c6a8df53ba.tar.gz
istreamdev-f27608f2695d51f563adb6ebc8c475c6a8df53ba.tar.bz2
0.3.5-dev
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;
+}
+
+?>