PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/source/function/cache/cache_secqaa.php

https://github.com/kuaileshike/upload
PHP | 33 lines | 22 code | 5 blank | 6 comment | 2 complexity | 263f9d4a86476d593b065c34b335fa28 MD5 | raw file
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: cache_secqaa.php 24522 2011-09-23 02:12:46Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. function build_cache_secqaa() {
  12. $data = array();
  13. $secqaanum = C::t('common_secquestion')->count();
  14. $start_limit = $secqaanum <= 10 ? 0 : mt_rand(0, $secqaanum - 10);
  15. $i = 1;
  16. foreach(C::t('common_secquestion')->fetch_all($start_limit, 10) as $secqaa) {
  17. if(!$secqaa['type']) {
  18. $secqaa['answer'] = md5($secqaa['answer']);
  19. }
  20. $data[$i] = $secqaa;
  21. $i++;
  22. }
  23. while(($secqaas = count($data)) < 9) {
  24. $data[$secqaas + 1] = $data[array_rand($data)];
  25. }
  26. savecache('secqaa', $data);
  27. }
  28. ?>