navigation  interaction  search

 other resources

Changeset 99

Show
Ignore:
Timestamp:
10/13/06 14:30:18
Author:
brieb
Message:

Cleaned login code, started formatting for true xhtml compliance.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phpbms/include/common_functions.php

    r69 r99  
    3939//Most Common Functions of the Application go here. 
    4040//================================================= 
     41 
     42function goURL($url){ 
     43        if(headers_sent()) 
     44                reportError("450","Could not redirect to: ".$url); 
     45        header("Location: ".$url); 
     46        exit; 
     47} 
    4148 
    4249//Create Tabs 
  • trunk/phpbms/index.php

    r77 r99  
    1 <?php include("include/session.php"); 
     1<?php  
    22/* 
    33 +-------------------------------------------------------------------------+ 
     
    3535 +-------------------------------------------------------------------------+ 
    3636*/ 
    37         if (isset($_POST["name"])) { 
    38                 $result = mysql_query("SELECT id,firstname,lastname,accesslevel,email,phone,department,employeenumber from users where login=\"".$_POST["name"]."\" and password=ENCODE(\"".$_POST["password"]."\",\"".$_SESSION["encryption_seed"]."\") and revoked=0 and accesslevel>=10;",$dblink); 
    39                 if (mysql_num_rows($result)){ 
    40                  
    41                         // login passed... set session parameters 
    42                         $_SESSION["userinfo"]= mysql_fetch_array($result); 
    43  
    44                         // set application location (web, not physical) 
    45                         $pathrev=strrev($_SERVER["PHP_SELF"]); 
    46                         $_SESSION["app_path"]=strrev(substr($pathrev,(strpos($pathrev,"/")))); 
    47                                                  
    48                         //next update record's lastlogin time 
    49                         $result = mysql_query("UPDATE users set modifieddate=modifieddate, lastlogin=Now() where id = ".$_SESSION["userinfo"]["id"],$dblink); 
    50                         if  (!$result)die ("update users query failed:".mysql_error($dblink));                   
    51                                                  
    52                         header("Location: ".$_SESSION["default_load_page"]); 
    53                          
    54                         //register table settings 
    55                         session_register("tableparams"); 
    56                 } 
    57                 else 
    58                 { 
    59                         // Login failed... send to index.php with parameter of no we should already be on the index page... so just set 
    60                         // the failed parameter 
    61                         $failed="Login Failed"; 
    62                 }                
    63         } 
    64  
    65  
    66 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    67 <html> 
     37        require_once("include/session.php"); 
     38        require_once("include/common_functions.php"); 
     39        require_once("include/login_include.php"); 
     40?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     41<html xmlns="http://www.w3.org/1999/xhtml"> 
    6842<head> 
    69         <script language="javascript">if(top!=self){top.location=self.location;}</script> 
    7043        <title><?PHP echo $_SESSION["application_name"]; ?> - Login Page</title> 
    7144        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    7245        <link href="common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/base.css" rel="stylesheet" type="text/css" /> 
     46        <link href="common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/login.css" rel="stylesheet" type="text/css" /> 
    7347        <script language="javascript" src="common/javascript/common.js"></script> 
    74         <script language="javascript"> 
    75                 function setMainFocus(){ 
    76                         var focusField=getObjectFromID("username"); 
    77                         focusField.focus();              
    78                 } 
    79         </script> 
     48        <script language="javascript" src="common/javascript/login.js"></script> 
    8049</head> 
    8150 
    82 <body> 
    83 <form name="form1" method="post" action="<?php echo $_SERVER["PHP_SELF"]?>"> 
    84  <div align="center"> 
    85         <div style="width:250px;"> 
    86         <div class="bodyline" style="margin-top:100px;padding:0px;" align="left"> 
    87                 <div align="right"  class="box" style="margin:1px;border-style:none; background-color:white;"><a href="http://kreotek.com/products/phpbms"><img src="common/image/logo.png" width="85" height="22" border="0"></a></div> 
    88                 <h2 style="text-transform:none;margin:4px;"> 
    89                         <?PHP echo $_SESSION["application_name"];?>                      
    90                 <div class=tiny style="padding:0px;">Business Management Web Application</div> 
    91                 </h2> 
    92                  
    93                 <label for="username">name<br /> 
    94         <input name="name" type="text" id="username" size="25" maxlength="64" style="width:97%" /> 
    95                 <script>setMainFocus();</script></label> 
    96                 <label for="password">password<br /> 
    97         <input name="password" type="password" id="password" size="25" maxlength="24" style="width:97%" /></label> 
    98                 <div align=right style="padding-bottom:15px;"><input name="command" type="submit" class="Buttons" value="Log On" style="width:75px;" /></div> 
    99                  
    100                 <?php if (isset($failed)) {?> 
    101                         <div class="standout" align="center"><?php echo $failed?></div> 
    102                     <?php } ?> 
     51<body onload="setMainFocus()"> 
    10352 
    104                 <div class="tiny" align="center">&middot;&nbsp;<a href="requirements.php">browser requirements</a>&nbsp;&middot;&nbsp;<a href="info.php">program info</a> &middot;</div> 
     53        <div class="bodyline" id="loginbox"> 
     54                <h1 class="box"> 
     55                        <a href="http://www.phpbms.org" title="phpBMS"><span class="alt">phpBMS</span></a> 
     56                </h1> 
     57                <h2><?PHP echo $_SESSION["application_name"];?></h2> 
     58                <h3>Business Management Web Application</h3> 
     59                <?php if ($failed) {?><div class="standout" id="failed"><?php echo $failed?></div><?php } ?> 
     60 
     61                <form name="form1" method="post" action="<?php echo $_SERVER["PHP_SELF"]?>"> 
     62                        <p> 
     63                                <label for="username">name</label><br /> 
     64                                <input name="name" type="text" id="username" size="25" maxlength="64" value="<?php echo $_POST["name"]?>"/> 
     65                        </p> 
     66                         
     67                        <p> 
     68                                <label for="password">password</label><br /> 
     69                                <input name="password" type="password" id="password" size="25" maxlength="24"/> 
     70                        </p> 
     71                         
     72                        <p><input id="command" name="command" type="submit" class="Buttons" value="Log On"/></p> 
     73                </form> 
     74         
     75                <p class="tiny" id="moreinfo"> 
     76                        <a href="requirements.php">browser requirements</a> | 
     77                        <a href="info.php">program info</a> 
     78                </p> 
    10579        </div> 
    106         </div> 
    107  </div> 
    108 </form> 
     80 
    10981</body> 
    11082</html> 
Copyright © 2006-2007 Kreotek, LLC. All Rights reserved.