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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Calcul</title>
</head>
<body>
<% String Url = "jdbc:odbc:JspCon"; //le pilote JSPCon est deja configuré
String user = request.getParameter("user");
String pass = request.getParameter("pass");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(Url,"SYSTEM","be806713");
Statement St = con.createStatement();
user = "'"+user+"'";
String sql = "SELECT login FROM utilisateur where login ="+user;
boolean trouve = St.execute(sql);
String password = "";
if(trouve)
{
sql = "SELECT pass from utilisateur where login="+user;
ResultSet r = St.executeQuery(sql);
while(r.next())
{
password = r.getString("pass");
}
if(pass.equals(password))
out.println("Bonjour Mr "+user);
else
out.println("Votre Mot de passe Est Erroné ! ");
}
else
{
out.println("Vous Netes Inscri !! ");
}
}
catch (Exception e)
{ out.println(e.getMessage());
}
%>
</body>
</html> |
Partager