diff options
author | Alib <aliboba@free.fr> | 2010-03-23 19:11:03 +0100 |
---|---|---|
committer | Alib <aliboba@free.fr> | 2010-03-23 19:11:03 +0100 |
commit | 80bdf785d7909f4c11ba98f35417f3b8cb44f317 (patch) | |
tree | 70c982c5c138be54cfa5a6cf56cfff174927f722 /bin/auth.php | |
parent | 949ce316278f4a557ca3e442ea31db66b77722b4 (diff) | |
download | istreamdev-80bdf785d7909f4c11ba98f35417f3b8cb44f317.tar.gz istreamdev-80bdf785d7909f4c11ba98f35417f3b8cb44f317.tar.bz2 |
added auth
Diffstat (limited to 'bin/auth.php')
-rw-r--r-- | bin/auth.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/auth.php b/bin/auth.php new file mode 100644 index 0000000..1545b7c --- /dev/null +++ b/bin/auth.php @@ -0,0 +1,36 @@ +<?php + +global $user, $pass; + +session_start(); + +if (isset($_COOKIE['istream'])) +{ + if(sha1($pass) == $_COOKIE['istream'] ) { + setcookie ("istream", sha1($pass), time()+60*60*24*30); + $authorized = true; + } else { + $authorised = false; + } +} + +# 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'])) ) + { + setcookie ("istream", sha1($pass), time()+60*60*24*30); + $authorized = true; + } +} + +# login +if (!$authorized) +{ + header('WWW-Authenticate: Basic Realm="Login please"'); + header('HTTP/1.0 401 Unauthorized'); + echo "Login"; + exit; +} + +?> |