Location: PHPKode > scripts > Authen_DAP > tdap.php
<?php
error_reporting(E_ALL | E_STRICT);

// Set the private include path
$path_delimiter = PHP_OS == 'WINNT' ? ';' : ':';
ini_set('include_path','../..' . $path_delimiter . ini_get('include_path'));


require_once('IPC/SharedMem/File.php');
$shm = new IPC_SharedMem_File('./Authen_DAP.shm');


require_once('Authen/DAP.php');
$dap = new Authen_DAP($shm, 3, 20);


$identity = 'john';
$pwd = 'blow';


// Check if user has been blocked
$blocked_for = $dap->blocked($identity);
if ($blocked_for) {
  print "Sorry, you have performed to many failed login attempts. You can try again after $blocked_for seconds.\n";
  exit;
}


// Attempt a login and record failure if necessary
if (login($identity, $pwd)) { // this is just a fictional method
  $dap->clear($identity); // not necessary in my opinion
  //... etc....
}
else {
  $blocked_for = $dap->record_failed_attempt($identity);
  print 'Login failed!' . ($blocked_for ? " You can try again after $blocked_for seconds.\n" : "\n");
  exit;
}




function login($alias, $pwd) {
  return false;
}

?>
Return current item: Authen_DAP