session_start(); // 开始session session_register("userregister"); $userregister=$username; include "class/config.php"; $result = mysql_query("SELECT * FROM user where user='$username'",$db); if (mysql_num_rows($result)==0){ //若返回列的数目为0,说明无此资料 echo "无此用户!"; exit;} $userpsw=strtoupper(trim($userpsw)); $password=trim(mysql_result($result,0,'psw')); $password=strtoupper($password);//取得密码,转换成大写 $userpsw=strtoupper($userpsw); if (!($userpsw==$password)){ echo "密码错误!"; mysql_close($db); exit; } $name=mysql_result($result,0,"name"); $count=mysql_result($result,0,"count")+1;//成员计数器加1 mysql_query("UPDATE user SET count=$count where user='$username'",$db); ?>
$result = mysql_query("SELECT * FROM notebook",$db); $row=mysql_num_rows($result); if ($row<=1) {$x=$row;} else {$x=2;} $result = mysql_query("select * from notebook ORDER BY time DESC limit 0,$x",$db);//读取最近2条留言 for ($i=0;$i<=($x-1);$i++) { $user=mysql_result($result,$i,'user'); $resulty=mysql_query("select * from user where user='$user'",$db); $name=mysql_result($resulty,0,'name'); $time=mysql_result($result,$i,'time'); $title=mysql_result($result,$i,'title'); $nnote=mysql_result($result,$i,'nnote'); echo "◆留言人:$name 时间 $time 主题:$title 内容:$nnote "; } ?>
悄悄话
$result = mysql_query("SELECT * FROM privatenote where touser='$userregister'",$db); $row=mysql_num_rows($result); //悄悄话总数 $unlook=0; if (!$row==0){ for ($i=0;$i<$row;$i++){ $look=mysql_result($result,$i,'look');//计算未看过的悄悄话数目 if ($look=="0"){$unlook++;} } } echo "您有".$unlook."条新悄悄话.总共有".$row."条。查看悄悄话"; ?>