帝国cms如何实现输入密码才能下载链接的方法?

帝国cms要实现输入密码才能下载内容的办法,可以增加一个mima字段,然后修改模型,再修改公共模板变量,下面的方法供大家参考

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>[!--pagetitle--]</title>
<meta name="keywords" content="[!--pagekey--]">
<meta name="description" content="[!--pagedes--]">
<link href="../../data/images/qcss.css" rel="stylesheet" type="text/css">
</head>
<body>
<br>
<br>
<br>
<br>
<?php
if(!$r[mima])
{
?>
<table align="center" width="100%">
  <tr>
    <td  align=center>
    <a href="[!--down.url--]" title="[!--title--] -[!--down.name--]">
    <img src="../../data/images/download.jpg" border=0>
    </a>
    </td>
  </tr>
  <tr>
    <td align=center>(点击下载)</td>
  </tr>
</table>
<br>
<?
}else{
?>
 
<?php
if(isset($_POST['password'])){
   $pwd=$_POST['password'];
   if($pwd == $r[mima]){
?>
<table align="center" width="100%">
  <tr>
    <td  align=center>
    <a href="[!--down.url--]" title="[!--title--] -[!--down.name--]">
    <img src="../../data/images/download.jpg" border=0>
    </a>
    </td>
  </tr>
  <tr>
    <td align=center>(点击下载)</td>
  </tr>
</table>
<br>
<? 
   }else{
   echo "<script>alert('密码错误');</script>";
   }
}
?>
 
<?
  if($pwd !== $r[mima]){
  ?>
 
<div style="text-align:center;">请输入密码后继续:<br>
<form action="" method="post">
<input style="border:1px solid #3374b4;height:33px;line-height:33px;padding-left:5px" type="password" name="password">
<input style="border:1px solid #3374b4;background:#3374b4;padding:10px 10px;color:#fff;text-decoration:none;vertical-align:top" type="submit" value="下 载"></form>
</div>
<?
}
?>
 
<?
}
?>
</body>
</html>

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注