source: trunk/services/login.php @ 202

Last change on this file since 202 was 202, checked in by scdev, 18 years ago

Q - updated usage of $nav.

File size: 1.4 KB
Line 
1<?php
2/**
3 * login.php
4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
5 */
6
7// We may want to use the add/edit interface from another script, so this
8// allows us to remember which page we came from so we can go back there.
9if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {
10    $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'login');
11}
12$app->sslOn();
13
14$frm['username'] = getFormdata('username');
15$frm['password'] = getFormdata('password');
16
17if (getFormdata('username', false)) {
18    // Form has been submitted, check if the user login information is correct.
19
20    if ($auth->login($frm['username'], $frm['password'])) {
21        $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__);
22        $app->dieBoomerangURL('login');
23        $app->logMsg(sprintf('User %s successfully logged-in.', $frm['username']), LOG_INFO, __FILE__, __LINE__);
24    } else {
25        $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
26        $app->logMsg(sprintf('User %s failed login using (MD5ed) password: %s', $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
27    }
28}
29
30// Titles and navigation header.
31$nav->add(_("Login"));
32
33// Templates.
34include 'header.ihtml';
35include 'codebase/services/templates/login_form.ihtml';
36include 'footer.ihtml';
37
38?>
Note: See TracBrowser for help on using the repository browser.