Wasn't the second gulf war illegal? (Question by the way)
Well in my opinion, no.
Firstly, international law is a law of acknowledged norms and agreements. There is no legislature, judiciary or enforcement. It is not a normal legal system and in fact there are debates in legal circles as to whether it represents law at all.
You have treaties, where states agree formally to adopt certain behaviours with one another, you then have norms of practice that have often been adopted over time when states interact with each other.
Currently the UN dominates international law, because of the number of nations signed up to its membership.
There is considered to be a general prohibition on the use of force, except by a resolution of the security council. This is rare, because of the right of veto of 5 states who often have differing interests (for example the nation's that vetoed a new resolution on Iraq all had investments in the Iraqi oil industry). The other exception to the prohibition is self defence, both collectively or individually to a threat or the use of force.
The basis on which many informed commentators claim the invasion of Iraq to be illegal (by informed commentators I mean those that have at least a basic understanding of the UN and international treaty. Very few if any international lawyers have argued it was illegal) is that the US and coalition partners sought a NEW security council resolution authorising use of force against Iraq. This was vetoed by security council members with a power of absolute veto.
However, this move was essentially a PR stunt and actually a PR disaster (in that it gave cause for some to question the legality of the invasion). A new resolution was not necessary however.
Resolution 678 passed in 1990 authorised the use of force against Iraq and was never revoked.
Following the forced withdrawal of Iraqi troops from Kuwait a condition of ceasefire was that Iraq allowed access to UN weapons inspectors. This had not been complied with leading up to the 2003 invasion and in early 2003 the security council passed resolution 1441 which acknowledged Iraq's breach of numerous UN resolutions and referred to the still valid resolution 678 as authorising the use of force against Iraq to ensure peace and security in the region. Therefore resolution 1441 arguably authorises use of force based on the breaches of the numerous resolutions by Iraq.
There is another more complex argument regarding the invasion of Iraq being self defence based on the threat of the use of force (Saddam's previous invasion of Kuwait, subsequent denial of access to weapons inspectors and attempts to develop armed forces and deploy them in the region heightened by links to Sept 11th) but I wrote a 10000 word dissertation on the legality of the Iraq war and I'm not doing it again