source: trunk/services/login.php @ 189

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

Q - Change Auth_SQL::getVal to Auth_SQL::get and Auth_SQL::setVal to Auth_SQL::set.

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');
[147]23        $app->logMsg(sprintf('%s %s successfully logged-in.', $auth->get('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__);
[1]24    } else {
[136]25        $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__);
[147]26        $app->logMsg(sprintf('%s %s failed login using (MD5ed) password: %s', ucfirst($auth->get('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);
[1]27    }
28}
29
30// Titles and navigation header.
31$nav->addPage(_("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.