Nested if statements in java
<p>I am working on a user login page. I want the administrator to have access to the administrator section, but not the regular users. The following code works except that if a user besides the administrator logs in they get the wrong password error and are sent to the correct page. I assume there is something wrong with the nested if allowing the negative answer and the positive one. I would greatly appreciate any help with this matter.</p>

<pre><code>        try {
        String sql="Select * from Users1";
        String host ="jdbc:derby://localhost:1527/Nash";
        String uName = "CON";
        String uPass = "smokes";
        Connection con = DriverManager.getConnection(host, uName, uPass);
        Statement stmt=con.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        String user= userName.getText();
        String pwd= password.getText();
        while(rs.next()) {
        String uname=rs.getString("User_name");
        String pass=rs.getString("Password");
        String admin1=rs.getString("admin");

if ((user.equals(uname)) &amp;&amp; (pwd.equals(pass)))
    { 
    mainPanel.setVisible(true);
    blankContent.setVisible(true);
    adminButton.setEnabled(false);
    receiptContent.setVisible(false);
    memberContent.setVisible(false);
    securityPanel.setVisible(false);
    }

        if ((user.equals(uname)) &amp;&amp; (pwd.equals(pass))&amp;&amp;(admin1.equals("y")))
        {
            mainPanel.setVisible(true);
            blankContent.setVisible(true);
            adminButton.setEnabled(true);
            receiptContent.setVisible(false);
            memberContent.setVisible(false);
            securityPanel.setVisible(false);
         }
else 
    {
            JOptionPane.showMessageDialog(null,  "User name and password do"
                    + " not match!","ALERT!", JOptionPane.ERROR_MESSAGE); 

            }   
}   } catch (SQLException ex) {
        Logger.getLogger(program.class.getName()).log(Level.SEVERE, null, ex);
    }
</code></pre>

<p><strong>EDIT</strong>
Following is edited code link --->
<a href="http://pastebin.com/DGg7SB2B" rel="nofollow">New revised code link</a></p>
