改过来了 这个操作确实很牛X ,
这个是 HTM代码:
{subtemplate common/header}
<link type="text/css" rel="stylesheet" href="source/plugin/down_love/template/extend_common.css" />
<div id="ct" class="wp cl"><!--定义页面导航 -->
<div class="mn">
<div class="bm">
<ul class="tb cl">
<li<!--{if empty($_GET[mod])}--> class="current"<!--{/if}-->><a href="plugin.php?id=challenge">查看战书</a></li>
<li<!--{if $_GET[mod] == 'add_challenge'}--> class="current"<!--{/if}-->><a href="plugin.php?id=challenge&mod=add_challenge">下战书</a></li>
<li<!--{if $_GET[mod] == 'ask_challenge'}--> class="current"<!--{/if}-->><a href="plugin.php?id=challenge&mod=first_challenge">勇士排行</a></li>
</ul>
<!--{if empty($_GET[mod])}-->
<div class="content" style="background:url(source/plugin/challenge/template/images/zhanshu.jpg);height: 550px;width: 950px;">
<!--{loop $row $challenge}-->
<table width=600px height="550px" border="1" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<tr bgcolor="#eff3ff">
<td>战书:$challenge[title] 挑战者:$challenge[username]</td>
</tr>
<tr bgColor="#ffffff">
<td>内容:$challenge[content]</td>
</tr>
</table>
<!--{/loop}-->
<!--{if !empty($multipage)}-->
<table>
<tr>
<td>$multipage</td>
</tr>
<!--{else}-->
<tr>
<td colspan="5" align="center">{lang moodwall:moodwall_htm_44}</td>
</tr>
</table>
<!--{/if}-->
</div>
<!--{elseif $_GET[mod] == 'add_challenge'}-->
<SCRIPT language=javascript>
function CheckPost()
{
if (myform.user.value=="")
{
alert("请填写用户名");
myform.user.focus();
return false;
}
if (myform.title.value.length<5)
{
alert("标题不能少于5个字符");
myform.title.focus();
return false;
}
if (myform.content.value=="")
alert("必须要填写留言内容");
myform.content.focus();
return false;
}
}
</SCRIPT>
<form action="plugin.php?id=challenge:challenge" method="post" name="myform" align="center">
<b>挑战者</b>:<input type="text" size="10" name="user" align="center"/><br>
<b>战书名字</b>:<input type="text" name="title" align="center"/><br/>
填写勾起对手战意的内容吧:<br><textarea name="content" cols="60" rows="9" align="center"></textarea><br/>
<input type="submit" name="submit" value="下战书" align="center"/>
</form>
</div>
</div>
</div>
<!--{/if}-->
{subtemplate common/footer}
inc.php代码:
<?php
if(!defined('IN_DISCUZ')){
exit('Access Denied');
}
if(empty($_G['uid']))
{
showmessage('抱歉,为了保障网站的良好运行 和会员的权益,请注册后再使用本功能,为您带来的不便深表歉意','member.php?mod=register');
}
if($_POST['submit'])
{
$query=DB::query("INSERT INTO ".DB::table('challenge')."(id,uid,usernazme,title,content,lasttime)
VALUES ('','$_G[uid]','$_G[username]','$_POST[title])','($_POST[content])',now())");
showmessage('发表成功',NULL);
}
$query1=DB::query("SELECT * FROM ".DB::table('challenge')." order by id desc ");
$row=DB::fetch($query1);//循环函数,根据返回的值生成数组,并在下面循环引用
/*function htmtocode($content)
{
$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));
return $content;
}
*/
$num = DB::result_first("SELECT COUNT(*) FROM ".DB::table('challenge')." WHERE uid='$_G[uid]'");//mysql_result为取得结果数据
$page = $_G['page'] > 10 ? 1 : $_G['page'];
$start_limit = ($page - 1) * 10;
$multipage = multi($num, 10, $page, "plugin.php?id=challenge&mod={$_GET[mod]}");
include template('challenge:challenge');
?>
|