下面是插件前台 inc.php文件。在前台输入表单提交后,只是返回插件页面,数据库也没有插入提交的信息:
<?php
if(!defined('IN_DISCUZ')){
exit('错误');//固定开头
}
include template('down_love:down_love');
require './source/class/class_core.php';
$discuz->init();//调用discuz公共执行类等核心代码
if(!$_G['uid']){
showmessage('not_loggedin', NULL, array(), array('login' => 1));}
$realname="select `realname` from `common_member_profile` where uid=$_[uid]";
$username="select `username` from `common_member` where uid=$_[uid]";
if($_POST['intolove'])
{
$sql="insert into `down_love`(id,uid,username,truename,lovesperson).
value('','$_[uid]','$username','$realname','$_[writelove]')";
$query=mysql_query($sql);
showmessage('暗恋宣言保存成功','');
}
if($_POST['foundlove'])
{
$loveperson="select `lovesperson`from `down_love` where uid=$_[uid]";
$loveperson=mysql_query($loveperson);
$sql1="select `lovesperson` from `down_love` where truename=$loveperson";
$bloveperson=mysql_query($sql1);
if($bloveperson=$realname)
{
showmessage('你的Ta同样暗恋你哦');
}
}
?>
这个是插件模版 .htm
{subtemplate common/header}
<link type="text/css" rel="stylesheet" href="source/plugin/down_love/template/extend_common.css" />
<SCRIPT language=javascript>function checkpost(){ if(writeloves.writelove.value="") { alert="暗恋独享可酌情填写,但为空时不得提交"; writeloves.writelove.focus; return false; } }
</SCRIPT><div class="class2" style="background:url(source/plugin/down_love/template/images/love.jpg);" height="550px" width="950px">
<div> <form class="class1" action="plugin.php?id=down_love:down_love" method="POST" name="writeloves"> <input type="text" name="writelove" > <br> <font color="white">输入暗恋对象,看看对方是否同样爱你</font> <br> <input type="submit" name="intolove" value="保存暗恋宣言"> </form> </div>
<div> <form class="class4" action="plugin.php?id=down_love:down_love" method="POST"> <input type="submit" name="foundlove" value="看看Ta是否心有灵犀"><br> <font color="white">@填写好后,请点击左边的按钮,然后把Ta记在你的心里,<br> <br>因为没有人可以提醒你Ta是谁,甚至你自己,只有你的心知道。<br><br> @如果你想知道Ta是否与你心有灵犀,请点击右边的按钮 </font> </form> </div> <div> <form class="class3" action="plugin.php?id=down_love:down_love" method="post" name="outs"> <input type="submit" name="out" value="让暗恋链接你我"><img src="source/plugin/down_love/template/images/out.png" /><br> <font color="white">点击后双方会同时收到关于你和Ta相互暗恋的消息</font> </form> </div> </div>
希望高手,专业人 指出我的不足,指点我一下,虚心求教。
|