root/dev/mods/apiuser/login.php @ 491

Revision 466, 0.8 KB (checked in by kovell, 11 years ago)

Reverting 464 changes. apiuser mod actually does work for some and is used by other mods.

Line 
1<?php
2$page = new Page('Login');
3//              print_r($_SESSION['user']);
4
5if (trim($_POST['usrpass']))
6{
7 $result = user::login($_POST['usrlogin'], $_POST['usrpass']);
8    if ( $_POST['usrlogin'] == '' &&
9                (crypt($_POST['usrpass'],ADMIN_PASSWORD) == ADMIN_PASSWORD || $_POST['usrpass'] == ADMIN_PASSWORD)
10                || user::role('admin')     )
11    {
12        session::create(true);
13
14        header('Location: ?a=admin');
15    }
16    else
17    {
18
19        if ($result)
20        {
21            header('Location: ?a=home');
22        }
23        else
24        {
25            $smarty->assign('error', 'Login error, please check your username and password.');
26        }
27    }
28}
29
30$page->setContent($smarty->fetch('../mods/apiuser/templates/user_login.tpl'));
31$page->generate();
32?>
Note: See TracBrowser for help on using the browser.