<html>
<head><title>Ajout d'utilisateur</title></head>
<style>
TABLE {border-style: solid; border-width: 2px; border-color: black;}
TD {font-size: 12px; font-family: "verdana"; text-align: right;}
SPAN {height: 25px;}
</style>
<body>
<%
Dim Conn
Public Sub OpenDb()
Set Conn = Server.CreateObject("ADODB.Connection" )
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:InetpubwwwrootMaBase.mdb;"
End Sub
Public Function Pure(S)
Pure = Replace(S,"'","''" )
End Function
'///////////////////////////////////////////////////////////////////////////////////////////////////////
Public Sub InsertForm()
%><form method="post" action="adduser.asp?Action=go">
<table><col span=2>
<tr><td><span class="login">Nom d'utilisateur: </span></td><td><INPUT type="text" name="Username"></td></tr>
<tr><td><span class="login">Mot de passe: </span></td><td><INPUT type="text" name="Password"></td></tr>
<tr><td colspan=2><INPUT type="submit" name="nom" value="Envoyer"></td></tr>
</table>
</form><%
End Sub
'///////////////////////////////////////////////////////////////////////////////////////////////////////
Dim Action : Action = Request.Querystring("Action" )
If Action = "go" Then
OpenDb
Dim Username : Username = Request.Form("Username" )
Dim Password : Password = Request.Form("Password" )
Dim SQL : SQL = "INSERT INTO T_Utilisateurs (Utilisateur,MotdePasse) VALUES (@username, @password);"
Replace SQL, "@username", Pure(Username) : Replace SQL, "@password", Pure(Password)
Conn.Execute SQL
Conn.Close : Set Conn = Nothing
Else
InsertForm
End If
%>
</body>
</html> |