login.php代码

<?php
include("../init.inc.php");

$smarty->display("login.html");

login.html代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<h1>登陆页面</h1>
<form action="loginchuli.php" method="post">
<div>用户名:<input type="text" name="uid" /></div>
<div>密码:<input type="password" name="pwd" /></div>
<div ><input type="submit" value="登陆" /></div>
</form>
<body>
</body>
</html>

效果:

loginchuli.php 代码

<?php

include("../DBDA.class.php");
$db=new DBDA();
$uid=$_POST["uid"];
$pwd=$_POST["pwd"];
$sql="select pwd from user where uid='{$uid}'";
$mm=$db->StrQuery($sql);
if($pwd=$mm && !empty($pwd))
{
header("location:main.php");
}

main.php 代码

<?php
include("../init.inc.php");
include("../DBDA.class.php");
$db=new DBDA();
$tj=" 1=1 ";
if(!empty($_GET["name"]))
{ $n=$_GET["name"];
$tj="name like'%{$n}%'";
}
$ztj=" where {$tj} ";
$sall=" select count(*) from course ".$ztj;
$zts=$db->StrQuery($sall);
include("../page.class.php");
$page=new Page($zts,5);

$sql=" select * from course ".$ztj.$page->limit;
$arr=$db->Query($sql);
$smarty->assign("fenye",$page->fpage());
$smarty->assign("shuzu",$arr);
$smarty->display("main.html");

main.html代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<h1>显示页面</h1>
<form action="main.php" method="get">
<div><input type="text" name="name" />
<input type="submit" value="查找" />
</div>
</form>
<table width="100%" cellpadding="0px" cellspacing="0px" border="1px">
<tr>
<td>代号</td>
<td>课程</td>
<td>类型</td>
<td>操作</td>

</tr>
<{foreach $shuzu as $v}>

<tr>
<td><{$v[0]}></td>
<td><{$v[1]}></td>
<td><{$v[2]}></td>
<td><a href="xiugai.php?code=<{$v[0]}>">修改</a></td>

</tr>
<{/foreach}>
</table>
<div><{$fenye}></div>

</body>
</html>

效果:

xiugai.php

<?php
include("../init.inc.php");
include("../DBDA.class.php");
$db=new DBDA();
$code=$_GET["code"];
$sql="select * from course where code='{$code}'";
$arr=$db->Query($sql);
$smarty->assign("course",$arr[0]);
$smarty->display("xiugai.html");

xiugai.html代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<h1>修改页面</h1>
<form action="update.php" method="post">
<div>代号:<input type="text" name="code" value="<{$course[0]}>" /></div>
<div>课程:<input type="text" name="course" value="<{$course[1]}>" /></div>
<div>类型:<input type="text" name="type" value="<{$course[2]}>"/></div>
<input type="submit" value="修改" />
</form>
</body>
</html>

效果

smarty实例的更多相关文章

  1. smarty实例登陆、显示、分页

    1.先建立登陆页面,登陆页面的PHP文件和HTML文件是分开写的. 先建立一个登陆页的PHP文件, <?php include("../init.inc.php");//引入 ...

  2. smarty文件夹,第一个smarty实例总结

    主要是libs里面的smarty类,和init.inc.php配置文件   剩下的是php文件夹.模板文件夹,临时文件夹.缓存文件夹.配置文件夹.插件文件夹   调用main文件夹中的php文件,通过 ...

  3. smarty 快速上手

    smarty半小时快速上手入门教程 投稿:shichen2014 字体:[增加 减小] 类型:转载 时间:2014-10-27我要评论 这篇文章主要介绍了smarty半小时快速上手入门教程,以实例的形 ...

  4. smarty 学习记录

    smarty模版是比较大众化的一个模版,在php开发过程当中被很多开发者视为最友好的模版之一,学习smarty课程对于很多培训机构来说也是列入了培训课程之一,那么很多方面就需要我们学习了一. 安装首先 ...

  5. Yii集成smarty说明

    1.       [在protected目录下建立文件夹vendor/smarty,把smarty的类包放入其中] 2.       [在extensions目录下边建立文件CSmarty.php] ...

  6. smarty半小时快速上手入门教程

    http://www.jb51.net/article/56754.htm http://www.yiibai.com/smarty/smarty_functions.html http://www. ...

  7. (转)PHP模板smarty简单入门教程

    转之--http://blog.163.com/zf_2011@126/blog/static/166861361201062595057962/ 如何在smarty中开始我们程序设计.PHP代码:- ...

  8. smarty半小时快速上手教程(转)

    来源于:http://www.chinaz.com/program/2010/0224/107006.shtml 一:smarty的程序设计部分: 在smarty的模板设计部分我简单的把smarty在 ...

  9. Smarty 插件开发

    插件包含了: functions modifiers block functions compiler functions prefilters postfilters outputfilters r ...

随机推荐

  1. 因为网络安全的重要性打算学习linux

    互联网的普及,在给人们带来巨大便利的同时,也让人们感受到网络安全隐患带给人们的不安与威胁.尤其是随着计算机技术和网络技术应用范围的不断扩充,网络安全方面存在的漏洞也越来越多,在这种情况下,如何提高网络 ...

  2. CentOS安装、配置Nginx反向代理

    添加Nginx存储库 sudo yum install epel-release 安装Nginx sudo yum install nginx 启动Nginx sudo systemctl start ...

  3. mpvue——引入antv-F2图表

    踩坑中~ 官方文档 https://www.yuque.com/antv/f2/intro 毕竟不像echarts接触过,所以还是先看看文档较好 github https://github.com/s ...

  4. 轮询、长轮询、websock

    引入 Web端即时通讯技术:即时通讯技术简单的说就是实现这样一种功能:服务器端可以即时地将数据的更新或变化反应到客户端,例如消息即时推送等功能都是通过这种技术实现的.但是在Web中,由于浏览器的限制, ...

  5. 【BZOJ1015】【JSOI2008】星球大战 并查集

    题目大意 给你一张\(n\)个点\(m\)条边的无向图,有\(q\)次操作,每次删掉一个点以及和这个点相邻的边,求最开始和每次删完点后的连通块个数. \(q\leq n\leq 400000,m\le ...

  6. 卢卡斯定理&扩展卢卡斯定理

    卢卡斯定理 求\(C_m^n~mod~p\) 设\(m={a_0}^{p_0}+{a_1}^{p_1}+\cdots+{a_k}^{p_k},n={b_0}^{p_0}+{b_1}^{p_1}+\cd ...

  7. 「UVA10766」Organising the Organisation(生成树计数)

    BUPT 2017 Summer Training (for 16) #6C 题意 n个点,完全图减去m条边,求生成树个数. 题解 注意可能会给重边. 然后就是生成树计数了. 代码 #include ...

  8. 【模板】cdq分治代替树状数组(单点修改,区间查询)

    #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #in ...

  9. Hdoj 1086.You can Solve a Geometry Problem too 题解

    Problem Description Many geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare ...

  10. AtCoder ExaWizards2019题解

    AtCoder ExaWizards2019题解 AtCoder (因为代码直接用模板写的,可能有点冗长) A.Regular Triangle 给你三根棍子的长度,问你能否用他们组成等边三角形. 什 ...