支持oicq头像的留言簿(二)

addnote.php

 1<html>
 2<head>
 3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 4<title>添加留言</title>
 5<style type="text/css">   
 6<!--   
 7.white12 { font-size: 12pt; color: #FFFFFF; text-decoration: none}   
 8\-->   
 9</style>
10</head>
11<body bgcolor="#FFFFFF">
12<table border="0" cellpadding="0" cellspacing="0" height="61" width="98%">
13<tr>
14<td height="62" width="34%"><a href="http://www.medguider.com"><img alt="医学导航网" border="0" height="60" src="image/logo.gif" width="243"/></a></td>
15<td height="62" width="66%">
16<div align="center"><img height="60" src="image/note.gif" width="410"/><img height="60" src="image/y1.gif" width="60"/></div>
17</td>
18</tr>
19</table>   

include ("config.php");
if ($submit){
$time=date("Y年m月d日 H:i:s A");
$ip=$REMOTE_ADDR;//留言人ip地址
$name=trim($name);
$email=trim($email);
$title=strip_tags($top);
$nnote=nl2br(strip_tags($content));//先去掉html标记,再将换行符转成 <br/>。
if (!$name||!$email||!$title||!$nnote){ //检查是否填写完整
echo "对不起,您必须填所有内容!<br/>"."<a href="javascript:history.back()">返回</a>";
exit; }elseif(!ereg('^[-!#$%&amp;'+./0-9=?A-Z^_a-z{|}~]+'.'@'.'[-!#$%&amp;amp;'*+\/0-9=?A-Z^_a-z{|}~]+.'.'[-!#$%&amp;'+\./0-9=?A-Z^_`a-z{|}~]+$',$email) //email合法性验证
){
echo "email不合法!<br/>"."<a href="javascript:history.back()">返回</a>";
exit;
}
//写入数据库
$sql="INSERT INTO notebook (name,email,time,face,ip,title,nnote) VALUES ('$name','$email','$time','$face','$ip','$title','$nnote')";
$result = mysql_query($sql,$db);
mysql_close($db);
echo "留言成功!";
}

  1<table align="center" border="1" bordercolor="#3366FF" cellpadding="0" cellspacing="0" width="99%">
  2<tr bgcolor="#3366FF">
  3<td class="white12" height="26" width="81%"><a class="white12" href="../index.php">首页</a>   
  4&gt; <a class="white12" href="index.php">留言簿</a>   
  5&gt; 添加留言</td>
  6<td class="white12" height="26" width="19%"><a class="white12" href="index.php">查看留言</a>
  7</td>
  8</tr>
  9<tr>
 10<td colspan="2">
 11<form action="addnote.php" method="post" name="form1">
 12<table border="0" cellpadding="0" cellspacing="0" width="99%">
 13<tr>
 14<td width="54%"> </td>
 15<td rowspan="2" width="46%">选择一个自己喜欢的头像:<br/>
 16<img height="32" src="image/face/icon1.gif" width="32"/>
 17<input checked="" name="face" type="radio" value="1"/>
 18<img height="32" src="image/face/icon2.gif" width="32"/>
 19<input name="face" type="radio" value="2"/>
 20<img height="32" src="image/face/icon3.gif" width="32"/>
 21<input name="face" type="radio" value="3"/>
 22<img height="32" src="image/face/icon4.gif" width="32"/>
 23<input name="face" type="radio" value="4"/>
 24<img height="32" src="image/face/icon5.gif" width="32"/>
 25<input name="face" type="radio" value="5"/>
 26<img height="32" src="image/face/icon6.gif" width="32"/>
 27<input name="face" type="radio" value="6"/>
 28<img height="32" src="image/face/icon7.gif" width="32"/>
 29<input name="face" type="radio" value="7"/>
 30<img height="32" src="image/face/icon8.gif" width="32"/>
 31<input name="face" type="radio" value="8"/>
 32<img height="32" src="image/face/icon9.gif" width="32"/>
 33<input name="face" type="radio" value="9"/>
 34<img height="32" src="image/face/icon10.gif" width="32"/>
 35<input name="face" type="radio" value="10"/>
 36<img height="32" src="image/face/icon11.gif" width="32"/>
 37<input name="face" type="radio" value="11"/>
 38<img height="32" src="image/face/icon12.gif" width="32"/>
 39<input name="face" type="radio" value="12"/>
 40<img height="32" src="image/face/icon13.gif" width="32"/>
 41<input name="face" type="radio" value="13"/>
 42<img height="32" src="image/face/icon14.gif" width="32"/>
 43<input name="face" type="radio" value="14"/>
 44<img height="32" src="image/face/icon15.gif" width="32"/>
 45<input name="face" type="radio" value="15"/>
 46<img height="32" src="image/face/icon16.gif" width="32"/>
 47<input name="face" type="radio" value="16"/>
 48<img height="32" src="image/face/icon17.gif" width="32"/>
 49<input name="face" type="radio" value="17"/>
 50<img height="32" src="image/face/icon18.gif" width="32"/>
 51<input name="face" type="radio" value="18"/>
 52<img height="32" src="image/face/icon19.gif" width="32"/>
 53<input name="face" type="radio" value="19"/>
 54<img height="32" src="image/face/icon20.gif" width="32"/>
 55<input name="face" type="radio" value="20"/>
 56<img height="32" src="image/face/icon21.gif" width="32"/>
 57<input name="face" type="radio" value="21"/>
 58<img height="32" src="image/face/icon22.gif" width="32"/>
 59<input name="face" type="radio" value="22"/>
 60<img height="32" src="image/face/icon23.gif" width="32"/>
 61<input name="face" type="radio" value="23"/>
 62<img height="32" src="image/face/icon24.gif" width="32"/>
 63<input name="face" type="radio" value="24"/>
 64<img height="32" src="image/face/icon25.gif" width="32"/>
 65<input name="face" type="radio" value="25"/>
 66<img height="32" src="image/face/icon26.gif" width="32"/>
 67<input name="face" type="radio" value="26"/>
 68<img height="32" src="image/face/icon27.gif" width="32"/>
 69<input name="face" type="radio" value="27"/>
 70<img height="32" src="image/face/icon28.gif" width="32"/>
 71<input name="face" type="radio" value="28"/>
 72<img height="32" src="image/face/icon29.gif" width="32"/>
 73<input name="face" type="radio" value="29"/>
 74<img height="32" src="image/face/icon30.gif" width="32"/>
 75<input name="face" type="radio" value="30"/>
 76<img height="32" src="image/face/icon31.gif" width="32"/>
 77<input name="face" type="radio" value="31"/>
 78<img height="32" src="image/face/icon32.gif" width="32"/>
 79<input name="face" type="radio" value="32"/>
 80<img height="32" src="image/face/icon33.gif" width="32"/>
 81<input name="face" type="radio" value="33"/>
 82<img height="32" src="image/face/icon34.gif" width="32"/>
 83<input name="face" type="radio" value="34"/>
 84<img height="32" src="image/face/icon35.gif" width="32"/>
 85<input name="face" type="radio" value="35"/>
 86<img height="32" src="image/face/icon36.gif" width="32"/>
 87<input name="face" type="radio" value="36"/>
 88<img height="32" src="image/face/icon37.gif" width="32"/>
 89<input name="face" type="radio" value="37"/>
 90<img height="32" src="image/face/icon38.gif" width="32"/>
 91<input name="face" type="radio" value="38"/>
 92<img height="32" src="image/face/icon39.gif" width="32"/>
 93<input name="face" type="radio" value="39"/>
 94<img height="32" src="image/face/icon40.gif" width="32"/>
 95<input name="face" type="radio" value="40"/>
 96<img height="32" src="image/face/icon41.gif" width="32"/>
 97<input name="face" type="radio" value="41"/>
 98<img height="32" src="image/face/icon42.gif" width="32"/>
 99<input name="face" type="radio" value="42"/>
100<img height="32" src="image/face/icon43.gif" width="32"/>
101<input name="face" type="radio" value="43"/>
102<img height="32" src="image/face/icon44.gif" width="32"/>
103<input name="face" type="radio" value="44"/>
104<img height="32" src="image/face/icon45.gif" width="32"/>
105<input name="face" type="radio" value="45"/>
106<img height="32" src="image/face/icon46.gif" width="32"/>
107<input name="face" type="radio" value="46"/>
108<img height="32" src="image/face/icon47.gif" width="32"/>
109<input name="face" type="radio" value="47"/>
110<img height="32" src="image/face/icon48.gif" width="32"/>
111<input name="face" type="radio" value="48"/>
112<img height="32" src="image/face/icon49.gif" width="32"/>
113<input name="face" type="radio" value="49"/>
114<img height="32" src="image/face/icon50.gif" width="32"/>
115<input name="face" type="radio" value="50"/>
116<img height="32" src="image/face/icon51.gif" width="32"/>
117<input name="face" type="radio" value="51"/>
118<img height="32" src="image/face/icon52.gif" width="32"/>
119<input name="face" type="radio" value="52"/>
120<img height="32" src="image/face/icon53.gif" width="32"/>
121<input name="face" type="radio" value="53"/>
122<img height="32" src="image/face/icon54.gif" width="32"/>
123<input name="face" type="radio" value="54"/>
124<img height="32" src="image/face/icon55.gif" width="32"/>
125<input name="face" type="radio" value="55"/>
126<img height="32" src="image/face/icon56.gif" width="32"/>
127<input name="face" type="radio" value="56"/>
128<img height="32" src="image/face/icon57.gif" width="32"/>
129<input name="face" type="radio" value="57"/>
130<img height="32" src="image/face/icon58.gif" width="32"/>
131<input name="face" type="radio" value="58"/>
132<img height="32" src="image/face/icon59.gif" width="32"/>
133<input name="face" type="radio" value="59"/>
134<img height="32" src="image/face/icon60.gif" width="32"/>
135<input name="face" type="radio" value="60"/>
136<img height="32" src="image/face/icon61.gif" width="32"/>
137<input name="face" type="radio" value="61"/>
138<img height="32" src="image/face/icon62.gif" width="32"/>
139<input name="face" type="radio" value="62"/>
140<img height="32" src="image/face/icon63.gif" width="32"/>
141<input name="face" type="radio" value="63"/>
142<img height="32" src="image/face/icon64.gif" width="32"/>
143<input name="face" type="radio" value="64"/>
144</td>
145</tr>
146<tr>
147<td width="54%">名字    
148<input name="name" type="text"/>
149<br/>   
150Email   
151<input name="email" type="text"/>
152<br/>   
153标题   
154<input name="top" size="50" type="text"/>
155<br/>   
156内容<br/>
157<textarea cols="50" name="content" rows="20"></textarea>
158</td>
159</tr>
160<tr>
161<td colspan="2">
162<div align="center">
163<input name="submit" type="submit" value="确定"/>
164<input name="cancel" type="reset" value="重写"/>
165</div>
166</td>
167</tr>
168</table>
169</form>
170</td>
171</tr>
172</table>
173<p><a class="white12" href="main.php?user=&lt;? echo $user?&gt;"><br/>
174</a></p>
175</body>
176</html>

delnote.php

1   
2include ("config.php");   
3if ($superadmin){ //如果已经进行管理员登陆,进行密码验证   
4if (!($user==$username)||!($psw==$password)){   
5echo "密码错误";   
6exit;   
7}   
8}else{ //管理员登陆   
9echo "

<form action="$PHP_SELF" method="post" name="form1">";
echo "<div align="center"> 请输入管理员密码<br/>";
echo "管理员";
echo "<input name="user" type="text"/><br/>";
echo "密码";
echo "<input name="psw" type="password"/><br/>";
echo "<input name="superadmin" type="submit" value="进入"/><br/>";
echo "<input name="cancel" type="reset" value="重写"/></div>";
echo "</form>

1";   
2exit;   
3}   
4if($del==1){ //判断是否要删除   
5mysql_query("delete from notebook where time='$time'",$db); //以留言时间为删除标志   
6echo "删除成功!";   
7}   
 1<html>
 2<head>
 3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 4<title>删除留言</title>
 5<style type="text/css">   
 6<!--   
 7.blue9 { font-size: 9pt; color: #0099FF; text-decoration: none}   
 8.black9 { font-size: 9pt; text-decoration: none}   
 9.purple10 { font-size: 10pt; color: #9900FF; text-decoration: none}   
10.white12 { font-size: 12pt; color: #FFFFFF; text-decoration: none}   
11a:visited { color: #FFFFFF}   
12a:link { color: #FFFFFF}   
13\-->   
14</style>
15</head>
16<body bgcolor="#FFFFFF">   

$result = mysql_query("SELECT * FROM notebook ",$db);
$row=mysql_num_rows($result);//查看结果有多少行
$max=$row; //帖子总数
//设每页显示10篇,$p总页数,$page第几页,$low 从第几行开始读,$x 读取几行
if (!$page){$page=1;}
$p=ceil($max/10);
$low=10*($page-1);
if($page==$p&amp;&amp;($max%10)&lt;&gt;0){$x=($max%10);} else {$x=10;}//如果是最后一页,且不是10的整倍数,读取$max除以10的余数,否则取10
if($max==0){$x=0;}//如果没有帖子,$x取0
$result = mysql_query("select * from notebook ORDER BY time DESC limit $low,$x",$db);

 1<table border="0" cellpadding="0" cellspacing="0" height="61" width="98%">
 2<tr>
 3<td height="62" width="34%"><a href="http://www.medguider.com"><img alt="医学导航网" border="0" height="60" src="image/logo.gif" width="243"/></a></td>
 4<td height="62" width="66%">
 5<div align="center"><img height="60" src="image/note.gif" width="410"/><img height="60" src="image/y1.gif" width="60"/></div>
 6</td>
 7</tr>
 8</table>
 9<table align="center" border="1" bordercolordark="#FFFFFF" bordercolorlight="#003399" cellpadding="0" cellspacing="0" height="253" width="95%">
10<tr>
11<td height="250">
12<table bgcolor="#3366FF" border="0" cellpadding="0" cellspacing="0" height="32" width="95%">
13<tr>
14<td class="white12" width="28%">首页   
15&gt; <a class="white12" href="index.php">留言簿</a></td>
16<td class="white12" width="56%">   

echo "帖子总数:  ",$max,"   第";
for ($n=1;$n&lt;=$p;$n++){
echo "<a href="index.php?page=$n">$n</a> ";
}
echo "页";

1</td>
2<td width="16%"><a class="white12" href="index.php">查看留言</a></td>
3</tr>
4</table>   

for ($i=0;$i&lt;=($x-1);$i++) {
$email=mysql_result($result,$i,'email');
$face=mysql_result($result,$i,'face');
$face='image/face/icon'.$face;
$name=mysql_result($result,$i,'name');
$time=mysql_result($result,$i,'time');
$ip=mysql_result($result,$i,'ip');
$title=mysql_result($result,$i,'title');
$nnote=mysql_result($result,$i,'nnote');
echo "<table border="0" bordercolor="#FFFFFF" cellpadding="0" cellspacing="0" height="107'" width="100%"> <tr bgcolor="#eeeeee">";
echo "<td bgcolor="#eeeeee" class="blue9" height="33" width="10%"> <img height="32" src="$face.gif" width="32"/></td>";
echo "<td bgcolor="#eeeeee" class="blue9" height="33" width="16%">留言人:$name</td>";
echo "<td bgcolor="#eeeeee" class="blue9" height="33" width="41%">发表于:$time</td>";
echo "<td bgcolor="#eeeeee" class="blue9" height="33" width="12%"><a href="mailto:$email"><img border="0" height="16" src="image/email.gif" width="16"/></a></td>";
echo "<td class="blue9" height="33" width="21%"><img height="15" src="image/ip.gif" width="13"/>  $ip <a href="$PHP_SELF?del=1&amp;time=$time&amp;superadmin=$superadmin&amp;user=$user&amp;psw=$psw"><img border="0" height="16" src="image/del.gif" width="16"/></a></td> </tr> <tr>";
echo "<td class="purple10" colspan="5" height="33">标题:$title</td> </tr>";
echo "<tr bgcolor="#ffffff"><td class="black9" colspan="5" height="37">留言内容:$nnote</td></tr></table>";
}
mysql_close($db);

1</td>
2</tr>
3</table>
4</body>
5</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus