<?

  $option[$number_options] = "Telnet";
  $number_options = $number_options + 1;

  // config

  // functions for the telnet option

function telnet_options () {

  global $telnet_host;
  global $telnet_port;
  global $selected_option;
  
  // Some defaults
  if (!$telnet_port) { $telnet_port = 25; }

  print ("<table cellspacing=0 cellpadding=0 border=0>\n");
  print ("<form ACTION=\"" . $_SERVER[PHP_SELF] . "\" METHOD=\"post\">\n");
  print ("<input type=hidden name=selected_option value=" . $selected_option . ">\n");
  // we need to following to let the main script know we are sending it data for the 
  // second half of this module to process.
  print ("<input type=hidden name=submited value=\"1\"\n");
  // now display our form
  print ("<tr>\n");
  print (" <td>Host:</td>\n");
  print (" <td><input type=text name=telnet_host size=15 maxlength=128 value=\"" . $telnet_host . "\"></td>\n");
  print (" <td><img height=1 src=images/cl_pixel.gif width=100></td>\n");
  print (" <td>Port:</td>\n");
  print (" <td><input type=text name=telnet_port size=5 maxlength=5 value=\"" . $telnet_port . "\"></td>\n");
  print ("</tr>\n");
  print ("<tr>\n");
  print (" <td colspan=3><img height=1 src=images/cl_pixel.gif width=100></td>\n");
  print (" <td align=left colspan=2><input type=submit name=submit value=\"Lookup Domain\"></td>\n");
  print ("</tr>\n");
  print ("</table>\n");
  print ("</form>\n");

}

function telnet_output () {
  // this is called after the submit button is pressed and all the
  // previous variables should be passed to this function.

  global $selected_option;
  global $telnet_host;
  global $telnet_port;

  // Output data goes here
  if($telnet_host) {
    if (($telnet_port) and ($telnet_port > 1) and ($telnet_port < 65535)) {
      print("<applet CODEBASE=\"telnet\" \n");
      print("ARCHIVE=\"jta20.jar\"\n");
      print("CODE=\"de.mud.jta.Applet\" \n"); 
      print("WIDTH=590 HEIGHT=360>\n");

      print("<!-- The value below is relative to the CODEBASE -->\n");
      print("<PARAM NAME=\"config\" VALUE=\"applet2.conf\">\n");
      print("<PARAM NAME=\"Socket.host\" VALUE=\"" . $host . "\">\n");
      print("<PARAM NAME=\"Socket.port\" VALUE=\"" . $port . "\">\n");

      print("<!-- make sure, non-java-capable browser get a message: -->\n");
      print("<br><b>Your Browser seems to have no <a href=\"http://java.sun.com/\">Java</a>\n");
      print("support. Please get a new browser or enable Java to see this applet!</b>\n");
      print("<br></applet>\n");

      print("<!-- End of applet code -->\n");

    }                   
  }


}

