source: trunk/services/login.php @ 295

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

Q - updated usage of $nav.

File size: 1.4 KB
RevLine 
[1]1<?php
2/**
[42]3 * login.php
[1]4 * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information
5 */
6
[28]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.
[20]9if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) {
[136]10    $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'login');
[1]11}
[136]12$app->sslOn();
[1]13
14$frm['username'] = getFormdata('username');
15$frm['password'] = getFormdata('password');
16
17if (getFormdata('username', false)) {
[103]18    // Form has been submitted, check if the user login information is correct.
[1]19
20    if ($auth->login($frm['username'], $frm['password'])) {
[136]21        $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__);
22        $app->dieBoomerangURL('login');
[202]23        $app->logMsg(sprintf('User %s successfully logged-in.', $frm['username']), LOG_INFO, __FILE__, __LINE__);
[1]24    } else {
[136]25        $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
[202]26        $app->logMsg(sprintf('User %s failed login using (MD5ed) password: %s', $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
[1]27    }
28}
29
30// Titles and navigation header.
[202]31$nav->add(_("Login"));
[1]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.