custom.php 706 B

123456789101112131415161718192021222324
  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(5, QRConst::ERROR_CORRECT_LEVEL_M))
  9. ->addData('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net')
  10. ->make();
  11. for($row = 0; $row < $qrcode->moduleCount; $row++){
  12. for($col = 0; $col < $qrcode->moduleCount; $col++){
  13. echo $qrcode->isDark($row, $col) ? 'X' : ' ';
  14. }
  15. echo PHP_EOL;
  16. }
  17. echo 'QRCode '.round((microtime(true)-$starttime), 5).PHP_EOL;