人人商城

wxcode.ctrl.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->library('qrcode');
  8. load()->func('communication');
  9. $dos = array('verifycode', 'image', 'qrcode');
  10. $do = in_array($do, $dos) ? $do : 'verifycode';
  11. $_W['uniacid'] = intval($_GPC['uniacid']);
  12. if($do == 'verifycode') {
  13. $username = trim($_GPC['username']);
  14. $response = ihttp_get("https://mp.weixin.qq.com/cgi-bin/verifycode?username={$username}&r=" . TIMESTAMP);
  15. if(!is_error($response)) {
  16. isetcookie('code_cookie', $response['headers']['Set-Cookie']);
  17. header('Content-type: image/jpg');
  18. echo $response['content'];
  19. exit();
  20. }
  21. } elseif($do == 'image') {
  22. $image = trim($_GPC['attach']);
  23. if(empty($image)) exit();
  24. $content = ihttp_request($image, '', array('CURLOPT_REFERER' => 'http://www.qq.com'));
  25. header('Content-Type:image/jpg');
  26. echo $content['content'];
  27. exit();
  28. } elseif ($do == 'qrcode') {
  29. $errorCorrectionLevel = "L";
  30. $matrixPointSize = "8";
  31. $text = trim($_GPC['text']);
  32. QRcode::png($text, false, $errorCorrectionLevel, $matrixPointSize);
  33. exit();
  34. }