后台界面:
前台界面: 比较简单 可自行美化
文件结构:
enroll.php 文件在 plus文件下
enroll.htm文件在templets/plus 文件夹下
adenroll.php 文件在dede文件夹下
adenroll.html 文件dede/templet文件夹下
sql 文件:
01 |
CREATE TABLE IF NOT EXISTS `dede_enroll` ( |
02 |
`id` int (4) NOT NULL auto_increment, |
03 |
` name ` varchar (20) NOT NULL , |
04 |
`mail` varchar (30) NOT NULL , |
05 |
`tag` tinyint(1) NOT NULL default '0' , |
07 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; |
09 |
INSERT INTO `dede_plus` (`aid`, `plusname`, `menustring`, `mainurl`, `writer`, `isshow`, `filelist`) VALUES |
10 |
(30, '网上报名' , '<m:item name=' '网上报名' ' link=' 'adenroll.php' ' rank=' 'plus_网上报名' ' target=' 'main' ' />' , '' , 'g1000' , 1, '' ); |
12 |
INSERT INTO `dede_arctype` (`id`, `reid`, `topid`, `sortrank`, `typename`, `typedir`, `isdefault`, `defaultname`, `issend`, `channeltype`, `maxpage`, `ispart`, `corank`, `tempindex`, `templist`, `temparticle`, `namerule`, `namerule2`, `modname`, `description`, `keywords`, `moresite`, `sitepath`, `siteurl`, `ishidden`, ` cross `, `crossid`, `content`, `smalltypes`) VALUES |
13 |
(9, 0, 0, 50, '在线报名' , '{cmspath}/plus/enroll.php' , 1, 'enroll.php' , 0, 1, -1, 0, 0, '' , '' , '' , '' , '' , '' , '' , '' , 0, '' , '' , 0, 0, NULL , NULL , NULL ); |
这里说明下 为了方便 我简单的设置了 两个字段 姓名和邮箱 tag字段是标示是否录取 1为录取
第一个insert语句是添加到后台管理
第二个insert语句是添加到前台导航栏
enroll.php
04 |
include_once dirname( __FILE__ ). './../include/common.inc.php' ; |
06 |
require_once DEDEINC. "/arc.partview.class.php" ; |
10 |
if ( CheckEmail( $_POST [ 'mail' ])==false){ |
11 |
ShowMsg( '邮箱格式错误' , '-1' ); |
14 |
if ( $_POST [ 'name' ]== "" ){ |
15 |
ShowMsg( '用户名不能为空' , '-1' ); |
18 |
$name =htmlspecialchars( $_POST [ 'name' ]); |
20 |
if ( $_SESSION [ 'dd_ckstr' ]!= strtolower ( $_POST [ 'validation' ])){ |
24 |
$sql = "insert into `dede_enroll`(name,mail) values('$name','$_POST[mail]')" ; |
26 |
$affected = $db ->ExecuteNoneQuery2( $sql ); |
31 |
$pv ->SetTemplet(DEDETEMPLATE. '/plus/enroll.htm' ); |
enroll.htm
01 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.zuola.net/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
03 |
< title >{dede:global.cfg_webname/}-在线报名</ title > |
04 |
< link href = "{dede:global.cfg_templeturl/}/style/dedecms.css" rel = "stylesheet" media = "screen" type = "text/css" /> |
08 |
{dede:include filename="../default/head.htm"/} |
09 |
< blockquote style = "margin:50px auto" > |
10 |
< form method = "post" action = "" > |
11 |
姓 名:< input type = "text" size = 30 name = "name" />< br />< br /> |
12 |
邮 箱:< input type = "text" size = 30 name = "mail" />< br />< br /> |
14 |
验证码:< input type = "text" name = "validation" />< img src = "../../include/vdimgck.php" />< br />< br /> |
15 |
< input name = "encoll" type = "submit" value = "报名" />< br /> |
18 |
{dede:include filename="../default/footer.htm"/} |
adenroll.php
02 |
require_once (dirname( __FILE__ ). '/config.php' ); |
03 |
require_once (DEDEINC. "/datalistcp.class.php" ); |
04 |
if ( $_GET [ 'action' ]&& $_GET [ 'id' ]){ |
05 |
if ( $_GET [ 'action' ]== 'pass' ){ |
06 |
$db ->ExecuteNoneQuery( "update dede_enroll set `tag`=1 where id='$_GET[id]'" ); |
07 |
ShowMsg( '录取成功' , 'adenroll.php' ); |
09 |
if ( $_GET [ 'action' ]== 'nopass' ){ |
10 |
$db ->ExecuteNoneQuery( "update dede_enroll set `tag`=0 where id='$_GET[id]'" ); |
11 |
ShowMsg( '取消录取' , 'adenroll.php' ); |
13 |
if ( $_GET [ 'action' ]== 'delete' ){ |
14 |
$db ->ExecuteNoneQuery( "delete from dede_enroll where id='$_GET[id]'" ); |
15 |
ShowMsg( '删除成功' , 'adenroll.php' ); |
18 |
$dl = new DataListCP(); |
20 |
$dl ->SetTemplate( './templets/adenroll.htm' ); |
21 |
$sql = "select * from dede_enroll" ; |
adenroll.html
01 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.zuola.net/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
04 |
< link href = 'img/base.css' rel = 'stylesheet' type = 'text/css' /> |
05 |
< style type = "text/css" > |
08 |
border:1px #D1DDAA solid; |
20 |
< table width = "90%" border = "0" cellpadding = "0" cellspacing = "0" align = "center" > |
30 |
< td >{dede:field.name /}</ td > |
31 |
< td >{dede:field.mail /}</ td > |
33 |
{dede:if field.tag==0} |
36 |
< font color = "red" >已录取</ font > |
39 |
< td > < a href = "adenroll.php?action=pass&id={dede:field.id /}" >[录取]</ a > |
41 |
< a href = "adenroll.php?action=nopass&id={dede:field.id /}" >[不通过]</ a > |
43 |
< a href = "adenroll.php?action=delete&id={dede:field.id /}" >[删除]</ a > |
49 |
< p style = "text-align:center;font-size:15px;" >{dede:pagelist listitem="info,index,end,pre,next,pageno" listsize="5"/}</ p > |