The July JAM

Your browser cannot run applets.

This applet uses the HTTProtocol for invoking the GeoCities mail script, that sends e-mail messages to GeoCities members.
Hereinafter is the java-source.


source: MailApplet.java

import java.lang.*;
import java.util.*;
import java.io.*;
import java.net.*;
import java.awt.*;
import java.applet.*;

public class MailApplet extends Applet implements Runnable
{
   TextArea txt;

   public void init()
   {
   	txt=new TextArea("Hello ", 2, 60);
      add(txt);
	};

	public void start()
	{
      (new Thread(this)).start();
	}

    public void run() {
        try {
            URL urlDocument = getDocumentBase();
            String sHost = urlDocument.getHost();
            String sLocal = InetAddress.getLocalHost().getHostName();
            String sMember = getParameter("membername");
            if (sMember == null)
                sMember = "jkarchev";       //applet author

            URL urlMail = new URL(urlDocument, "/cgi-bin/homestead/mail.pl?"+sMember);
            URLConnection postMail = urlMail.openConnection();
            postMail.setDoOutput(true);
            postMail.setDoInput(true);

            postMail.setRequestProperty("Referer", urlDocument.toString());
            postMail.setRequestProperty("Connection", "Keep-Alive");
            postMail.setRequestProperty("Content-type", "application/x-www-form-urlencoded");

            PrintStream out = new PrintStream(postMail.getOutputStream());
            out.print("visitor=" + sLocal);
            out.print("&time=" + (new Date()).toString().replace(' ', '+'));
            out.close();

            postMail.connect();
            txt.appendText(sLocal);

            DataInputStream in = new DataInputStream(postMail.getInputStream());
            while (in.available() == 0);
            while (in.available() > 0)
                sLocal = in.readLine();
            in.close();
            txt.appendText(", I'm " + sMember + "\n");
        } catch (Exception e) {
            txt.appendText(e.toString());
        }
    }
}

This page hosted by GeoCities Get your own Free Home Page

1