Login   Register  
PHP Classes
elePHPant
Icontem

File: tdap.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Craig Manley  >  Authen_DAP  >  tdap.php  >  Download  
File: tdap.php
Role: Example script
Content type: text/plain
Description: Example/test script for Authen_DAP.
Class: Authen_DAP
Slow down attempts to guess login passwords
Author: By
Last change: checkbox checked.
Date: 9 years ago
Size: 1,094 bytes
 

Contents

Class file image Download
<?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($shm320);


$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;
}

?>