";
echo "".htmlspecialchars($v->id)." | ".htmlspecialchars($v->user)." | ".htmlspecialchars($v->title)." | ".htmlspecialchars($v->content)." | ".date("Y-m-d H:i",intval($v->time))." | ".htmlspecialchars($v->ip)." | ";
}
echo '';
}
echo "";
}elseif($op=='save'){
if(@$_POST['user']){
$user=$_POST['user'];
$title=$_POST['title'];
$content=$_POST['content'];
/*
$id=@count($gb->item);
$nextid=$id+1;
*/
$nextid=1;
foreach($gb->item as $v){
$idarr[]=(int)$v->id;
}
$nextid=max($idarr)+1;
$item=$gb->addChild('item');
$item->addChild("id",$nextid);
$item->addChild('user',$user);
$item->addChild('title',$title);
$item->addChild('content',$content);
$item->addChild('time',time());
$item->addChild('ip',$_SERVER['REMOTE_ADDR']);
$gb->asXML($filename);
//跳转页,中间页
header("Location: guestbook.php?op=list");
die;
}
}elseif($op=='add'){
?>
Document
}
?>