]>
src.bluestatic.org Git - bugdar.git/blob - login.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
17 require_once('./global.php');
19 // ###################################################################
21 if ($bugsys->userinfo
['userid'] AND $_REQUEST['do'] != 'logout' AND $_POST['do'] != 'cplogin')
23 echo 'You are already logged in.';
27 // ###################################################################
29 if (empty($_REQUEST['do']))
31 eval('$template->flush("' . $template->fetch('login') . '");');
34 // ###################################################################
36 if ($_POST['do'] == 'login' OR $_POST['do'] == 'cplogin')
38 $rememberme = intval($bugsys->in
['rememberme']);
39 if ($_POST['cplogin'])
44 if ($_SERVER['HTTP_REFERER'] AND !$_POST['goindex'])
46 $url = $_SERVER['HTTP_REFERER'];
53 $userinfo = $db->query_first("SELECT * FROM user WHERE email = '" . $bugsys->in
['email'] . "'");
54 if (md5(md5($bugsys->in
['password']) . md5($userinfo['salt'])) == $userinfo['password'])
56 $funct->cookie(COOKIE_PREFIX
. 'userid', $userinfo['userid'], $rememberme);
57 $funct->cookie(COOKIE_PREFIX
. 'authkey', $userinfo['authkey'], $rememberme);
61 $funct->cookie(COOKIE_PREFIX
. 'userid');
62 $funct->cookie(COOKIE_PREFIX
. 'authkey');
63 echo 'Invalid email or password.';
67 if ($_POST['do'] == 'cplogin')
69 $funct->cookie(COOKIE_PREFIX
. 'adminsession', md5(md5($userinfo['authkey']) . md5($userinfo['email']) . md5($userinfo['userid'])), false);
72 echo 'You are now logged in :-)';
74 header("Location: $url");
77 // ###################################################################
79 if ($_REQUEST['do'] == 'logout')
81 if ($bugsys->userinfo['userid'])
83 $funct->cookie(COOKIE_PREFIX . 'userid');
84 mysetcookie(COOKIE_PREFIX . 'authkey');
88 echo 'You need to be logged in!';
92 /*=====================================================================*\
93 || ###################################################################
96 || ###################################################################
97 \*=====================================================================*/