![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
有谁能够帮我注释下面的页面,谢谢:
<?php
include("config.php");
$liuyan="liuyan";
/////////////////////////////////////////////////////////////////////////
if($_GET[srcid])
{$srcid=$_GET[srcid];}
else
{$srcid=$_POST[srcid];}
if($_GET[active])
{$active=$_GET[active];}
else
{$active=$_POST[active];}
if($_GET[passwd])
{$passwd=$_GET[passwd];}
else
{$passwd=$_POST[passwd];}
$name=$_POST[name];
$comment=$_POST[comment];
$email=$_POST[email];
$url=$_POST[url];
$parent=$_POST[parent];
$sex=$_POST[sex];
$face=$_POST[face];
$errorno=$_GET[errorno];
////////////////////////////////////////////////////////////////////////////
if ($active==1)
{
if (empty($name))
{
$errorno="a";
if (!empty($srcid))
{
header("Location
_SERVER[PHP_SELF]?errorno=$errorno&srcid=$srcid");
}
else
{
header("Location
_SERVER[PHP_SELF]?errorno=$errorno");
}
exit;
}
elseif (empty($comment))
{
$errorno="b";
if (!empty($srcid))
{
header("Location
_SERVER[PHP_SELF]?errorno=$errorno&srcid=$srcid");
}
else
{
header("Location
_SERVER[PHP_SELF]?errorno=$errorno");
}
exit;
}
elseif(!empty($email) and !eregi("@",$email))
{
$errorno="c";
if (!empty($srcid))
{
header("Location
_SERVER[PHP_SELF]?errorno=$errorno&srcid=$srcid");
}
else
{
header("Location
_SERVER[PHP_SELF]?errorno=$errorno");
}
exit;
}
else
{
setcookie( "GBName", $name, time()+99999999);
setcookie( "GBEmail", $email, time()+99999999);
setcookie( "GBUrl", $url, time()+99999999);
if (empty($passwd))
{
srand(date("s"));
while($i< 3)
{
$passwd.=chr((rand()%10)+48);
$i++;
}
}
$addname1 = addslashes($name); //处理$name
$addname = ereg_replace("<[^>]*>", "", $addname1);
$email1 = addslashes($email); //处理$email
$mail = ereg_replace("<[^>]*>", "", $email1);
$addkommentar = addslashes($comment); //处理$comment
if($htmlcode=="true")
{
$entry = $addkommentar;
}
else
{
$entry = ereg_replace("<[^>]*>", "", $addkommentar);
}
$inputdate=date("Y-m-d H:i:s");
if ($parent==0 )
{
$eintragquery = "INSERT INTO
$liuyan (name,passwd,sex,face,email,url,comment,inputdate) VALUES('$addname','$passwd','$sex','$face','$mail','$url','$entry','$inputdate')";
mysql_query($eintragquery) or die(mysql_error());
$result = mysql_query("select * from $liuyan
where inputdate='$inputdate'");
$row = mysql_fetch_array($result);
$id=$row[id];
$thread=$id;
$sort=$id;
$reply=0;
mysql_query("update $liuyan set thread='$thread',
sort='$sort',reply='$reply' where id='$id'");
}
else
{
$result = mysql_query("select * from $liuyan
where id='$parent'");
$row = mysql_fetch_array($result);
$srcthread=$row[thread];
$srcsort=$row[sort];
$srcreply=$row[reply];
$reply=$srcreply+1;
mysql_query("update $liuyan set reply='$reply'
where id='$parent'");
$thread=$srcthread;
$sort="$srcsort"."."."$reply";
$reply=0;
$eintragquery = "INSERT INTO $liuyan (thread,sort,reply,name,passwd,sex,face,email,url,
comment,inputdate) VALUES ('$thread','$sort','$reply',
'$addname','$passwd','$sex','$face','$mail','$url','$entry','$inputdate')";
mysql_query($eintragquery) or die(mysql_error());
}
header("Location:gbook.php?passwd=$passwd");
exit;
}
}
//########################开始显示输入表单#############################
if (empty($srcid))
{
$title="访客留言";
$parent="0";
}
else
{
$title="回应留言";
$parent=$srcid;
}
?>

