1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/dw_commercial_at", "root", "");
Statement statement = connection.createStatement();
%>
<% ResultSet rs = statement.executeQuery("Select username, password, profil from user where username = '" + request.getParameter("p_username") + "' and password = '" + request.getParameter("p_password") + "'"); %>
<%
String name="";
if (rs != null)
{
rs.next();
name = rs.getString("profil");
if (name.equals("Administrateur"))
{
response.sendRedirect(response.encodeRedirectURL("acceuil.html");
}
if (name.equals("analyste"))
{
response.sendRedirect(response.encodeRedirectURL("acceuil1.html");
}
}
else
{
response.sendRedirect(response.encodeRedirectURL("login.jsp?token=passe"));
}
%> |
Partager