Simple Multi User Managed Directory 0.00063
SMUMD
source/install/secure/session-login.php
gehe zur Dokumentation dieser Datei
00001 <?php
00002 /*! \brief Session Login
00003  *      Simple Multi User Managed Directory
00004  *      by Sascha Heinatz * sascha.heinatz@alice.de
00005  *      Copyright 2011. 
00006  * 
00007  *      This file is part of Simple Multi User Managed Directory - SMUMD.
00008  *      
00009  *      Simple Multi User Managed Directory - SMUMD 
00010  *      is free software: you can redistribute it and/or modify
00011  *      it under the terms of the GNU Lesser General Public License as published by
00012  *      the Free Software Foundation, either version 3 of the License, or
00013  *      (at your option) any later version.
00014  *      
00015  *      Simple Multi User Managed Directory - SMUMD 
00016  *      is distributed in the hope that it will be useful,
00017  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *      GNU Lesser General Public License for more details.
00020  *      
00021  *      You should have received a copy of the GNU Lesser General Public License
00022  *      along with Simple Multi User Managed Directory - SMUMD.  
00023  *      If not, see <http://www.gnu.org/licenses/>.
00024  *      <hr>
00025  */
00026 /*! set cookie */
00027 session_set_cookie_params((60*60*24*31), '/'.$INSTALL_DIR.'/');
00028 /*! set session name user $SIDname */
00029 session_name($SIDname);
00030 /*! start the session on the server */
00031 session_start();
00032 /*! get this session id */
00033 $sid = session_id();
00034 /*! if no username check for login POST datas, and login */
00035 if (!isset($_SESSION["username"])) {
00036         /*! check POST for username and userpass */
00037         if(isset($_POST["username"] ) AND isset($_POST["userpass"] ) ) {
00038                 /*! check user login file */
00039                 checkuserlogin($_POST["username"],$_POST["userpass"]);
00040                 /*! is a user */
00041                 if ($used["userlevel"] > 99 ) {
00042                         /*! set session username */
00043                         $_SESSION["username"] = $used["username"];
00044                         /*! set session userlevel */
00045                         $_SESSION["userlevel"] = $used["userlevel"];
00046                 }
00047         } 
00048 /*! no username in session */
00049 } else {
00050         /*! set username from session */
00051         $used["username"] = $_SESSION["username"];
00052         /*! set username from session */
00053         $used["userlevel"] = $_SESSION["userlevel"];
00054 }
00055 
00056 /*! if no coockie we need some input and url stuff for manualy transfer ID */
00057 if (!isset($_COOKIE[session_name()])) {
00058         /*! build sid input field for forms */
00059         $used["sidfield"] = "<input name=\"".session_name()."\" type=\"hidden\" value=\"".$sid."\" />";
00060         /*! build url parameter string */
00061         $used["sidurl"] = session_name()."=".$sid."&amp;";
00062 }
00063 ?>