diff options
author | root <root@mediaserver.Belkin> | 2010-02-17 23:14:37 +0100 |
---|---|---|
committer | root <root@mediaserver.Belkin> | 2010-02-17 23:14:37 +0100 |
commit | f27608f2695d51f563adb6ebc8c475c6a8df53ba (patch) | |
tree | c1a909a310b10f267221029e3ba50462dbd3a63f /includes/inc_auth.php | |
download | istreamdev-f27608f2695d51f563adb6ebc8c475c6a8df53ba.tar.gz istreamdev-f27608f2695d51f563adb6ebc8c475c6a8df53ba.tar.bz2 |
0.3.5-dev
Diffstat (limited to 'includes/inc_auth.php')
-rwxr-xr-x | includes/inc_auth.php | 32 |
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; +} + +?> |