r69: Removing our nasty iff() function in place of the beautiful ternary operator
[bugdar.git] / admin / global.php
1 <?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 \*=====================================================================*/
12
13 chdir('./../');
14
15 require_once('./includes/init.php');
16 require_once('./includes/functions.php');
17
18 require_once('./includes/adminfunctions.php');
19 $admin = new Admin_Print_Class();
20
21 // ###################################################################
22
23 function admin_login()
24 {
25 global $admin, $bugsys;
26
27 $admin->page_start('Login', '', 15, '', 'document.cplogin.' . (($bugsys->userinfo['email']) ? 'password' : 'email') . '.focus();');
28
29 $admin->form_start('../login.php', 'cplogin', false, 'cplogin');
30 $admin->table_start(true, '425');
31 $admin->table_head(phrase('renapsus_login'));
32 $admin->row_input(phrase('email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle');
33 $admin->row_input(phrase('password'), 'password', '', 2, 35, false, true, 'middle');
34 $admin->row_submit('', phrase('login'));
35 $admin->table_end();
36 $admin->form_end();
37
38 $admin->page_end();
39 }
40
41 // ###################################################################
42
43 if ($_COOKIE[COOKIE_PREFIX . 'adminsession'])
44 {
45 if (can_perform('canadminpanel'))
46 {
47 if (md5(md5($bugsys->userinfo['authkey']) . md5($bugsys->userinfo['email']) . md5($bugsys->userinfo['userid'])) != $_COOKIE[COOKIE_PREFIX . 'adminsession'])
48 {
49 mysetcookie(COOKIE_PREFIX . 'adminsession', '');
50 $admin->error(phrase('invalid_admin_session_terminated'));
51 }
52 }
53 else
54 {
55 mysetcookie(COOKIE_PREFIX . 'adminsession', '');
56 admin_login();
57 }
58 }
59
60 if (!$_COOKIE[COOKIE_PREFIX . 'adminsession'])
61 {
62 admin_login();
63 }
64
65 /*=====================================================================*\
66 || ###################################################################
67 || # $HeadURL$
68 || # $Id$
69 || ###################################################################
70 \*=====================================================================*/
71 ?>