inc/auth.inc.php
changeset 79 0c0aa144356a
parent 71 e1b918eaf69a
child 82 c255196bc447
equal deleted inserted replaced
78:effde559e0e9 79:0c0aa144356a
    17  *
    17  *
    18  *  You should have received a copy of the GNU General Public License
    18  *  You should have received a copy of the GNU General Public License
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20  */
    20  */
    21 
    21 
    22 session_start();
    22 //session_start();
    23 
    23 
    24 if (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] == "logout")
    24 if (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] == "logout")
    25 {
    25 {
    26 	logout();
    26 	logout();
    27 }
    27 }
    50 	{
    50 	{
    51         	$rowObj = $result->fetchRow();
    51         	$rowObj = $result->fetchRow();
    52 		$_SESSION["userid"] = $rowObj["id"];
    52 		$_SESSION["userid"] = $rowObj["id"];
    53 		$_SESSION["name"] = $rowObj["fullname"];
    53 		$_SESSION["name"] = $rowObj["fullname"];
    54 		$_SESSION["level"] = $rowObj["level"];
    54 		$_SESSION["level"] = $rowObj["level"];
    55         	if($_POST["authenticate"])
    55         	if(isset($_POST["authenticate"]))
    56         	{
    56         	{
    57             		//If a user has just authenticated, redirect him to index with timestamp, so post-data gets lost.
    57             		//If a user has just authenticated, redirect him to index with timestamp, so post-data gets lost.
    58             		session_write_close();
    58             		session_write_close();
    59             		clean_page("index.php");
    59             		clean_page("index.php");
    60             		exit;
    60             		exit;
   115  * Logout the user and kickback to login form.
   115  * Logout the user and kickback to login form.
   116  */
   116  */
   117 
   117 
   118 function logout($msg="")
   118 function logout($msg="")
   119 {
   119 {
       
   120 	$type = '';
   120 	if ( $msg == "" ) {
   121 	if ( $msg == "" ) {
   121 		$msg = _('You have logged out.');
   122 		$msg = _('You have logged out.');
   122 		$type = "success";
   123 		$type = "success";
   123 	};
   124 	};
   124 	unset($_SESSION["userid"]);
   125 	unset($_SESSION["userid"]);