后臺(tái)界面:
圖片:1.jpg
前臺(tái)界面: 比較簡單 可自行美化
圖片:2.jpg
文件結(jié)構(gòu):
enroll.php 文件在 plus文件下
enroll.htm文件在templets/plus 文件夾下
adenroll.php 文件在dede文件夾下
adenroll.html 文件dede/templet文件夾下
sql 文件:
print?
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' , |
06 |
PRIMARY KEY (`id`) |
07 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; |
08 |
09 |
INSERT INTO `dede_plus` (`aid`, `plusname`, `menustring`, `mainurl`, `writer`, `isshow`, `filelist`) VALUES |
10 |
(30, '網(wǎng)上報(bào)名' , '<m:item name=' '網(wǎng)上報(bào)名' ' link=' 'adenroll.php' ' rank=' 'plus_網(wǎng)上報(bào)名' ' target=' 'main' ' />' , '' , 'g1000' , 1, '' ); |
11 |
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, '在線報(bào)名' , '{cmspath}/plus/enroll.php' , 1, 'enroll.php' , 0, 1, -1, 0, 0, '' , '' , '' , '' , '' , '' , '' , '' , 0, '' , '' , 0, 0, NULL , NULL , NULL ); |
這里說明下 為了方便 我簡單的設(shè)置了 兩個(gè)字段 姓名和郵箱 tag字段是標(biāo)示是否錄取 1為錄取
第一個(gè)insert語句是添加到后臺(tái)管理
第二個(gè)insert語句是添加到前臺(tái)導(dǎo)航欄
enroll.php
view sourceprint?
01 |
<?php |
02 |
//*******要先包含common.inc.php 然后 session_start(); 否則取不到session的值 |
03 |
//*******因?yàn)閏ommon.inc.php 有關(guān)于session路徑的配置 |
04 |
include_once dirname( __FILE__ ). './../include/common.inc.php' ; //包含配置文件 |
05 |
session_start(); |
06 |
require_once DEDEINC. "/arc.partview.class.php" ; //包含partiew類 |
07 |
//*****實(shí)例化 這個(gè)類的作用是得到頭部導(dǎo)航欄和尾部信息 若不需要可以使用dedetemplate.class.php 這個(gè)類 |
08 |
$pv = new PartView(); |
09 |
if ( $_POST ){ |
10 |
if ( CheckEmail( $_POST [ 'mail' ])==false){ //驗(yàn)證郵箱 方法在common.func.php 公用函數(shù) |
11 |
ShowMsg( '郵箱格式錯(cuò)誤' , '-1' ); |
12 |
exit (); |
13 |
} |
14 |
if ( $_POST [ 'name' ]== "" ){ |
15 |
ShowMsg( '用戶名不能為空' , '-1' ); |
16 |
exit (); |
17 |
} else { |
18 |
$name =htmlspecialchars( $_POST [ 'name' ]); |
19 |
} |
20 |
if ( $_SESSION [ 'dd_ckstr' ]!= strtolower ( $_POST [ 'validation' ])){ //驗(yàn)證 驗(yàn)證碼 必須轉(zhuǎn)換成小寫 |
21 |
ShowMsg( '驗(yàn)證碼錯(cuò)誤' ,-1); |
22 |
exit (); |
23 |
} |
24 |
$sql = "insert into `dede_enroll`(name,mail) values('$name','$_POST[mail]')" ; |
25 |
//********$db可直接使用 系統(tǒng)自動(dòng)實(shí)例化了dedesql.class.php |
26 |
$affected = $db ->ExecuteNoneQuery2( $sql ); //執(zhí)行一條語句 返回影響值 |
27 |
if ( $affected ){ |
28 |
ShowMsg( '報(bào)名成功' ,-1); |
29 |
} |
30 |
} else { |
31 |
$pv ->SetTemplet(DEDETEMPLATE. '/plus/enroll.htm' ); //設(shè)置模板 |
32 |
$pv ->Display(); //顯示頁面 |
33 |
} |
34 |
35 |
?> |
enroll.htm
view sourceprint?
01 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
02 |
< head > |
03 |
< title >{dede:global.cfg_webname/}-在線報(bào)名</ title > |
04 |
< link href = "{dede:global.cfg_templeturl/}/style/dedecms.css" rel = "stylesheet" media = "screen" type = "text/css" /> |
05 |
</ script > |
06 |
</ head > |
07 |
< body > |
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 /> |
13 |
<!--vdimgck.php 是驗(yàn)證碼--> |
14 |
驗(yàn)證碼:< input type = "text" name = "validation" />< img src = "../../include/vdimgck.php" />< br />< br /> |
15 |
< input name = "encoll" type = "submit" value = "報(bào)名" />< br /> |
16 |
</ form > |
17 |
</ blockquote > |
18 |
{dede:include filename="../default/footer.htm"/} <!-- 包含尾部 --> |
19 |
</ body > |
20 |
</ html > |
adenroll.php
view sourceprint?
01 |
<?php |
02 |
require_once (dirname( __FILE__ ). '/config.php' ); //后臺(tái)配置文件 檢查登陸 配置信息 |
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' ); |
08 |
} |
09 |
if ( $_GET [ 'action' ]== 'nopass' ){ |
10 |
$db ->ExecuteNoneQuery( "update dede_enroll set `tag`=0 where id='$_GET[id]'" ); |
11 |
ShowMsg( '取消錄取' , 'adenroll.php' ); |
12 |
} |
13 |
if ( $_GET [ 'action' ]== 'delete' ){ |
14 |
$db ->ExecuteNoneQuery( "delete from dede_enroll where id='$_GET[id]'" ); |
15 |
ShowMsg( '刪除成功' , 'adenroll.php' ); |
16 |
} |
17 |
} else { |
18 |
$dl = new DataListCP(); |
19 |
$dl ->pageSize = 10; //每頁顯示10條 |
20 |
$dl ->SetTemplate( './templets/adenroll.htm' ); //載入模板 |
21 |
$sql = "select * from dede_enroll" ; |
22 |
$dl ->SetSource( $sql ); //執(zhí)行sql 不能與$dl->SetTemplate 顛倒 |
23 |
$dl ->Display(); //顯示頁面 |
24 |
} |
25 |
26 |
?> |
adenroll.html
view sourceprint?
01 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
02 |
< head > |
03 |
< title >在線報(bào)名管理</ title > |
04 |
< link href = 'img/base.css' rel = 'stylesheet' type = 'text/css' /> |
05 |
< style type = "text/css" > |
06 |
th,td{ |
07 |
text-align:center; |
08 |
border:1px #D1DDAA solid; |
09 |
font-size:15px; |
10 |
} |
11 |
th{ |
12 |
background:#E6F8B7; |
13 |
} |
14 |
table{ |
15 |
margin-top:20px; |
16 |
} |
17 |
</ style > |
18 |
</ head > |
19 |
< body > |
20 |
< table width = "90%" border = "0" cellpadding = "0" cellspacing = "0" align = "center" > |
21 |
< tr > |
22 |
< th >姓名</ th > |
23 |
< th >E-mail</ th > |
24 |
< th >狀態(tài)</ th > |
25 |
< th >操作</ th > |
26 |
</ tr > |
27 |
<!-- 循環(huán)得到結(jié)果 --> |
28 |
{dede:datalist} |
29 |
< tr > |
30 |
< td >{dede:field.name /}</ td > |
31 |
< td >{dede:field.mail /}</ td > |
32 |
< td > |
33 |
{dede:if field.tag==0} |
34 |
未錄取 |
35 |
{else} |
36 |
< font color = "red" >已錄取</ font > |
37 |
{/dede:if} |
38 |
</ td > |
39 |
< td > < a href = "adenroll.php?action=pass&id={dede:field.id /}" >[錄取]</ a > |
40 |
| |
41 |
< a href = "adenroll.php?action=nopass&id={dede:field.id /}" >[不通過]</ a > |
42 |
| |
43 |
< a href = "adenroll.php?action=delete&id={dede:field.id /}" >[刪除]</ a > |
44 |
</ td > |
45 |
</ tr > |
46 |
{/dede:datalist} |
47 |
</ table > |
48 |
<!-- 分頁標(biāo)簽 --> |
49 |
< p style = "text-align:center;font-size:15px;" >{dede:pagelist listitem="info,index,end,pre,next,pageno" listsize="5"/}</ p > |
50 |
</ body > |
51 |
</ html > |
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: DedeCms插件開發(fā)簡單實(shí)例