2 /*=====================================================================*\
3 || ################################################################### ||
4 || # [#]app[#] [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 require_once('./global.php');
15 // ###################################################################
17 if ($bugsys->userinfo
['userid'] AND $_REQUEST['do'] != 'logout' AND $_POST['do'] != 'cplogin')
19 echo 'You are already logged in.';
23 // ###################################################################
25 if (empty($_REQUEST['do']))
28 <form action
="login.php" name
="register" method
="post">
29 <input type
="hidden" name
="do" value
="login" />
30 <input type
="hidden" name
="goindex" value
="1" />
31 Email
: <input type
="text" name
="email" size
="30" /><br
/>
32 Password
: <input type
="password" name
="password" size
="30" /><br
/>
33 Remember Me
: <input type
="checkbox" name
="rememberme" value
="1" checked
="checked" /> Yes
<br
/>
34 <input type
="submit" name
="submit" value
="Login" accesskey
="s" /> <input type
="reset" name
="reset" value
="Reset" accesskey
="r" />
39 // ###################################################################
41 if ($_POST['do'] == 'login' OR $_POST['do'] == 'cplogin')
43 sanitize(array('email' => STR_NOHTML
, 'password' => STR
, 'rememberme' => INT));
45 if ($_POST['cplogin'])
47 $vars['rememberme'] = 1;
50 if ($_POST['goindex'])
52 $_SERVER['HTTP_REFERER'] = '';
55 if ($_SERVER['HTTP_REFERER'])
57 $url = $_SERVER['HTTP_REFERER'];
64 $userinfo = $DB_sql->query_first("SELECT * FROM user WHERE email = '" . addslasheslike($vars['email']) . "'");
65 if (md5(md5($vars['password']) . md5($userinfo['salt'])) == $userinfo['password'])
67 mysetcookie(COOKIE_PREFIX
. 'userid', $userinfo['userid'], $vars['rememberme']);
68 mysetcookie(COOKIE_PREFIX
. 'authkey', $userinfo['authkey'], $vars['rememberme']);
72 mysetcookie(COOKIE_PREFIX
. 'userid');
73 mysetcookie(COOKIE_PREFIX
. 'authkey');
74 echo 'Invalid email or password.';
78 if ($_POST['do'] == 'cplogin')
80 mysetcookie(COOKIE_PREFIX
. 'adminsession', md5(md5($userinfo['authkey']) . md5($userinfo['email']) . md5($userinfo['userid'])));
83 echo 'You are now logged in :-)';
85 header("Location: $url");
88 // ###################################################################
90 if ($_REQUEST['do'] == 'logout')
92 if ($bugsys->userinfo
['userid'])
94 mysetcookie(COOKIE_PREFIX
. 'userid');
95 mysetcookie(COOKIE_PREFIX
. 'authkey');
99 echo 'You need to be logged in!';
103 /*=====================================================================*\
104 || ###################################################################
107 || ###################################################################
108 \*=====================================================================*/