custom.php 690 B

12345678910111213141516171819202122
  1. <?php
  2. require_once '../vendor/autoload.php';
  3. use codemasher\QRCode\QRCode;
  4. use codemasher\QRCode\QRConst;
  5. $starttime = microtime(true);
  6. // google authenticator
  7. // https://chart.googleapis.com/chart?chs=200x200&chld=M%7C0&cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%3Fsecret%3DB3JX4VCVJDVNXNZ5%26issuer%3Dchillerlan.net
  8. $qrcode = new QRCode('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net', QRConst::ERROR_CORRECT_LEVEL_M, 5);
  9. for($row = 0; $row < $qrcode->moduleCount; $row++){
  10. for($col = 0; $col < $qrcode->moduleCount; $col++){
  11. echo (bool)$qrcode->modules[$row][$col] ? '#' : ' ';
  12. }
  13. echo PHP_EOL;
  14. }
  15. echo 'QRCode '.round((microtime(true)-$starttime), 5).PHP_EOL;