Source for file Html.php
Documentation is available at Html.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Martin Jansen <mj@php.net> |
// +----------------------------------------------------------------------+
// $Id: Html.php,v 1.7 2006/02/28 05:11:39 aashley Exp $
* Standard Html Login form
* @author Yavor Shahpasov <yavo@netsmart.com.cy>
* @author Adam Ashley <aashley@php.net>
* @version $Revision: 1.7 $
* Displays the login form
* @param object The calling auth instance
* @param string The previously used username
function render(&$caller, $username = '') {
$loginOnClick = 'return true;';
// Try To Use Challene response
// TODO javascript might need some improvement for work on other browsers
if($caller->advancedsecurity && $caller->storage ->supportsChallengeResponse () ) {
// Init the secret cookie
print '<script language="JavaScript">'. "\n";
include 'Auth/Frontend/md5.js';
print ' function securePassword() { '. "\n";
print ' var pass = document.getElementById(\''. $caller->getPostPasswordField (). '\');'. "\n";
print ' var secret = document.getElementById(\'authsecret\')'. "\n";
//print ' alert(pass);alert(secret); '."\n";
// If using md5 for password storage md5 the password before
// we hash it with the secret
// print ' alert(pass.value);';
if ($caller->storage ->getCryptType () == 'md5' ) {
print ' pass.value = hex_md5(pass.value); '. "\n";
#print ' alert(pass.value);';
print ' pass.value = hex_md5(pass.value+\''. $caller->session ['loginchallenege']. '\'); '. "\n";
// print ' alert(pass.value);';
print ' secret.value = 1;'. "\n";
print ' var doLogin = document.getElementById(\'doLogin\')'. "\n";
print ' doLogin.disabled = true;'. "\n";
$loginOnClick = ' return securePassword(); ';
if (!empty ($caller->status ) && $caller->status == AUTH_EXPIRED) {
$status = '<i>Your session has expired. Please login again!</i>'. "\n";
} else if (!empty ($caller->status ) && $caller->status == AUTH_IDLED) {
$status = '<i>You have been idle for too long. Please login again!</i>'. "\n";
$status = '<i>Wrong login data!</i>'. "\n";
$status = '<i>Security problem detected. </i>'. "\n";
print '<form method="post" action="'. $caller->server ['PHP_SELF']. '" '
. 'onSubmit="'. $loginOnClick. '">'. "\n";
print '<table border="0" cellpadding="2" cellspacing="0" '
. 'summary="login form" align="center" >'. "\n";
print ' <td colspan="2" bgcolor="#eeeeee"><strong>Login </strong>'
print ' <td>Username:</td>'. "\n";
print ' <td><input type="text" id="'. $caller->getPostUsernameField ()
. '" name="'. $caller->getPostUsernameField (). '" value="' . $username
print ' <td>Password:</td>'. "\n";
print ' <td><input type="password" id="'. $caller->getPostPasswordField ()
. '" name="'. $caller->getPostPasswordField (). '" /></td>'. "\n";
//onClick=" '.$loginOnClick.' "
print ' <td colspan="2" bgcolor="#eeeeee"><input value="Login" '
. 'id="doLogin" name="doLogin" type="submit" /></td>'. "\n";
// Might be a good idea to make the variable name variable
print '<input type="hidden" id="authsecret" name="authsecret" value="" />';
Documentation generated on Mon, 11 Mar 2019 14:37:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|