xajax写的留言本
程序员文章站
2023-08-17 18:56:09
session_start(); require_once("../conn/mysqlconn.php"); requir...
<?
session_start();
require_once("../conn/mysqlconn.php");
require_once('xajax.inc.php');
if(!isset($_session['wid']))
{
$_session['wid']=$_get["wid"];
}
if(isset($_post['content_4']))
{
$con = new createdb;
$con->createconn();
$con->mysql="insert into content(webid,tallname,txtconntent) values('$_session[wid]','$_post[tallnane]','$_post[content_4]')";
$con->getresule();
}
@define(mun_2,3); //定义每页显示几条记
function tt($form_mm)
{
if($_session["code"]==$form_mm['chetxt']) //用xajax来取得验证码,不同以前的那种看验证码对不对
{
$erro_msg="谢谢你的支持";
$jjs="";
}
else
{
$erro_msg="验证码不对,请重新在写";
$jjs="true";
}
$obj= new xajaxresponse();
$obj->addassign("check_msg","innerhtml",$erro_msg);
$obj->addassign("btn","disabled",$jjs);
return $obj->getxml();
}
function callmsg()
{
$obj= new xajaxresponse();
$obj->addscript("xajax_tt(xajax.getformvalues('form_d'));");
return $obj->getxml();
}
function xx($uu)
{
$ad_2="";
$bb=mun_2;
$start=$uu*mun_2 - mun_2;
$ii=$uu-1;
if($uu==1)
{
$ii=$uu;
}
$i=$uu+1;
if($i>@$_session['$mun_5'])
{
$i=$uu;
}
$pp = new createdb;
$pp->createconn();
$pp->mysql="select count(*) from content where webid=$_session[wid]";
$pp->getresule();
$pp->getrow();
$u=$pp->row[0];
$t=$u;
$pp->mysql="select * from content where webid=$_session[wid] group by id desc limit $start,$bb";
$pp->getresule();
$start=$start+1;
while($pp->getrow())
{
$ad="<div class='ad_95'>倪称".$pp->row["tallname"]."</div><div class='ad_93'>广告:".$pp->row["tellall"]."</div><div class='ad_91'>".$start."楼</div><div class='ad_90'>内容:".$pp->row["txtconntent"]."</div>";
$ad_2=$ad_2.$ad;
@$qqaa="<span onclick='xajax_xx($ii)' style='cursor:pointer'>上一页</span> <span onclick='xajax_xx($i)' style='cursor:pointer'>下一页</span> ";
$start++;
}
$obj= new xajaxresponse();
$obj->addassign("div","innerhtml",$ad_2);
$obj->addassign("ren","innerhtml",@$qqaa);
$obj->addscript("if ( (event.altkey) || ((event.keycode == 8) &&
(event.srcelement.type != 'text' &&
event.srcelement.type != 'textarea' &&
event.srcelement.type != 'password')) ||
((event.ctrlkey) && ((event.keycode == 78) || (event.keycode == 82)) ) ||
(event.keycode == 116) ) {
event.keycode = 0;
event.returnvalue = false;
}
");
return $obj->getxml();
}
$ax = new xajax();
$ax->registerfunction("xx");
$ax->registerfunction("tt");
$ax->registerfunction("callmsg");
$ax->processrequests();
?>
<!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=gb2312" />
<title>无标题文档</title>
<? $ax->printjavascript();?>
</head>
<style type="text/css">
#div{ width:800px; margin:0 auto;}
.ad_99 { width:800px; margin:0 auto; border:1px solid #a0a0a4; font:"新宋体"; font-size:18px;}
.ad_95 { width:200px; float:left; clear:left; background:#ffdfff; font:"新宋体"; font-size:18px;}
.ad_93 { width:550px; float:left; clear:right; background:#ffdfff; font:"新宋体"; font-size:18px;}
.ad_90 { width:800px; clear:both; font:"新宋体"; font-size:18px;}
.ad_91 { width:50px; float:right; background:#ff0000; font:"新宋体"; font-size:18px;}
.ad_88 {width:100px; float:left; margin:0 0 0 47px;font:"新宋体"; font-size:12px;}
.ad_87 {width:195px; float:left;font:"新宋体"; font-size:12px;}
#tishi { width:300px; height:180px; background:#0099ff; font-size:18px; border:1px solid #000000; display:block; margin:0 auto; text-align:center; clear:both; display:none;}
#form_1 { width:500px; height:200px; margin:0 auto; clear:both;}
.comment_input { font-size:12px; border:2px solid #f1f1f1;
}
.comment_input_2 { font-size:14px; border:2px solid #f1f1f1;margin:0 0 5px 0;
}
.submit_type { background: #f8f8f8;}
.checkimg { font-size:29px; color:#d6d6d6; border:1px solid #f1f1f1;}
.form_div_type { border:2px solid #f1f1f1;}
</style>
<body onload="xajax_xx(1)">
<script type="text/jscript">
xajax.loadingfunction =function()
{
tishi.style.display="block";
}
xajax.doneloadingfunction=function()
{
tishi.style.display="none";
}
</script>
<script language="javascript">
function ansum()
{
if(document.getelementbyid("content_4").value.length==0 || document.getelementbyid("content_4").value.length>600)
{
alert("不过超过300个汉字,和不能为空");
return false;
}
}
//禁止刷新,回退
function onkeydown()
{
if ( (event.altkey) || ((event.keycode == 8) &&
(event.srcelement.type != "text" &&
event.srcelement.type != "textarea" &&
event.srcelement.type != "password")) ||
((event.ctrlkey) && ((event.keycode == 78) || (event.keycode == 82)) ) ||
(event.keycode == 116) ) {
event.keycode = 0;
event.returnvalue = false;
}
}
document.onkeydown = onkeydown;
function stopy(){ //这个是禁用鼠标右键
return false;
}
document.oncontextmenu=stopy;
</script>
<div class="ad_99"> </div>
<div class="ad_99"> </div>
<div id="div">
</div>
<?
$pp = new createdb;
$pp->createconn();
$pp->mysql="select count(*) from content where webid=$_session[wid]";
$pp->getresule();
$pp->getrow();
$lunnum=$pp->row[0]; //总记录数
$mun_5="";
$mun_3="";
$mun_3=$lunnum % mun_2; //看是否整除/然后算出总页数
if($mun_3)
{
$mun_3=$lunnum / mun_2 + 1;
}
else
{
$mun_3=$lunnum / mun_2;
}
$_session['$mun_5']=$mun_3;
?>
<div class="ad_88">总评论数:<? echo($lunnum);?></div>
<div class="ad_87"><span id="ren"></span></div>
<div class="ad_87">页码:
<?
for($i=1;$i<=$mun_3;$i++)
{
if($i<10)
{
$mun_4 = "<span onclick='xajax_xx($i)' style='cursor:pointer'>$i</span> ";
echo($mun_4);
}
}
if($i>10)
{
echo("..");
}
?></div>
<div class="ad_87">当前在线人数:</div>
<div id="tishi">
<p> </p>
<p> </p>
<p>正在加栽。。。。。。
</p>
</div>
<div id="form_1" class="form_div_type">
<form id="form_d" name="formd" method="post" action="index.php" onsubmit="return ansum();">
<input name="tallnane" type="text" class="comment_input_2" value="昵称" size="8" maxlength="8"/>
<input type="hidden" name="hidda" value="yhm" />
<img src="checkimg.php" align="absbottom" />
<input name="chetxt" type="text" class="checkimg" value="验证码" size="8" maxlength="8" onblur="xajax_callmsg()"/>
<span id="check_msg">dfdfdf</span> <br>
<textarea name="content_4" cols="70" rows="10" class="comment_input"></textarea>
<input name="btn" type="submit" id="btn" value="提交留言" class="submit_type" disabled="true"/>
</form>
</div>
</body>
</html>
session_start();
require_once("../conn/mysqlconn.php");
require_once('xajax.inc.php');
if(!isset($_session['wid']))
{
$_session['wid']=$_get["wid"];
}
if(isset($_post['content_4']))
{
$con = new createdb;
$con->createconn();
$con->mysql="insert into content(webid,tallname,txtconntent) values('$_session[wid]','$_post[tallnane]','$_post[content_4]')";
$con->getresule();
}
@define(mun_2,3); //定义每页显示几条记
function tt($form_mm)
{
if($_session["code"]==$form_mm['chetxt']) //用xajax来取得验证码,不同以前的那种看验证码对不对
{
$erro_msg="谢谢你的支持";
$jjs="";
}
else
{
$erro_msg="验证码不对,请重新在写";
$jjs="true";
}
$obj= new xajaxresponse();
$obj->addassign("check_msg","innerhtml",$erro_msg);
$obj->addassign("btn","disabled",$jjs);
return $obj->getxml();
}
function callmsg()
{
$obj= new xajaxresponse();
$obj->addscript("xajax_tt(xajax.getformvalues('form_d'));");
return $obj->getxml();
}
function xx($uu)
{
$ad_2="";
$bb=mun_2;
$start=$uu*mun_2 - mun_2;
$ii=$uu-1;
if($uu==1)
{
$ii=$uu;
}
$i=$uu+1;
if($i>@$_session['$mun_5'])
{
$i=$uu;
}
$pp = new createdb;
$pp->createconn();
$pp->mysql="select count(*) from content where webid=$_session[wid]";
$pp->getresule();
$pp->getrow();
$u=$pp->row[0];
$t=$u;
$pp->mysql="select * from content where webid=$_session[wid] group by id desc limit $start,$bb";
$pp->getresule();
$start=$start+1;
while($pp->getrow())
{
$ad="<div class='ad_95'>倪称".$pp->row["tallname"]."</div><div class='ad_93'>广告:".$pp->row["tellall"]."</div><div class='ad_91'>".$start."楼</div><div class='ad_90'>内容:".$pp->row["txtconntent"]."</div>";
$ad_2=$ad_2.$ad;
@$qqaa="<span onclick='xajax_xx($ii)' style='cursor:pointer'>上一页</span> <span onclick='xajax_xx($i)' style='cursor:pointer'>下一页</span> ";
$start++;
}
$obj= new xajaxresponse();
$obj->addassign("div","innerhtml",$ad_2);
$obj->addassign("ren","innerhtml",@$qqaa);
$obj->addscript("if ( (event.altkey) || ((event.keycode == 8) &&
(event.srcelement.type != 'text' &&
event.srcelement.type != 'textarea' &&
event.srcelement.type != 'password')) ||
((event.ctrlkey) && ((event.keycode == 78) || (event.keycode == 82)) ) ||
(event.keycode == 116) ) {
event.keycode = 0;
event.returnvalue = false;
}
");
return $obj->getxml();
}
$ax = new xajax();
$ax->registerfunction("xx");
$ax->registerfunction("tt");
$ax->registerfunction("callmsg");
$ax->processrequests();
?>
<!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=gb2312" />
<title>无标题文档</title>
<? $ax->printjavascript();?>
</head>
<style type="text/css">
#div{ width:800px; margin:0 auto;}
.ad_99 { width:800px; margin:0 auto; border:1px solid #a0a0a4; font:"新宋体"; font-size:18px;}
.ad_95 { width:200px; float:left; clear:left; background:#ffdfff; font:"新宋体"; font-size:18px;}
.ad_93 { width:550px; float:left; clear:right; background:#ffdfff; font:"新宋体"; font-size:18px;}
.ad_90 { width:800px; clear:both; font:"新宋体"; font-size:18px;}
.ad_91 { width:50px; float:right; background:#ff0000; font:"新宋体"; font-size:18px;}
.ad_88 {width:100px; float:left; margin:0 0 0 47px;font:"新宋体"; font-size:12px;}
.ad_87 {width:195px; float:left;font:"新宋体"; font-size:12px;}
#tishi { width:300px; height:180px; background:#0099ff; font-size:18px; border:1px solid #000000; display:block; margin:0 auto; text-align:center; clear:both; display:none;}
#form_1 { width:500px; height:200px; margin:0 auto; clear:both;}
.comment_input { font-size:12px; border:2px solid #f1f1f1;
}
.comment_input_2 { font-size:14px; border:2px solid #f1f1f1;margin:0 0 5px 0;
}
.submit_type { background: #f8f8f8;}
.checkimg { font-size:29px; color:#d6d6d6; border:1px solid #f1f1f1;}
.form_div_type { border:2px solid #f1f1f1;}
</style>
<body onload="xajax_xx(1)">
<script type="text/jscript">
xajax.loadingfunction =function()
{
tishi.style.display="block";
}
xajax.doneloadingfunction=function()
{
tishi.style.display="none";
}
</script>
<script language="javascript">
function ansum()
{
if(document.getelementbyid("content_4").value.length==0 || document.getelementbyid("content_4").value.length>600)
{
alert("不过超过300个汉字,和不能为空");
return false;
}
}
//禁止刷新,回退
function onkeydown()
{
if ( (event.altkey) || ((event.keycode == 8) &&
(event.srcelement.type != "text" &&
event.srcelement.type != "textarea" &&
event.srcelement.type != "password")) ||
((event.ctrlkey) && ((event.keycode == 78) || (event.keycode == 82)) ) ||
(event.keycode == 116) ) {
event.keycode = 0;
event.returnvalue = false;
}
}
document.onkeydown = onkeydown;
function stopy(){ //这个是禁用鼠标右键
return false;
}
document.oncontextmenu=stopy;
</script>
<div class="ad_99"> </div>
<div class="ad_99"> </div>
<div id="div">
</div>
<?
$pp = new createdb;
$pp->createconn();
$pp->mysql="select count(*) from content where webid=$_session[wid]";
$pp->getresule();
$pp->getrow();
$lunnum=$pp->row[0]; //总记录数
$mun_5="";
$mun_3="";
$mun_3=$lunnum % mun_2; //看是否整除/然后算出总页数
if($mun_3)
{
$mun_3=$lunnum / mun_2 + 1;
}
else
{
$mun_3=$lunnum / mun_2;
}
$_session['$mun_5']=$mun_3;
?>
<div class="ad_88">总评论数:<? echo($lunnum);?></div>
<div class="ad_87"><span id="ren"></span></div>
<div class="ad_87">页码:
<?
for($i=1;$i<=$mun_3;$i++)
{
if($i<10)
{
$mun_4 = "<span onclick='xajax_xx($i)' style='cursor:pointer'>$i</span> ";
echo($mun_4);
}
}
if($i>10)
{
echo("..");
}
?></div>
<div class="ad_87">当前在线人数:</div>
<div id="tishi">
<p> </p>
<p> </p>
<p>正在加栽。。。。。。
</p>
</div>
<div id="form_1" class="form_div_type">
<form id="form_d" name="formd" method="post" action="index.php" onsubmit="return ansum();">
<input name="tallnane" type="text" class="comment_input_2" value="昵称" size="8" maxlength="8"/>
<input type="hidden" name="hidda" value="yhm" />
<img src="checkimg.php" align="absbottom" />
<input name="chetxt" type="text" class="checkimg" value="验证码" size="8" maxlength="8" onblur="xajax_callmsg()"/>
<span id="check_msg">dfdfdf</span> <br>
<textarea name="content_4" cols="70" rows="10" class="comment_input"></textarea>
<input name="btn" type="submit" id="btn" value="提交留言" class="submit_type" disabled="true"/>
</form>
</div>
</body>
</html>
上一篇: PHP 常见郁闷问题答解
下一篇: 睡觉前吃香蕉好吗