Browse Source

php - add a login failure message

master
kanoi 10 years ago
parent
commit
7283af34e5
  1. 22
      pool/base.php
  2. 4
      pool/page.php
  3. 3
      pool/prime.php

22
pool/base.php

@ -334,7 +334,9 @@ function validUserPass($user, $pass)
$key = 'ckp'.rand(1000000,9999999);
$_SESSION['ckpkey'] = $key;
$_SESSION[$key] = array('who' => $user, 'id' => $user);
return true;
}
return false;
}
#
function logout()
@ -364,6 +366,8 @@ function requestRegister()
#
function tryLogInOut()
{
global $loginfailed;
// If already logged in, it will ignore User/Pass
if (isset($_SESSION['ckpkey']))
{
@ -373,21 +377,29 @@ function tryLogInOut()
}
else
{
$login = getparam('Login', false);
if (nuem($login))
return;
$user = getparam('User', false);
if ($user !== NULL)
$user = loginStr($user);
if (nuem($user))
{
$loginfailed = true;
return;
}
$pass = getparam('Pass', false);
if (nuem($pass))
{
$loginfailed = true;
return;
}
$login = getparam('Login', false);
if (nuem($login))
return;
validUserPass($user, $pass);
$valid = validUserPass($user, $pass);
if (!$valid)
$loginfailed = true;
}
}
#

4
pool/page.php

@ -163,7 +163,7 @@ h1 {margin-top: 20px; float:middle; font-size: 20px;}
#
function pgtop($info, $dotop, $user, $douser)
{
global $site_title;
global $site_title, $loginfailed;
$phr = '?THs';
$plb = '?';
@ -288,6 +288,8 @@ function pgtop($info, $dotop, $user, $douser)
$top .= " You need to enable javascript to use";
$top .= " the $site_title web site.</div>";
if ($loginfailed === true)
$top .= '<div class=accwarn>Login Failed</div>';
if (isset($info['u_nopayaddr']))
$top .= '<div class=accwarn>Please set a payout address on your account!</div>';
if (isset($info['u_noemail']))

3
pool/prime.php

@ -3,6 +3,9 @@
global $stt;
$stt = microtime();
#
global $loginfailed;
$loginfailed = false;
#
include_once('param.php');
include_once('base.php');
#

Loading…
Cancel
Save