用html做的简易留言簿界面

html-css026

用html做的简易留言簿界面,第1张

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

</head>

<body>

<h1 align="center" style="color: red">用户留言簿</h1>

<hr color="red" />

<form action="baidu.html" method="post">

<table border="1" cellspacing="0" bordercolor="black" align="center" width="700px" height="300px" style="color: blue">

<tr>

<td width="100" height="50">用 户 名:</td>

<td><input type="text" name="name" /></td>

<td>密 码:</td>

<td><input type="password" name="pwd" /></td>

</tr>

<tr>

<td width="100" height="50">电子信箱:</td>

<td><input type="text" name="email" /></td>

<td>民 族:</td>

<td>

<select name="名族">

<option value="汉族" selected="selected">汉族</option>

<option value="少数名族">少数民族</option>

</select>

</td>

</tr>

<tr>

<td width="100" height="50">性 别:</td>

<td><input type="text" name="sex" />

<input type="radio" name="sex" value="男" checked="checked" />

<input type="radio" name="sex" value="女" />

</td>

<td>爱 好</td>

<td>

<input type="checkbox" name="lanqiu" value="aihao" />篮球

<input type="checkbox" name="zuqiu" value="aihao" />足球

<input type="checkbox" name="paiqiu" value="aihao" />排球

<input type="checkbox" name="qita" value="aihao" />其它

</td>

</tr>

<tr>

<td width="100" height="100">留 言:</td>

<td colspan="4">

<textarea name="liuyan" rows="5" cols="50">请多多指教</textarea>

</td>

</tr>

<tr>

<td height="50" colspan="5" align="center">

<input type="submit" value="确定" />

<input type="reset" value="重写" />

</td>

</tr>

</table>

</form>

</body>

</html>

<?php

//开启SESSION,启用SESSION变量检查表单是否重复提交

session_start()

$title="留言"

include("include/header.php")

include("include/class.imobj.php")//检查表单,符合要求的留言插入数据库

$sub=$_POST['sub']//防止恶意留言代码并规划文本格式

function clean($string){

$string = stripslashes($string)

$string = addslashes($string)

$string = htmlspecialchars($string)

$string = strip_tags($string)

$string = trim($string)

$string = nl2br($string)

$string = substr($string,0,250)

return $string

}

//判断表单

if (!empty($_POST['name'])&&!empty($_POST['email'])&&!empty($_POST['message'])&&$_SESSION["userlastaction"]<$_POST["lastaction"]) {

if (!strcasecmp($_POST['checknum'],$_SESSION['chenknum'])){

$name=clean($_POST['name'])

$email=clean($_POST['email'])

$message=clean($_POST['message'])

$_SESSION["userlastaction"]++

/*

include("include/conn_ruin.php")

$sql = "INSERT INTO guestbook (name,time_at,email,message) VALUES('$name',NOW( ),'$email','$message')"

$result = @mysql_query($sql,$conn)

mysql_close($conn)

*/

$error = 'Now , the message page isn\'t opening until i let it open! you can do anything if you can , trash!,'

}else {

$error = "出错:验证码错误! Warning: Authentication code error!"

}

}else {

$error ="出错:您的表单没有填写完整或重复提交,请重新检查内容或浏览其它感兴趣的页面!  Warning:You did not fill out forms, or to repeat. Please check. Or visit other pages!"

}//验证码部分

$check = new imobj()

$check->construct()

$check->createimg()

$_SESSION['chenknum'] = $check->getid()?>

<body id="me">

<div id="menu">

<ul>

<li id="home"><a href="home.php" title="首页">HOME</a></li>

<li id="blog"><a href="blog.php" title="博客">BLOG</a></li>

<li id="about"><a href="about.php" title="关于我">ABOUT</a></li>

<li id="message"><a href="message.php" title="给我留言">MESSAGE</a></li>

</ul>

</div>

<hr />

<div id="content">

<fieldset>

<div id="view"><?php if (!empty($error)&&$sub=="true") echo "<span style=\"color:#fffbackground:redfont-weight:boldfont-size:12px\" >$error</span>" ?>

<hr /> <?php

include("include/conn_ruin.php")//分页部分 //取得留言总条数

$sql = "SELECT COUNT(*) FROM guestbook"

$result=mysql_query($sql,$conn)

$mes_number = mysql_fetch_row($result)//设置每页显示条数

$every_number = 12

//获取最后的页数

$last_page_number = floor($mes_number[0] /$every_number)+1//获取当前所请求的页码

if (empty($_GET['page']) || $_GET['page']<1)

{

$page=1

} else if ($_GET['page']>$last_page_number)

{

$page=$last_page_number

}else {

$page = $_GET['page']

} //echo "everynumber:".$every_number."

".$last_page_number."

".$page//获取LIMIT参数

$a = ($page-1)*$every_number//echo "

$a"//读取数据库并显示留言 $sql ="SELECT * FROM guestbook ORDER BY time_at DESC LIMIT $a,$every_number"

$result=mysql_query($sql,$conn)

echo "<table>"

while($row = mysql_fetch_row($result))

{

echo "<tr class=\"title\"><td>"

echo "<b>".$row[1]."</b> | ".$row[2]."</td></tr>"

echo "<tr class=\"mess\"><td>"

echo $row[4]."</td></tr>"

}

echo "</table>"

mysql_close($conn)?>

</div>

<hr />

<a href="message.php?page=1">首页</a> <a href="message.php?page=<?=$page-1?>">上一页</a> <a href="message.php?page=<?=$page+1?>">下一页</a> <a href="message.php?page=<?=$last_page_number?>">末页</a>

<hr />

<div id="writein">

<h4>填写您的留言,如需站长回复,请务必填写您的真实E-Mail</h4>

<form name="test" onSubmit="return CheckForm()" action="message.php" method="post">

姓名[name]:<input type="text" name="name" maxlength=15 /> 邮箱[email]:<input type="text" name="email" maxlength=50 />

<p>留言[message]:验证 : <input type="text" size="6" name="checknum" /> <img src ="img.php" /></p>

<p><textarea cols="62" rows="5" name="message"></textarea></p>

<input type="hidden" name="sub" value="true" /><input type="hidden" name="lastaction" value=<?=$_SESSION["userlastaction"]+1 ?>/>

<input type="hidden" name="checknumc" value="<?=$numc?>" />

<p><input class="button" type="submit" value="提 交" /><input class="button" type="reset" value="重 写" /></p>

</form>

</div>

<hr />

</fieldset>

</div>

<?php include("include/footer.php") ?>

</body>

</html>很久以前写的一个PHP留言板,防不了垃圾留言

<textarea></textarea>

这个就是html中的留言框了,是大的,小的是:

<input type="text" />