PHP code example of orglman / fundamental

1. Go to this page and download the library: Download orglman/fundamental library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

orglman / fundamental example snippets


if((isset($_SERVER["SCRIPT_FILENAME"]))&&(basename(__FILE__)==basename($_SERVER["SCRIPT_FILENAME"]))){header($_SERVER['SERVER_PROTOCOL'].' 401 Unauthorized',true,401);header('Status: '.'401 Unauthorized');header('Retry-After: 86400');die('<h1>401 Unauthorized</h1>');}
if(get_

$functions        = new \orgelman\fundamental\scripts\functions($root = null, $start = microtime(true));
echo $functions->timeElapsed();

$functions        = new \orgelman\fundamental\scripts\functions();
echo $functions->obfuscate_email('[email protected]');
echo $functions->botTrap('[email protected]');

$functions        = new \orgelman\fundamental\scripts\functions();
print_r($functions->get_client());
echo $functions->get_client_ua();
echo $functions->get_client_ip();

$str              = 'message';
$encrypt          = new orgelman\fundamental\security\encrypt($compress = 'true','sha256');
$encrypted        = $encrypt->encrypt($str, $key, $method = '')['encrypted'];

$decrypted        = $encrypt->decrypt($encrypted, $key, $method = '')['decrypted'];

$hash             = new orgelman\fundamental\security\hash($compress = 'true');
$password         = 'password';

$hash->setPasswordLenghtMin($num);
$hash->setPasswordLenghtMax($num);
$hash->setPasswordNumber($num);
$hash->setPasswordLetter($num);
$hash->setPasswordCapital($num);
$hash->setPasswordSymbol($num);

$test = $hash->test($password);
if($test!=true) {
   echo '<ul>';
   foreach(test as $error) {
      echo '<li>'.$error.'</li>';
   }
   echo '</ul>';
}

$password         = 'password';
$hash             = new orgelman\fundamental\security\hash($compress = 'true');
$hash->setPasswordLenghtMin($num); // Password minimum lenght
$hash->setPasswordLenghtMax($num); // Password maximum lenght
$hash->setPasswordNumber($num); // How many numbers the password must contain
$hash->setPasswordLetter($num); // How many letters the password must contain
$hash->setPasswordCapital($num); // How many CAPS the password must contain
$hash->setPasswordSymbol($num); // How many symbols the password must contain
$hash->setPasswordStrength($num); // How strong the password must be (0-4)

$hashedPass       = $hash->generate($password);
if(!is_string($hashedPass)) {
   echo '<ul>';
   foreach(hashedPass as $error) {
      echo '<li>'.$error.'</li>';
   }
   echo '</ul>';
} else {
  if($hash->valid(password, $hashedPass)) {
    echo 'Yay!';
  } else {
    echo 'Nay!';
  }
}