seccode.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * 验证码
  4. *********************************/
  5. defined('InShopNC') or exit('Access Invalid!');
  6. class seccodeControl{
  7. public function __construct(){
  8. }
  9. /**
  10. * 产生验证码
  11. *
  12. */
  13. public function makecodeOp(){
  14. $refererhost = parse_url($_SERVER['HTTP_REFERER']);
  15. $refererhost['host'] .= !empty($refererhost['port']) ? (':'.$refererhost['port']) : '';
  16. $seccode = makeSeccode($_GET['nchash']);
  17. @header("Expires: -1");
  18. @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
  19. @header("Pragma: no-cache");
  20. $code = new seccode();
  21. $code->code = $seccode;
  22. $code->width = 90;
  23. $code->height = 26;
  24. $code->background = 1;
  25. $code->adulterate = 1;
  26. $code->scatter = '';
  27. $code->color = 1;
  28. $code->size = 0;
  29. $code->shadow = 1;
  30. $code->animator = 0;
  31. $code->datapath = BASE_DATA_PATH.'/resource/seccode/';
  32. $code->display();
  33. }
  34. /**
  35. * AJAX验证
  36. *
  37. */
  38. public function checkOp(){
  39. if (checkSeccode($_GET['nchash'],$_GET['captcha'])){
  40. exit('true');
  41. }else{
  42. exit('false');
  43. }
  44. }
  45. }
  46. ?>