Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.applet.Applet;
- import java.applet.AppletContext;
- import java.awt.Button;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Font;
- import java.awt.Label;
- import java.awt.TextComponent;
- import java.awt.TextField;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.EventObject;
- public class pass1 extends Applet
- {
- private URL finalurl;
- String infile;
- String[] inuser = new String[20];
- int totno;
- InputStream countConn;
- BufferedReader countData;
- URL inURL;
- TextField txtlogin = new TextField();
- Label label1 = new Label();
- Label label2 = new Label();
- Label label3 = new Label();
- TextField txtpass = new TextField();
- Label lblstatus = new Label();
- Button ButOk = new Button();
- Button ButReset = new Button();
- Label lbltitle = new Label();
- public void init()
- {
- setLayout(null);
- setSize(361, 191);
- add(this.txtlogin);
- this.txtlogin.setBounds(156, 72, 132, 24);
- this.label1.setText("Please Enter Login Name & Password");
- this.label1.setAlignment(1);
- add(this.label1);
- this.label1.setFont(new Font("Dialog", 1, 12));
- this.label1.setBounds(68, 36, 228, 24);
- this.label2.setText("Login");
- add(this.label2);
- this.label2.setFont(new Font("Dialog", 1, 12));
- this.label2.setBounds(75, 72, 36, 24);
- this.label3.setText("Password");
- add(this.label3);
- add(this.txtpass);
- this.txtpass.setEchoChar('*');
- this.txtpass.setBounds(156, 108, 132, 24);
- this.lblstatus.setAlignment(1);
- this.label3.setFont(new Font("Dialog", 1, 12));
- this.label3.setBounds(75, 108, 57, 21);
- add(this.lblstatus);
- this.lblstatus.setFont(new Font("Dialog", 1, 12));
- this.lblstatus.setBounds(84, 132, 204, 24);
- this.ButOk.setLabel("OK");
- add(this.ButOk);
- this.ButOk.setFont(new Font("Dialog", 1, 12));
- this.ButOk.setBounds(105, 156, 59, 23);
- this.ButReset.setLabel("Reset");
- add(this.ButReset);
- this.ButReset.setFont(new Font("Dialog", 1, 12));
- this.ButReset.setBounds(204, 156, 59, 23);
- this.lbltitle.setAlignment(1);
- add(this.lbltitle);
- this.lbltitle.setFont(new Font("Dialog", 1, 12));
- this.lbltitle.setBounds(12, 14, 336, 24);
- String str1 = getParameter("title");
- this.lbltitle.setText(str1);
- pass1.SymAction localSymAction = new pass1.SymAction();
- this.ButOk.addActionListener(localSymAction);
- this.ButReset.addActionListener(localSymAction);
- this.infile = new String("in.txt");
- try
- {
- this.inURL = new URL(getCodeBase(), this.infile);
- }
- catch (MalformedURLException localMalformedURLException)
- {
- getAppletContext().showStatus("Bad Counter URL:" + this.inURL);
- }
- String str2 = getParameter("author");
- if (str2.trim().toUpperCase().intern() == "JACKY LEUNG")
- inFile();
- }
- public void inFile()
- {
- new StringBuffer();
- String str = "";
- int i = 0;
- try
- {
- this.countConn = this.inURL.openStream();
- this.countData = new BufferedReader(new InputStreamReader(this.countConn));
- while ((str = this.countData.readLine()) != null)
- {
- this.totno += 1;
- this.inuser[this.totno] = str;
- str = "";
- i = 0;
- }
- }
- catch (IOException localIOException1)
- {
- getAppletContext().showStatus("IO Error:" + localIOException1.getMessage());
- }
- try
- {
- this.countConn.close();
- this.countData.close();
- return;
- }
- catch (IOException localIOException2)
- {
- getAppletContext().showStatus("IO Error:" + localIOException2.getMessage());
- }
- }
- void ButOk_ActionPerformed(ActionEvent paramActionEvent)
- {
- int i = 0;
- for (int j = 1; j <= this.totno / 2; j++)
- {
- if ((this.txtlogin.getText().trim().toUpperCase().intern() != this.inuser[(2 * (j - 1) + 2)].trim().toUpperCase().intern()) || (this.txtpass.getText().trim().toUpperCase().intern() != this.inuser[(2 * (j - 1) + 3)].trim().toUpperCase().intern()))
- continue;
- this.lblstatus.setText("Login Success, Loading..");
- i = 1;
- String str = this.inuser[1].trim().intern();
- try
- {
- this.finalurl = new URL(getCodeBase(), str);
- }
- catch (MalformedURLException localMalformedURLException)
- {
- this.lblstatus.setText("Bad URL");
- }
- getAppletContext().showDocument(this.finalurl, "_self");
- }
- if (i == 0)
- this.lblstatus.setText("Invaild Login or Password");
- }
- void ButReset_ActionPerformed(ActionEvent paramActionEvent)
- {
- this.txtlogin.setText("");
- this.txtpass.setText("");
- }
- class SymAction
- implements ActionListener
- {
- public void actionPerformed(ActionEvent paramActionEvent)
- {
- Object localObject = paramActionEvent.getSource();
- if (localObject == pass1.this.ButOk)
- {
- pass1.this.ButOk_ActionPerformed(paramActionEvent);
- return;
- }
- if (localObject == pass1.this.ButReset)
- pass1.this.ButReset_ActionPerformed(paramActionEvent);
- }
- SymAction()
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment