Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on August 4, 2016 at 12:40 AM

Section 1 (Java)

package frame;

import java.awt.event.KeyEvent;
import java.sql.*;
import javax.swing.JOptionPane;
import principal.Conexao;
import javax.swing.JFrame;

public class Login extends JFrame {

    Connection con = null;
    PreparedStatement pst = null;
    ResultSet rs = null;
    PreparedStatement pstadmin = null;
    ResultSet rsadmin = null;

    public Login() throws ClassNotFoundException {
        setVisible(true);
        setLayout(null);
        initComponents();
        setLocationRelativeTo(null);
        con = Conexao.conexao();
    }

    public void Logar() {

        String sql = "SELECT *from contas where usuario = ? and senha = ?";
        try {
            pst = con.prepareStatement(sql);
            pst.setString(1, txtUsuario.getText());
            pst.setString(2, txtSenha.getText());
            rs = pst.executeQuery();

            String sqladmin = "SELECT *from contas where admin = ?";
            String admin = "";
            pstadmin = con.prepareStatement(sqladmin);
            pstadmin.setString(1, admin);
            rsadmin = pstadmin.executeQuery();
            
//            System.out.println("login: " + rs.next());
//            System.out.println("admin: " + rsadmin.next());
            if (rs.next()) {
                if (rsadmin.next()) {
                    LogadoAdmin la = new LogadoAdmin();
                    la.setVisible(true);
                    dispose();
                }
                Logado l = new Logado();
                l.setVisible(true);
                dispose();
            } else {
                JOptionPane.showMessageDialog(null, "Dados inválidos, Por favor Verifique-os!");
                txtSenha.setText("");
            }
        } catch (SQLException error) {
            JOptionPane.showMessageDialog(null, error.getMessage());
        }
    }                

    private void btnEntrarActionPerformed(java.awt.event.ActionEvent evt) {                                          
        Logar();
    }                                                                                            

    public static void main(String[] args) {
        try {
            new Login();
        } catch (ClassNotFoundException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
    }
              
}