start og slut ?
har en lille kode til en chat men det var ikke så meget chatten jeg vil ha hjælp til lige nu men hvad skal jeg skriv start og slut på et javascript?er det <script></script> eller hvad...? :)
koden som skal "rammes ind" er =
import java.applet.Applet;
import java.awt.Color;
import java.awt.Component;
import java.io.*;
import java.net.*;
public class Measure extends Applet
{
long ONE_SECOND;
String docBaseStr;
String cgiRecord;
String siteParam;
String otherParam;
String durationParam;
String allocateIDParam;
long startTime;
boolean recordTime;
boolean timeout;
boolean fromSleepThread;
boolean appleJvProblem;
boolean initCalled;
SleepThread sleepThread;
public void init()
{
startTime = System.currentTimeMillis();
recordTime = true;
if(!initCalled)
{
URL url = getCodeBase();
String s = new String(url.toString());
cgiRecord = s + "cgi-bin/demorecord";
System.out.println("----------- RedSheriff Measurement -----------");
String s1 = getParameter("ref");
String s2;
if(s1 == null)
{
s2 = "\tRP";
} else
{
s2 = "\tRP" + s1;
}
String s3 = getParameter("url");
String s4;
if(s3 == null)
{
URL url1 = getDocumentBase();
s4 = new String(url1.toString());
} else
{
s4 = s3;
}
int i;
if((i = s4.indexOf("http")) > 0)
{
docBaseStr = s4.substring(i);
} else
{
docBaseStr = s4;
}
if(docBaseStr.length() > 256)
{
docBaseStr = docBaseStr.substring(0, 256);
}
String s5 = getParameter("cid");
String s6 = "";
if(s5 != null)
{
s6 = "|" + s5 + "|";
}
siteParam = "&site=" + s6 + URLEncoder.encode(docBaseStr);
String s7 = "OV" + System.getProperty("os.name") + ":" + System.getProperty("os.version") + ":" + System.getProperty("os.arch");
s4 = System.getProperty("java.vendor");
if(s4.startsWith("Netscape"))
{
s4 = "NS";
} else
if(s4.startsWith("Microsoft"))
{
s4 = "MS";
}
String s8 = getParameter("sr");
String s9;
if(s8 == null)
{
s9 = "\tEX";
} else
{
s9 = "\tEX" + s8;
}
String s10 = System.getProperty("java.version");
if(s10.startsWith("1.0.") && s4.startsWith("Apple"))
{
appleJvProblem = true;
}
if(s4.startsWith("Apple") && s10.startsWith("1.1.") && !s10.startsWith("1.1.7") && !s10.startsWith("1.1.8") && !s10.startsWith("1.1.9"))
{
appleJvProblem = true;
}
if(appleJvProblem)
{
return;
}
String s11 = "\tJV" + s4 + ":" + s10;
String s12 = "\tLI";
otherParam = "&other=" + URLEncoder.encode(s7 + s11 + s12 + s2 + s9);
String s13 = getParameter("allocateID");
if(s13 != null)
{
try
{
int j = Integer.parseInt(s13);
if(j != 1)
{
allocateIDParam = "&allocateID=0";
}
}
catch(NumberFormatException _ex) { }
}
String s14 = getParameter("background");
if(s14 != null)
{
if(s14.startsWith("#"))
{
s14 = s14.substring(1);
}
if(s14 != null)
{
int k = Integer.parseInt(s14, 16);
setBackground(new Color(k));
}
}
initCalled = true;
}
}
public void start()
{
if(appleJvProblem)
{
return;
}
System.out.println("Privacy: http://www.redsheriff.com/privacy.htm");
if(recordTime)
{
recordTime = false;
} else
{
startTime = System.currentTimeMillis();
}
timeout = false;
sleepThread = new SleepThread(this, ONE_SECOND * 1800L);
sleepThread.start();
}
public void wakeUp()
{
fromSleepThread = true;
stop();
timeout = true;
}
public void stop()
{
if(appleJvProblem)
{
return;
}
if(timeout)
{
return;
}
long l = System.currentTimeMillis();
long l1 = l - startTime;
l1 = (l1 + 500L) / 1000L;
if(l1 > 1800L)
{
l1 = 1800L;
} else
if(l1 < 0L)
{
l1 = 0L;
}
if(!fromSleepThread && sleepThread != null)
{
sleepThread.stop();
sleepThread = null;
}
fromSleepThread = false;
try
{
URL url = new URL(cgiRecord);
URLConnection urlconnection = url.openConnection();
urlconnection.setDoOutput(true);
urlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
urlconnection.setUseCaches(false);
DataOutputStream dataoutputstream = new DataOutputStream(urlconnection.getOutputStream());
durationParam = "duration=" + String.valueOf(l1);
dataoutputstream.writeBytes(durationParam + siteParam + otherParam + allocateIDParam);
dataoutputstream.close();
java.io.InputStream inputstream = urlconnection.getInputStream();
DataInputStream datainputstream = new DataInputStream(inputstream);
String s;
while((s = datainputstream.readLine()) != null)
{
System.out.println(s);
}
datainputstream.close();
return;
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
public Measure()
{
ONE_SECOND = 1000L;
siteParam = "&site=error";
otherParam = "&other=OV\tJV\tLI\tRP\tEX";
durationParam = "duration=0";
allocateIDParam = "&allocateID=1";
recordTime = false;
timeout = false;
fromSleepThread = false;
appleJvProblem = false;
initCalled = false;
}
}
og så lige en ting mere hvad skal det filen's navn ende på Chat3.?
