Changeset 188 for dev/common/login.php

Show
Ignore:
Timestamp:
02/17/07 15:24:06 (14 years ago)
Author:
exi
Message:

Changed default td width for options to 160px.
Added the appropiate timeframe to the fast contractlisttable.
Events now can also return a reference to a variable containing additional information.
Killlists now return a non formatted isk-value for losses/kills, please report any errors on other pages.
Added a custom user menu, able to be shownon every page.
Added some code for user logins, please ignore it for now.
Added a small battle statistics frame to the battle overview.
To login as admin now just leave user blank and use the admin password.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/common/login.php

    r92 r188  
    11<?php 
    2 require_once("db.php"); 
    3 require_once("class.page.php"); 
     2require_once('class.page.php'); 
     3require_once('class.user.php'); 
    44 
    5 $page = new Page("Login"); 
     5$page = new Page('Login'); 
    66 
    7 if (trim($_POST['password'])) 
     7if (trim($_POST['usrpass'])) 
    88{ 
    9     if ($_POST['password'] == ADMIN_PASSWORD || $_POST['password'] == SUPERADMIN_PASSWORD) 
     9    if ($_POST['usrlogin'] == '' && $_POST['usrpass'] == ADMIN_PASSWORD) 
    1010    { 
    11         if ($_POST['password'] == SUPERADMIN_PASSWORD) 
     11        $page->session_->create(1); 
     12 
     13        header('Location: ?a=admin'); 
     14    } 
     15    else 
     16    { 
     17        $result = user::login($_POST['usrlogin'], $_POST['usrpass']); 
     18        if ($result) 
    1219        { 
    13             $redir = "admin"; 
    14             $super = 1; 
     20            header('Location: ?a=home'); 
    1521        } 
    1622        else 
    1723        { 
    18             $redir = "admin"; 
    19             $super = 0; 
     24            $smarty->assign('error', 'Login error, please check your username and password.'); 
    2025        } 
    21  
    22         $page->session_->create($super); 
    23  
    24         header("Location: ?a=" . $redir); 
    2526    } 
    26     else 
    27         $html .= "Invalid password.<br><br>"; 
    2827} 
    2928 
    30 $html .= "<form name=login id=login method=post action=?a=login>"; 
    31 $html .= "Admin password: <input name=password id=password type=password>&nbsp;<input type=\"submit\" name=submit id=submit name=Go value=Go>"; 
    32 $html .= "</form>"; 
    33  
    34 $page->setContent($html); 
     29$page->setContent($smarty->fetch(get_tpl('user_login'))); 
    3530$page->generate(); 
    3631?>