Added TOTP Key 2FA Function to client logins

This commit is contained in:
johnnyq
2021-08-18 22:29:22 -04:00
parent 00da99b2df
commit cdcd22ae6f
7 changed files with 72 additions and 40 deletions

View File

@@ -16,40 +16,6 @@
Copy to clipboard
</button>
<?php
// Function to generate OTP
function generateNumericOTP($n) {
// Take a generator string which consist of
// all numeric digits
$generator = "1357902468";
// Iterate for n-times and pick a single character
// from generator and append it to $result
// Login for generating a random character from generator
// ---generate a random number
// ---take modulus of same with length of generator (say i)
// ---append the character at place (i) from generator to result
$result = "";
for ($i = 1; $i <= $n; $i++) {
$result .= substr($generator, (rand()%(strlen($generator))), 1);
}
// Return result
return $result;
}
// Main program
$n = 6;
print_r(generateNumericOTP($n));
?>
<?php
echo "$session_permission_companies";