wxcode.ctrl.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. $dos = array('verifycode', 'image');
  8. $do = in_array($do, $dos) ? $do : 'verifycode';
  9. $_W['uniacid'] = intval($_GPC['uniacid']);
  10. if($do == 'verifycode') {
  11. load()->func('communication');
  12. $username = trim($_GPC['username']);
  13. $response = ihttp_get("https://mp.weixin.qq.com/cgi-bin/verifycode?username={$username}&r=" . TIMESTAMP);
  14. if(!is_error($response)) {
  15. isetcookie('code_cookie', $response['headers']['Set-Cookie']);
  16. header('Content-type: image/jpg');
  17. echo $response['content'];
  18. exit();
  19. }
  20. } elseif($do == 'image') {
  21. load()->func('communication');
  22. $image = trim($_GPC['attach']);
  23. if(empty($image)) {
  24. exit();
  25. }
  26. if (!starts_with($image, array('http://mmbiz.qpic.cn/mmbiz_', 'https://mmbiz.qpic.cn/mmbiz_'))) {
  27. exit();
  28. }
  29. $content = ihttp_request($image, '', array('CURLOPT_REFERER' => 'http://www.qq.com'));
  30. header('Content-Type:image/jpg');
  31. echo $content['content'];
  32. exit();
  33. }