nonshatter 26 Posting Whiz

Hey guys,

I have been moving and testing my scripts on a different web server, but I am not getting the same results on both computers.

Here is the code:

<?php session_start();

//THIS FUNCTION VALIDATES INPUT
function VerifyForm(&$values, &$errors) {

   if (strlen($values['firstname']) == 0) {
      $errors['firstname'] = 'Please Enter a name';
   }
   if (strlen($values['surname']) == 0) {
   	$errors['surname'] = 'Plese Enter a surname';
   }
   return (count($errors) == 0);
}
?>
<?php
    if (count($errors) > 0) {
		echo "Ooops! There were some errors in your form..."; 
    }
?>

<form name="registerform" action="#" method="POST">
	<table cellpadding="2px">
                 <tr>
			<td>First Name:</td>
			<td><input type="text" name="firstname" maxlength="40" <?= htmlentities($values['firstname']) ?></td>
			<td class="error"><?= $errors['firstname'] ?></td>
		</tr>
		<tr>
			<td>Surname:</td>
			<td><input type="text" name="surname" maxlength="40" value"<?= htmlentities($values['surname']) ?></td>
			<td class="error"><?= $errors['surname'] ?></td>
		</tr>
        </table>
</form>

I'm guessing it's to do with the tags... "Ooops! There were some errors in your form..." displays on the page, but none of the <?= $errors ?> are displayed. Is there a type of tag I can use to make the errors display? (Preferably without changing the settings of the web server)?

Thanks

nonshatter 26 Posting Whiz

Okay. Sorry for being a pain but is there a way of getting this to work? I just want something I can understand more easily. I can always implement something more advanced later on when I fully understand JavaScript (hopefully that will happen one day).

<form name="sellform">
		<select name="cat" size="7" onChange="updatecat(this.selectedIndex)" style="width: 200px">
			<option value="">-- Select a Category --</option>
			<option value="components">Components</option>
			<option value="pcs">Desktop Computers</option>
			<option value="laptops">Laptops/Netbooks</option>
			<option value="monitors">Monitors</option>
			<option value="drives">Internal Drives</option>
			<option value="network">Cables/Networking</option>
			<option value="servers">Servers</option>
			<option value="software">Software</option>
			<option value="accessories">Accessories</option>
		</select>

<select name="subcat" size="7" style="width:200px">
</select>

<select name="manufacturer" size="7" style="width:200px">
</select>
</form>

<script type="text/javascript">

var subcat = new Array()

subcat[0] = ""
subcat[1] = ['Processors|processor','Motherboards|motherboard','Memory|memory','Graphics Cards|graphic','Sound Cards|sound','Fans|fan','Mice & Keyboards|mice_keyboard','Speakers|speaker']
subcat[2] = ['< 1.7GHz|lowest','1.8GHz > 2.2GHz|low','2.3GHz > 2.9GHz|med','2.9GHz >|high']
subcat[3] = ['Laptops','Netbooks','Laptop Accessories']
subcat[4] = ['< 19"','20" > 23"','24" >']
subcat[5] = ['External HDs','Internal HDs','Optical Drives','Floppy Drives']
subcat[6] = ['Wireless Cards','Routers','Power Supplies','Other Cables']
subcat[7] = ['Rackmount Servers','Tower Servers']
subcat[8] = ['Games/Entertainment','Photo/Graphics','Business/Office','Family/Education','Other Software']
subcat[9] = ['Web Cams','Flash/USBs','Cases','Bags','Other Accessories']

//HOW DO I CONSTRUCT THIS ARRAY
/*var manufacturer = new Array()

manufacturer[1][1] = ['Intel|intel', 'AMD|amd']
manufacturer[1][2] = ['AS Rock|asrock','Asus|asus']
manufacturer[1][3] = ['Sandisk|sandisk','Vastech|vastech']
*/

var catlist=document.sellform.cat
var subcatlist=document.sellform.subcat

function updatecat(selectedcatgroup) {
	subcatlist.options.length=0
	if (selectedcatgroup > 0) {
		for (i=0; i < subcat[selectedcatgroup].length; i++)
		subcatlist.options[subcatlist.options.length] = new Option(subcat[selectedcatgroup][i].split("|")[0], subcat[selectedcatgroup][i].split("|")[1])
	}
}

</script>

The first two input fields work fine. It's just adding the same functionality to the final field.
Thanks

nonshatter 26 Posting Whiz

Airshow

I appreciate your help, but I was far more comfortable with the html select fields hardcoded as they were before as that seemed more logical to me.

As good as the code you suggested is, I still can't seem to implement the values properly as it is quite advanced! I understand the array of objects... The "uid" is an integer number, is that the value attribute of the selected option? Is it possible to change the integer number to just be a plain and simple value E.g. instead of being '123' make it 'intel'? And also the src part is not needed.

Surely there must be an easier way to add values (whilst keeping it as simple as possible)!?

I just came across this which is sort of similar to what I need http://www.javascriptkit.com/javatutors/selectcontent2.shtml By using the | to separate the name/value attributes. Would this be sufficient?

Thanks

nonshatter 26 Posting Whiz

Airshow,

you are a true gentleman! I will have my work cut out for today, and I will let you know my outcome later.

Once again thank you!
nonshatter

nonshatter 26 Posting Whiz

Airshow,

Thankyou for your contributions! I completely over-looked the fields not having values attached to them. Here is my code for the generation of drop-down box options:

<html>
<head>
<script type="text/javascript">

//CATEGORIES / TYPES OF PRODUCT
var categories = new Array();

categories['categories'] = new Array('--Sub-Category--');
categories['components'] = new Array('Processors','Motherboards','Memory','Graphics Cards','Sound Cards','Cooling','Mice & Keyboards','Speakers');
categories['pcs'] = new Array('< 1.7GHz','1.8GHz > 2.2GHz','2.3GHz > 2.9GHz','2.9GHz >');
categories['laptops'] = new Array('Laptops','Netbooks','Laptop Accessories');
categories['monitors'] = new Array('< 19"','20" > 23"','24" >');
categories['drives'] = new Array('External HDs','Internal HDs','Optical Drives','Floppy Drives');
categories['network'] = new Array('Wireless Cards','Routers','Power Supplies/Cables');
categories['servers'] = new Array('Rackmount Servers','Tower Servers');
categories['software'] = new Array('Games/Entertainment/Education','Photo/Graphics','Business/Office','Other');
categories['accessories'] = new Array('Web Cams','Flash/USBs','Other');

//SUBCATEGORIES / MANUFACTURERS
var subcategories = new Array();

subcategories['components'] = new Array();
subcategories['components']['Processors']     = new Array('AMD','Intel','Other');
subcategories['components']['Motherboards']   = new Array('Abit','AOpen','Asus','Dell','DFI','Gigabyte','HP','Intel','MSI','Shuttle','Other');
subcategories['components']['Memory']         = new Array('Corsair','G.Skill','Kingston','OCZ','Sandisk','Vastech','Other');
subcategories['components']['Graphics Cards'] = new Array('Asus','ATI','GeForce','Gigabyte','HighTech','Radeon','XFS','Other');
subcategories['components']['Sound Cards']    = new Array('Asus','Creative Labs','Other');
subcategories['components']['Cooling']        = new Array('AcoustiFan','Generic','Noiseblocker','Sandisk','Vasth','Other');
subcategories['components']['Mice & Keyboards'] = new Array('Logitech','Microsoft','Vatech','Other');
subcategories['components']['Speakers']       = new Array('Acoustic Energy','Creative Labs','Hercules','Logitech','Other');

subcategories['pcs'] = new Array();
subcategories['pcs']['< 1.7GHz'] = new Array('Accer','Dell','Emachines','Gateway','HP','Mac','Custom/Other');
subcategories['pcs']['1.8GHz > 2.2GHz']  = new Array('Acer','Dell','Emachines','Gateway','HP','Mac','Custom/Other');
subcategories['pcs']['2.3GHz > 2.9GHz']  = new Array('Acer','Dell','Emachines','Gateway','HP','Mac','Custom/Other');
subcategories['pcs']['2.9GHz >'] = new Array('Acer','Dell','Emachines','Gateway','HP','Mac','Custom/Other');

//REST OF SUB-CATEGORIES/MANUFACTURERS GO HERE

function setCategories() {

	ctgSel = document.getElementById('cat');
	subctgSel = document.getElementById('subcategories');

	ctgList = categories[ctgSel.value];

	changeSelect(subctgSel, ctgList);
	setSubs();
}

function setSubs() {

	ctgSel = document.getElementById('cat');
	subctgSel = document.getElementById('subcategories');
	manSel = document.getElementById('manufacturer');

	subList = subcategories[ctgSel.value][subctgSel.value];
	
	changeSelect(manSel, subList);
}

function changeSelect(fieldObj, valuesAry, optTextAry, selectedValue) {

  //Clear the select list
  fieldObj.options.length = 0;

  //Set the option text to the values if not passed
  optTextAry = (optTextAry)?optTextAry:valuesAry;

  for …
nonshatter 26 Posting Whiz
If you've done it, tell us what you did and we can tell you if you are right or wrong (your original post has errors)

Sure... I know for a fact that I have some errors here, but this is the result of my first attempt so please be kind!


Thanks,
nonshatter

nonshatter 26 Posting Whiz

Sorry for being a pain. There was a really simple solution!

field.style.display = ( menu[menu.selectedIndex].text == 'Other' ) ? 'inline' : 'none';

I needed .text instead of .value

Thanks

nonshatter 26 Posting Whiz

Thanks for your replies. In my original post, I described the manufacturer drop-down box as having "value" attributes to make the code easier to understand.

However, the manufacturers are actually being automatically generated by the user's previous selection of "category". For example, if a user selects "Software" from "category" drop-down box, then the "manufacturer" drop-down box is populated with "UBIsoft", "EA", "Other" etc. Whereas if they select "Drives" then the "manufacturer" drop-down box is populated with "Seagate", "Sandisk" etc.... The form actually looks like this and the setManufacturer function takes care of populating the manufacturer field with options:

<select name="manufacturer" id="manufacturer" onchange="setManufacturer(this);">
					 <option value="">--Manufacturer--</option>
</select>

So when the drop-down box is populated with the manufacturer options, there are no "value" attributes being set for each option.

So essentially, my question now is how could I change this line of code to select an "option" rather than a "value":

field.style.display = ( menu[menu.selectedIndex].value == 'Other' ) ? 'inline' : 'none';

Again, thanks for your quick replies and let me know if you need to see more code :D

nonshatter 26 Posting Whiz

Hey guys,

I have a drop-down box which lists manufacturers of computer products. I want it so that when a user clicks "Other" from the drop-down box, a new input field appears below it which asks them to specify an alternative manufacturer.

<select name="cat" id="cat" onchange="setCategories();">
					<option value="components">Components</option>
					<option value="pcs">Desktop Computers</option>
					<option value="laptops">Laptops/Netbooks</option>
					<option value="monitors">Monitors</option>
					<option value="drives">Internal Drives</option>
					<option value="network">Cables/Networking</option>
					<option value="servers">Servers</option>
					<option value="software">Software</option>
					<option value="accessories">Other/Accessories</option></select>

<select name="manufacturer" id="manufacturer">
					 <option value="man">--Manufacturer--</option>
                                         <option value="dell">Dell</option>
                                         <option value="ibm">IBM</option>
                                         <option value="other">Other</option>
</select>

<!-- MAKE INPUT FIELD APPEAR HERE AFTER "OTHER" SELECTION -->

I know it is to do with the "onchange" attribute of the manufacturer input field, but I am new to JavaScript and don't know what code is required for the function to do this. Can anyone point me in the right direction?

Thanks in advance!

nonshatter 26 Posting Whiz

Thanks, I think I've done it now : D

nonshatter 26 Posting Whiz

Hi guys,

Basically I'm making an auction website (kinda like eBay), and am trying to make my database 2NF compliant (and eventually 3NF compliant). Here is an outline of my tables/fields:


I know I need to split the tables up into additional tables so that data isn't repeated, but I am struggling to grasp how this is done without messing it up. I was hoping one of you experts could help me!

Many thanks

nonshatter 26 Posting Whiz

You are probably missing an ending quote (") somewhere in your code. A missed end brace "}", bracket "]", or parenthesis ")" can also cause
the unexpected $end in a script as well.

nonshatter 26 Posting Whiz

Solved it!! It's actually really simple but I just couldn't get my head round how to extract the values on the other side!

register.php

<?php session_start();
$_SESSION['formdata'] = $values;
?>

register_server.php

<?php session_start();

//I USED THIS TO CHECK THE VALUES EXISTED
foreach($_SESSION['formdata'] as $keys=>$value)
   {
	  echo 'The value of $_SESSION['."'".$keys."'".'] is '."'".$value."'".' <br />';
   }

//THEN EXTRACTED THEM FROM THE ARRAY
        $firstname = $_SESSION['formdata']['firstname'];
	$surname = $_SESSION['formdata']['surname'];

	$address1 = $_SESSION['formdata']['address1'];
?>

Thankyou for your patience!
nonshatter x

nonshatter 26 Posting Whiz

Thanks for your help but I am new to php and still struggling to get this working properly. I presume I need to start the session on both pages? The loop that you kindly suggested puts the form values into the $val array but I'm still unable to access the values from this array on the next page? :( Here's what I've been trying...

register.php

<?php session_start();

function VerifyForm(&$values, &$errors)
{
   if (strlen($values['firstname']) == 0)
      $errors['firstname'] = 'Please Enter a name';
      
   if (strlen($values['surname']) == 0)
   	$errors['surname'] = 'Plese Enter a surname';

//--------------validation----------------------

  foreach($values as $keys=>$val)
  {
	  unset($_SESSION[$keys]);
     $_SESSION[$keys] = $val;
  }
  
  return (count($errors) == 0);
}
?>

register_server.php

<?php session_start(); 
//WHAT GOES HERE??  :S
$getfirstname = $_SESSION[$val]['firstname'];

?>

Thanks

nonshatter 26 Posting Whiz

Correct. I am now using:

<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST">

So the validation takes place on the same page. I think I need a method of directing the user and the entered data to the register_server.php page. This diverts them:

header("Location: http://localhost/register_server.php");

But it doesn't send the form data with it. Any ideas of how to do that?
Thanks for your help

nonshatter 26 Posting Whiz

Okay, I've figured out that it's to do with the form action attribute. When I change the form action to point to the register_server.php page, the data is added to the database correctly.

The problem I now have is that the VerifyForm function doesn't get executed, because the form data gets send straight to the register_server.php page.

Is there a way I can validate the input first, if no errors are found, then send the data to the register_server.php page?? I hope this makes sense,

Muchos Gracias

nonshatter 26 Posting Whiz

Hey I hope someone can help me here because I am pretty stumped on this one...

All I'm trying to do is to update my user_usr table with the submitted form data. It was working perfectly the other day so I must have changed something somewhere.

The code and the database query seem to execute as they should, but the form data isn't being appended properly to the database. Although a new record is inserted and a new user_id appears, the remaining fields of the database are left blank... Here is the 'register_server.php' file

<?php


//CONNECT TO MYSQL
mysql_connect("localhost", "root", "root") or die("Could not connect: ".mysql_error());

echo "<h2>Connected to MySQL</h2><br>";

//CONNECT TO TEST DATABASE
mysql_select_db("computabid_auctions") or die("Could not connect: ".mysql_error());

echo "<h2>Connected to Database</h2><br>";


	//IMPORT DATA FOR DATABASE UPDATE
	$firstname = $_POST['firstname'];

	$surname = $_POST['surname'];

	$address1 = $_POST['address1'];

	$address2 = $_POST['address2'];

	$city = $_POST['city'];

	$postcode = $_POST['postcode'];

	$county = $_POST['county'];

	$region = $_POST['region'];

	$telephone = $_POST['telephone'];

	$email = $_POST['email'];    

	$yearofbirth = $_POST['year'];
	$monthofbirth = $_POST['month'];
	$dateofbirth = $_POST['date'];
	$dob = $yearofbirth.'-'.$monthofbirth.'-'.$dateofbirth;

	$username = $_POST['username'];
	$password = md5($_POST['password2']);

//UPDATE THE DATABASE
$query = "INSERT INTO user_usr (firstname, surname, addr_1, addr_2, city_town, postcode, county, region, tel_no, email_addr, dob, username, passwd)

VALUES('$firstname', '$surname', '$address1', '$address2', '$city', '$postcode', '$county', '$region', '$telephone', '$email', '$dob', '$username', '$password')";

mysql_query($query) or die(mysql_error());

mysql_close();



echo "<h2>You have successfully Registered</h2><br>";

?>

Before this page executed, I am validating the form input, so it could be a problem with that validation page (below) rather than this page shown above. …

nonshatter 26 Posting Whiz

I've solved this now... If anyone else is struggling with this same problem go here:

Sorry for wasting ur time!

nonshatter 26 Posting Whiz

Hey guys, this is probably a really simple question for you experts so I hope you can help..!

Basically I have three separate html fields for the user's date of birth:
"year" "month" and "date"

All I'm trying to do is to take these three from the form and insert them into one single mysql field called "dob". This field is of the DATE data type.

Any help is appreciated
Thanks

nonshatter 26 Posting Whiz

I was researching this for a university project. I had to identify and appraise all possible vulnerabilities that could exist in a particular website as a result of incorrect input validation. I actually had a verbal exam on the vulnerabilities I identified, so I was hoping the examiner wouldn't bring up this CVE (he didn't in the end). Regardless, your help is much appreciated!

nonshatter 26 Posting Whiz

Hi, I just have a quick/probably dumb question about this vulnerability...

"OpenSSH before 5.1 sets the SO_REUSEADDR socket option when the X11UseLocalhost configuration setting is disabled, which allows local users on some platforms to hijack the X11 forwarding port via a bind to a single IP address, as demonstrated on the HP-UX platform."

I'm just getting confused, why is this only locally exploitable?

Thanks

nonshatter 26 Posting Whiz

Before I begin i'm sorry if this is a noobish question. Basically I'm trying to import a 'forum.sql' file into mysql so that I can access and manipulate it through a Java servlet.

The path to the sql dump file is /home/floyd/Desktop/forum/forum.sql so i open a terminal window, cd into that directory and type:

floyd@floyd:~/Desktop/forum$mysql -u root -p root forum < forum.sql

Then i get this...


mysql Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (x86_64) using readline 5.2
Copyright (C) 2000-2008 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Usage: mysql [OPTIONS] [database]
-?, --help Display this help and exit.
-I, --help Synonym for -?
--auto-rehash Enable automatic rehashing. One doesn't need to use
'rehash' to get table and field completion, but startup
and reconnecting may take a longer time. Disable with
--disable-auto-rehash.
-A, --no-auto-rehash
No automatic rehashing. One has to use 'rehash' to get
table and field completion. This gives a quicker start of
mysql and disables rehashing on reconnect. WARNING:
options deprecated; use --disable-auto-rehash instead.
-B, --batch Don't use history file. Disable interactive behavior.
(Enables --silent)

....................................

auto-rehash TRUE
character-sets-dir (No default value)
default-character-set latin1
comments FALSE
compress FALSE
database (No default value)
delimiter ;
vertical FALSE
force …

nonshatter 26 Posting Whiz

Thanks for your help. I have changed the code around now and have got it working for the first line of each file.

What I need to do now, is once each line from the file is processed, get the next line from the files and process again. So some kind of loop is needed. I'm just struggling to think of a way to do this!
Any help is much appreciated!
Thanks

public static void main(String[] args)
   {
	String salt = new String();
	String original = new String();

	try{
		FileReader password = new FileReader("/home/floyd/Desktop/Crypt/salt.txt");
    		FileReader wordlist = new FileReader("/home/floyd/Desktop/Crypt/wordlist.txt");
		
		BufferedReader bufRead2 = new BufferedReader(password);
		BufferedReader bufRead = new BufferedReader(wordlist);
		
	        salt = bufRead2.readLine();
                original = bufRead.readLine();
   
		bufRead.close();
		bufRead2.close();

	} catch (Exception e) {
	    System.out.println("Error: " + e.getMessage());
	}
 
	System.out.println
         ("[" + salt + "] [" + original + "] ===> [" + JCrypt.crypt(salt, original) + "]");

	String hash = "d10NX4B.EJem2";
 
	if (JCrypt.crypt(salt, original).equals(hash))
	{
	      System.out.println ("Password Cracked! " + JCrypt.crypt(salt, original) + " ===> " + original);
	}
   }
}
nonshatter 26 Posting Whiz

Hey guys, basically what i'm trying to do is take each line from two text files and store them into two variables, salt and original. I then want to pass these 2 variables to a different method called:
crypt(String salt, String original)
How would I go about doing this?

Many thanks

public static void main(String[] args)
   {
	String salt = new String();
	String original = new String();

	try{
		// Open the file that is the first 
    		FileReader wordlist = new FileReader("/home/cougar/students/u335122/Desktop/Crypt/wordlist.txt");
		FileReader password = new FileReader("/home/cougar/students/u335122/Desktop/Crypt/salt.txt");

		BufferedReader bufRead = new BufferedReader(wordlist);
		BufferedReader bufRead2 = new BufferedReader(password);
		
		int count = 0;
		int count1 = 0;

		original = bufRead.readLine();
		salt = bufRead2.readLine();
		//count++;
		//count1++;

		// Read through file one line at time. Print line
         while (original != null){
                  System.out.println(original);
                  original = bufRead.readLine();
                 // count++;
	      }

	 while (salt != null){
                  System.out.println(salt);
                  salt = bufRead2.readLine();
                 // count1++;
	      }

		bufRead.close();
		bufRead2.close();
	} catch (Exception e) {
	System.out.println("Error: " + e.getMessage());
	} 
	
         System.out.println
         (
            "[" + salt + "] [" + original + "] => [" +
            JCrypt.crypt(salt, original) + "]"
         );
   }
nonshatter 26 Posting Whiz

Thanks, now that solves that problem, but I'm now it's throwing 14 different errors. I think they're related to the same method but can't find what the problem is!
Here is the full code:

import java.net.*;
import java.io.*;

public class Ex2Client {

public static void FaultHandler (DatagramSocket aSocket, InetAddress aHost, int proxyPort, byte[] requestArray, byte[] rec_bytes) {
	int faultCount = 0;
    while ( faultCount < 4 ) {
      DatagramPacket request = new DatagramPacket(requestArray, requestArray.length, aHost, proxyPort);	
      aSocket.send(request);	
      try {
	      aSocket.setSoTimeout(4000);
	      aSocket.receive(reply);
	  }
    catch ( SocketTimeoutException e ) {
	      faultCount++;
	      continue; 
	  }
    catch ( IOException e ) {	
	break;
	if ( faultCount >= 3 )
	System.exit(0);
     }
    }
}

public static void Requests (DatagramSocket aSocket, InetAddress aHost, int proxyPort, byte[] requestArray) {	
    try{
	//CREATE REQUEST DATAGRAM PACKET
	DatagramPacket request = new DatagramPacket(requestArray, requestArray.length, aHost, proxyPort);
	//SEND PACKET	
	aSocket.send(request);			
	}
    catch (SocketException e) {}
    catch (IOException e) {
    System.out.println("IO: " + e.getMessage());
    }
}

public static byte[] Responses(DatagramSocket aSocket, InetAddress aHost, int proxyPort, byte[] requestArray) {
			//CREATE BUFFER ARRAY
			byte[] buffer = new byte[1000];
			// RECEIVE RESPONSE DATAGRAM PACKET
			DatagramPacket reply = new DatagramPacket(buffer, buffer.length);

		try{
			//SET TIMEOUT TO 4 SECONDS
			//aSocket.setSoTimeout(4000);
			
			// RECEIVE RESPONSE
			aSocket.receive(reply);	
			
		}
		catch (SocketTimeoutException e) {
           		System.out.println("Have not received response from the server within 4 sec: request lost or server crashed");				FaultHandler(aSocket, aHost, proxyPort, requestArray);
        	}
        
		catch (IOException e) {
		byte [] rec_bytes = reply.getData();
		return rec_bytes;
		}
	}


public static void main(String args[]) throws Exception { 
	DatagramSocket aSocket = null;
 	try {
		//CREATE NEW …
nonshatter 26 Posting Whiz

Hey, can anyone tell me what's wrong with this method? I keep getting <identifier> expected error on line 1.

public static void FaultHandler (DatagramSocket aSocket, InetAddress aHost, int proxyPort, byte[] requestArray, rec_bytes) {
	int faultCount = 0;
    while ( faultCount < 4 ) {
      DatagramPacket request = new DatagramPacket(requestArray, requestArray.length, aHost, proxyPort);	
      aSocket.send(request);	
      try {
	      aSocket.setSoTimeout(4000);
	      aSocket.receive(reply);
	  }
    catch ( SocketTimeoutException e ) {
	      faultCount++;
	      continue; 
	  }
    catch ( IOException e ) {	
	break;
	if ( faultCount >= 3 )
	System.exit(0);
     }
    }
}

Thanks

nonshatter 26 Posting Whiz

Can anyone shed some light on these errors?

public void FaultHandler () {
		int faultCount = 0;
	 while ( faultCount < 4 ) {
		  DatagramPacket request =
			  new DatagramPacket(requestArray, requestArray.length, aHost, proxyPort);	
		  aSocket.send(request);	
	 try {
		  aSocket.setSoTimeout(4000);
		  aSocket.receive(reply);
	      }
	 catch ( SocketTimeoutException e ) {
		  faultCount++;
		  continue; 
	      }
	 catch ( IOException e ){}
		 break;
	      
	 catch ( IOException e ) {}	  //----it doesn't like this line!
	      if ( faultCount >= 3 )
	      System.exit(0);
	      }
	}

I keep getting these errors:

'catch' without 'try'
catch ( IOException e ) {}
^
Ex2Client.java:18: ')' expected
catch ( IOException e ) {}
^
Ex2Client.java:18: not a statement
catch ( IOException e ) {}
^
Ex2Client.java:18: ';' expected
catch ( IOException e ) {}