Changeset 1255

Show
Ignore:
Timestamp:
11/15/06 13:19:50 (2 years ago)
Author:
jm3
Message:

formatting cleanup and handling for failed logins working

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • brains/blapi.php

    r1254 r1255  
    1111    } 
    1212 
     13    function bounce_out( $m ) { 
     14      $m = urlencode( $m ); 
     15?> 
     16  <meta http-equiv="refresh" content="0; URL=/login?message=$m" /> 
     17<?php 
     18    } 
     19 
    1320    function authenticate( $u, $p ) { 
    14     $login_url = $this->domain . "/login?submission=credentials&login=$u&password=$p"; 
     21      $login_url = $this->domain . "/login?submission=credentials&login=$u&password=$p"; 
    1522      $response = $this->xform( "transforms/authenticate.xsl", $login_url ); 
    1623      $authid = $response[0]; 
    17       if( $authid && $authid != "INVALID:credentials" ) { 
     24 
     25      if( $authid && ! ( 
     26               stristr( $authid, "MANDATORY" )  
     27            || stristr( $authid, "WRONGLENGTH" )  
     28            || stristr( $authid, "UNICITY" )  
     29            || stristr( $authid, "MANDATORY" )  
     30            || stristr( $authid, "WRONGLENGTH" )  
     31            || stristr( $authid, "INVALID" )  
     32          ) 
     33      ) { 
    1834        $this->authid = $authid; 
    1935        setCookie( 'user',   $u, time()+60*60*24*69, '/' ); 
     
    2440      } else { 
    2541?> 
    26   <meta http-equiv="refresh" content="0; URL=/login" /> 
     42  <meta http-equiv="refresh" content="0; URL=/login?message=Sorry,+we+were+not+able+to+log+you+in+with+that+user+and+password." /> 
    2743<?php 
    2844      } 
  • brains/index.php

    r1254 r1255  
    6262  } else { 
    6363    if( $show_html ) { 
     64    std_header(); 
    6465?> 
    65 <html> 
    66   <head> 
    67     <title> 
    68       brains.jm3.net 
    69     </title> 
    70  
    71     <script type="text/javascript" src="/brains.js"></script> 
    72     <link rel="stylesheet" type="text/css" href="/stylesheet.css"> 
    73  
    74   </head> 
    7566 
    7667  <body onLoad="focus_page();"> 
     
    9081      </label> 
    9182    </form> 
    92      
    93     <?php if( $REQUEST_URI != "/" ) { ?> 
    94     <a href="/">View all my lists</a> 
    95     <?php } ?> 
    9683 
    97   </body> 
    98 </html> 
    9984<?php  
     85 
    10086    } 
    10187  } 
  • brains/login.php

    r1254 r1255  
    11<?php 
    22  include( "blapi.php" ); 
     3  include( "util.php" ); 
    34 
    45  $bla = new Blapi(); 
     
    1415 
    1516  if( $show_html ) { 
     17    $message = $message ? $message : "Welcome, please log in:"; 
     18    std_header(); 
    1619?> 
    1720 
     21<body> 
     22 
    1823<h2><a href="/">BRAINS</a></h2> 
    19  
    20 <?php if( ! $message ) { ?> 
    21 <h3>Welcome, please log in:</h3> 
    22 <?php } else { ?> 
    2324<h3><?= $message ?></h3> 
    24 <?php } ?> 
    2525 
    2626<form name="login" action="/login" method="post"> 
    2727  <label> 
    28     Username 
     28    User: 
    2929    <input name="user" value="<?= $user ?>" /> 
    3030  </label> 
    3131  <br /> 
    3232  <label> 
    33     Password 
     33    Password: 
    3434    <input type="password" name="password" /> 
    3535  </label> 
     
    3737</form> 
    3838 
    39 <? } ?> 
     39<div class="note"> 
     40Brains is powered by the magic of something called Blabla Lists.<br> 
     41To use Brains, you only need to <a target="blank" href="http://blablalist.com/mylist?registerfirst=1">get a user name and password</a>. 
     42</div> 
     43 
     44 
     45<?   
     46    std_footer(); 
     47 
     48} ?> 
  • brains/stylesheet.css

    r1216 r1255  
    1212} 
    1313 
     14.note { 
     15  border: 1px solid white; 
     16  background-color: #ededed; 
     17  width: 30em; 
     18  padding: 1.0em; 
     19  margin: 0.5em; 
     20} 
     21 
     22#footer { 
     23  font-size: 80%; 
     24} 
     25 
    1426/* liquid bag dots */ 
    1527.size-1 { background: url(/img/dots/1.gif) 0 3px no-repeat; } 
  • brains/util.php

    r1211 r1255  
    1 <% 
    2         function page( $s ) { 
    3 %> 
     1<?php 
    42 
    5 <%= $s %> 
     3function std_header( $title = "brains.jm3.net" ) { 
     4?> 
     5<html> 
     6  <head> 
     7    <title> <?= $title ?> </title> 
     8    <script type="text/javascript" src="/brains.js"></script> 
     9    <link rel="stylesheet" type="text/css" href="/stylesheet.css"> 
     10</head> 
     11<?php 
     12  } 
    613 
    7 <% 
    8         } 
    9 %> 
     14  function std_footer() { 
     15?> 
     16     
     17    <?php if( $_COOKIE["authid"] && $REQUEST_URI != "/" ) { ?> 
     18    <a href="/">View all my lists</a> 
     19    <?php } ?> 
     20 
     21    <div id="footer"> 
     22      Brains is a Codeswami / JM3, LLC creation 
     23    </div> 
     24 
     25  </body> 
     26</html> 
     27<?php 
     28
     29 
     30?>