Aarclay schreef:Ik scan de code, en voeg hem toe aan de Authenticator app. En ik krijg een code te zien die ik overneem, en steeds blijf ik de FAILED terugkrijgen?Even een testcase gebouwd....[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/require_once"]require_once[/URL] [COLOR= #DD0000]GoogleAuthenticator.php[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$ga[/COLOR] [COLOR= #007700]= new[/COLOR] PHPGangsta_GoogleAuthenticator[COLOR= #007700]();[/COLOR] [COLOR= #0000BB]$secret[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$ga[/COLOR][COLOR= #007700]->[/COLOR]createSecret[COLOR= #007700]();[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<p>Vul deze code in, of scan de QR-code: "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$secret[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"nn</p>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$qrCodeUrl[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$ga[/COLOR][COLOR= #007700]->[/COLOR]getQRCodeGoogleUrl[COLOR= #007700]([/COLOR][COLOR= #DD0000]Test inlog[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$secret[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$oneCode[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$ga[/COLOR][COLOR= #007700]->[/COLOR]getCode[COLOR= #007700]([/COLOR][COLOR= #0000BB]$secret[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$checkResult[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$ga[/COLOR][COLOR= #007700]->[/COLOR]verifyCode[COLOR= #007700]([/COLOR][COLOR= #0000BB]$secret[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// 2 = 2*30sec clock tolerance[/COLOR] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$checkResult[/COLOR][COLOR= #007700]) {[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"OK!"[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]FAILED. No result of zo![/COLOR][COLOR= #007700]; } }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [COLOR= #FF8000]//echo "<p>Checking Code $oneCode and Secret $secret:n</p>";[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p><img src="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$qrCodeUrl[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" /></p>[/COLOR][COLOR= #007700];[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<form method="POST" action=""> Code: <input type="text" name="code" size="6" /> <input type="submit" value="Inloggen"> </form>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<p>"[/COLOR][COLOR= #007700];[/COLOR] ?>
$_POST[code] bestaat, $secret bestaat.
Kijk ik nou ergens over heen ofzo?
Het lijkt alsof je nu bij ieder request een nieuwe secret laat genereren, waardoor de secret bij je GET anders is dan bij je POST

) nog interessant is.
als het images zijn naar je eigen website dan kun je die met een simpele str_replace ombouwen maar anders zou ik mezelf de moeite besparen en inderdaad gewoon een camo aanslingeren.
ik doe dat ook