misc_inputpwd.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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: misc_inputpwd.php 24741 2011-10-10 03:41:51Z chenmengshu $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if(submitcheck('pwdsubmit')) {
  12. $blogid = empty($_POST['blogid'])?0:intval($_POST['blogid']);
  13. $albumid = empty($_POST['albumid'])?0:intval($_POST['albumid']);
  14. $itemarr = array();
  15. if($blogid) {
  16. $itemarr = C::t('home_blog')->fetch($blogid);
  17. $itemurl = "home.php?mod=space&uid=$itemarr[uid]&do=blog&id=$itemarr[blogid]";
  18. $cookiename = 'view_pwd_blog_'.$blogid;
  19. } elseif($albumid) {
  20. $itemarr = C::t('home_album')->fetch($albumid);
  21. $itemurl = "home.php?mod=space&uid=$itemarr[uid]&do=album&id=$itemarr[albumid]";
  22. $cookiename = 'view_pwd_album_'.$albumid;
  23. }
  24. if(empty($itemarr)) {
  25. showmessage('news_does_not_exist');
  26. }
  27. if($itemarr['password'] && $_POST['viewpwd'] == $itemarr['password']) {
  28. dsetcookie($cookiename, md5(md5($itemarr['password'])));
  29. showmessage('proved_to_be_successful', $itemurl, array('succeed'=>1), array('showmsg'=>1, 'timeout'=>1));
  30. } else {
  31. showmessage('password_is_not_passed', $itemurl, array('succeed'=>0), array('showmsg'=>1));
  32. }
  33. }
  34. ?>