Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php google authenauthenticator

composer require sonata-project/google-authenticator or https://github.com/sonata-project/GoogleAuthenticator

include_once 'vendor/sonata-project/google-authenticator/src/FixedBitNotation.php';
include_once 'vendor/sonata-project/google-authenticator/src/GoogleAuthenticatorInterface.php';
include_once 'vendor/sonata-project/google-authenticator/src/GoogleAuthenticator.php';
include_once 'vendor/sonata-project/google-authenticator/src/GoogleQrUrl.php';
 
$g = new GoogleAuthenticatorGoogleAuthenticator();
$secret = 'XVQ2UIGO75XRUKJO';
//Optionally, you can use $g->generateSecret() to generate your secret
//$secret = $g->generateSecret();
 
//the "getUrl" method takes as a parameter: "username", "host" and the key "secret"
echo '<img src="'.$g->getURL('user', 'mywebsite.com', $secret).'" />';
 
$secret = 'XVQ2UIGO75XRUKJO';
 
$code = '010989'; //6-digit code generated by Google Authenticator app
 
if($g->checkCode($secret, $code)){
	echo 'Authorized!';
}
else{
	echo 'Incorrect or expired code!';
}

Comment

PREVIOUS NEXT
Code Example
Php :: Anzeige von Custom Post Types in den Kategorien und Tags 
Php :: cakephp get present name 
Php :: laravel model where set fields laravel 
Php :: How to hide Directory Browsing in WordPress from server? 
Php :: how to clear post array on referesh + not refill when return 
Php :: login page php mysql check if user is verified in the database before user can be logged in 
Php :: instagram api error 
Php :: Comment désactiver la barre latérale Widgets sur des pages spécifiques WordPress 
Php :: Ciclo for PHP ejemplos 
Php :: generate random color php 
Php :: laravel route group within a group 
Php :: orWhereRaw 
Php :: laravel file upload 
Php :: laravel framework 
Php :: php get result sql server 
Php :: what does ? mean in php 
Php :: how to change the colum type in migration laravel 
Php :: laravel seeder multiple column 
Php :: image::make en php 
Php :: create a product stripe 
Php :: php forech pdo 
Java :: minecraft bedrock file location 
Java :: spigot broadcast message 
Java :: lombok maven dependency 
Java :: find maven version 
Java :: java reflection get field value 
Java :: statement delete sql java 
Java :: float to string java 
Java :: java get files in directory 
Java :: how to force garbage collection in java 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =