emlog加密文章美化代码,Emlog文章-访问密码页面美化

Emlog 程序的钩子远不如 WordPress 这么丰富,因此这一美化只能通过直接修改 Emlog 代码来实现。具体的位置在 include/model/log_model.php 文件末尾的 authPassword 函数。
将原来的函数里的

emlog加密文章美化代码,Emlog文章-访问密码页面美化

  1. if ($pwd !== addslashes($logPwd)) {
  2. echo <<<EOT
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>emlog message</title>
  7. <style type="text/css">
  8. <!--
  9. body{background-color:#F7F7F7;font-family: Arial;font-size: 12px;line-height:150%;}
  10. .main{background-color:#FFFFFF;margin-top:20px;font-size: 12px;color:#666666;width:580px;margin:10px 200px;padding:10px;list-style:none;border:#DFDFDF 1px solid;}
  11. -->
  12. </style>
  13. </head>
  14. <body>
  15. <div class="main">
  16. <form action="" method="post">
  17. 请输入该文章的访问密码<br>
  18. <input type="password" name="logpwd" /><input type="submit" value="进入.." />
  19. <br /><br /><a href="$url">&laquo;返回首页</a>
  20. </form>
  21. </div>
  22. </body>
  23. </html>
  24. EOT;
  25. if ($cookiePwd) {
  26. setcookie('em_logpwd_' . $logid, ' ', time() - 31536000);
  27. }

替换为如下代码即可

  1. if ($pwd !== addslashes($logPwd)) {
  2. ?>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta charset="UTF-8">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. <meta name="renderer" content="webkit">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  10. <title>该文章已被加密</title>
  11. </head>
  12. <body>
  13. <div class="main">
  14. <img class="alert" alt="文章已被加密"src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIoAAACACAMAAADjwgEwAAAAOVBMVEUAAAD5dBr7dRj4dBn/cBD5cxr4cxn6chj7dBj/cBj5cxr5dBn6cxn4dBn5cxr6dRX5cxr5cxr5dB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DDLXFQOiwxJaGe/BP2gcihCLQuiZKlV1f58zNDmr9lNtLSyg+C8jeKrSXbX/pCqqHxdyvwTO6j53qnvu8/nFLfgz1uGXJ9SMy/sP3A3J7fhq7Pv34f21fnkUWt3eUtDTVSzPL1u6SKGfjrV6TvtM98bhccMlMOYWXSWXpHJNLaPMXZ8oyOMxlLIsAAAAASUVORK5CYII=">
  15. <form action="" method="post" class="mk-side-form">
  16. <h2 class="pw-tip">该文章已被加密</h2>
  17. <input type="password" name="logpwd" placeholder="请输入访问密码查看" required><button type="submit">提交</button>
  18. <?php if($postPwd): ?>
  19. <p id="pw-error">Oops!密码不对哦~</p>
  20. <script>setTimeout(function() {document.getElementById("pw-error").style.display = "none"},2000);</script>
  21. <?php endif; ?>
  22. </form>
  23. <a href="<?php echo $url; ?>" class="return-home" title="点击回到网站首页">- 返回首页 - </a>
  24. </div>
  25. <style type="text/css">
  26. *{font-family:"Microsoft Yahei",微软雅黑,"Helvetica Neue",Helvetica,"Hiragino Sans GB","WenQuanYi Micro Hei",sans-serif;box-sizing:border-box;margin:0px;padding:0px;font-size:14px;-webkit-transition:.2s;-moz-transition:.2s;-ms-transition:.2s;-o-transition:.2s;transition:.2s}
  27. html,body{width:100%;height:100%}
  28. body{background-color:#F4F6F9;color:#768093}
  29. input,button{font-size:1em;border-radius:3px;-webkit-appearance:none}
  30. input{width:100%;padding:5px;box-sizing:border-box;border:1px solid #e5e9ef;background-color:#f4f5f7;resize:vertical}
  31. input:focus{background-color:#fff;outline:none}
  32. button{border:0;background:#6abd09;color:#fff;cursor:pointer;opacity:1;user-select:none}
  33. button:hover,button:focus{opacity:.9}
  34. button:active{opacity:1}
  35. .main{width:100%;max-width:500px;height:300px;padding:30px;background-color:#fff;border-radius:2px;box-shadow:0 10px 60px 0 rgba(29,29,31,0.09);transition:all .12s ease-out;position:absolute;left:0;top:0;bottom:0;right:0;margin:auto;text-align:center}
  36. .alert{width:80px}
  37. .mk-side-form{margin-bottom:28px}
  38. .mk-side-form input{float:left;padding:2px 10px;width:77%;height:37px;border:1px solid#ebebeb;border-right-color:transparent;border-radius:2px 0 0 2px;line-height:37px}
  39. .mk-side-form button{position:relative;overflow:visible;width:23%;height:37px;border-radius:0 2px2px 0;text-transform:uppercase}
  40. .pw-tip{font-weight:normal;font-size:26px;text-align:center;margin:25px auto}
  41. #pw-error {color: red;margin-top: 15px;margin-bottom: -20px;}
  42. .return-home{text-decoration:none;color:#b1b1b1;font-size:16px}
  43. .return-home:hover{color:#1E9FFF;letter-spacing:5px}
  44. </style>
  45. </body>
  46. </html>
  47. <?php
  48. if ($cookiePwd) {
  49. setcookie('em_logpwd_' . $logid, ' ', time() - 31536000);
  50. }
未经刘小凡允许不得转载:刘小凡博客 » emlog加密文章美化代码,Emlog文章-访问密码页面美化
微信公众号:潮虫创意
关注这个,有趣有料有干货,让你为所欲为!
82241人已关注
分享到:
赞(0) 打赏

评论抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

支持原创,尽在刘小凡博客!

获取资源

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏