<%@ page import="java.util.*,java.io.*" %> Visitors Who Signed our Guestbook

Visitors Who Signed our Guestbook

<% String id = request.getParameter("id"); boolean noSignatures = true; try { String filename = application.getRealPath(id + ".gbf"); FileReader file = new FileReader(filename); BufferedReader buff = new BufferedReader(file); boolean eof = false; while (!eof) { String entry = buff.readLine(); if (entry == null) eof = true; else { StringTokenizer entryData = new StringTokenizer(entry, "^"); String name = (String) entryData.nextElement(); String email = (String) entryData.nextElement(); String url = (String) entryData.nextElement(); String entryDate = (String) entryData.nextElement(); String ip = (String) entryData.nextElement(); String comments = (String) entryData.nextElement(); out.print("

From: " + name); if (!email.equals("None")) out.println(" <" + email + ">
"); else out.println("
"); if (!url.equals("None")) out.println("Home Page: " + url + "
"); out.println("Date: " + entryDate + "
"); out.println("IP: " + ip); out.println("

"); out.println("

" + comments); out.println("

"); noSignatures = false; } } buff.close(); } catch (IOException e) { out.println("

This guestbook could not be read because of an error."); log("Guestbook Error: " + e.toString()); } if (noSignatures) out.println("

No one has signed our guestbook yet."); %>

Sign Our Guestbook

Your Name:
Your E-mail Address:
Your Home Page:
Your Comments: