新闻管理系统

用smarty来完成一个简单的新闻管理系统

连接数据库

 <?php
class mysql
{
 var $db_host = 'localhost';
 var $db_username= 'root';
 var $db_password= 'qwe';
 var $db_database= 'new';

 function connect() {
  $db = new mysqli($this-> db_host,$this-> db_username,$this-> db_password,$this-> db_database);
  if (mysqli_connect_errno()) {
   echo "连接数据库失败!";
   exit;
  }
  return $db;
 }
 
 function query_exec($query) {
  $db = $this-> connect();
  $result = $db-> query($query);
  return $result;
 }
}
?>

新闻管理主页

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$page_title}</title>

</head>

<body>
<p class="style1">新闻管理</p>
<hr>
<table width="771" height="115" border="0">
  <tr>
    <td height="62"><div align="center">系统管理</div></td>
    <td width="666" rowspan="2"><form name="form1" method="post" action="">
      <table width="543" border="0">
        <tr>
          <td width="253">标题</td>
          <td width="230">日期</td>
          <td width="46">选择</td>
        </tr>
  {section name=news loop=$news}
        <tr>
          <td><a href="./index.php?action=editnewsview&id={$news[news].id}">{$news[news].title}</a></td>
          <td>{$news[news].date}</td>
          <td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="{$news[news].id}"></td>
        </tr>
  {/section}
      </table>
      <p>
        <input type="submit" name="Submit" value="删除">
      <input name="action" type="hidden" id="action" value="{$actionvalue}">
   </p>
    </form> </td>
  </tr>
  <tr>
    <td width="95" height="47"><div align="center"><a href="./index.php?action=addnewsview">添加新闻</a></div></td>
  </tr>
</table>
<p class="style1">&nbsp;</p>
</body>
</html>

 

 

新闻管理登陆

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
<!--
.style1 {
 font-size: 36px;
 font-weight: bold;
}
-->
</style>
</head>

<body>
<p class="style1">新闻管理登陆
</p>
<form name="form1" method="post" action="../login.php">
  <table width="282" border="1">
    <tr>
      <td width="57">用户名</td>
      <td width="209"><input name="username" type="text" id="username"></td>
    </tr>
    <tr>
      <td>密码</td>
      <td><input name="passwd" type="password" id="passwd"></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="Submit" value="提交">
  </p>
</form>
<p class="style1">&nbsp;</p>
</body>
</html>

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值