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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
<!--#include file="../Connections/Produits.asp" -->
<%
Set conn = Server.CreateObject("ADODB.Connection")
DSN_BASE="DBQ="& Server.Mappath("../database/produits.mdb")&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25"
conn.Open DSN_BASE
'Save entered username and password
gender = Request.Form("gender")
nom = Request.Form("nom")
prenom = Request.Form("prenom")
societe = Request.Form("societe")
adress1 = Request.Form("adress1")
adress2 = Request.Form("adress2")
postal = Request.Form("postal")
ville = Request.Form("ville")
pays = Request.Form("pays")
tel = Request.Form("tel")
gsm = Request.Form("gsm")
fax = Request.Form("fax")
login = Request.Form("login")
email = Request.Form("email")
pass1 = Request.Form("pass1")
pass2 = Request.Form("pass2")
if email = "" then Response.redirect("login.asp?login=createnamefailed")
if pass1 = "" then Response.Redirect("login.asp?login=createpassfailed")
if pass1 <> pass2 then Response.Redirect("login.asp?login=createpassfailed")
Function GenereAlea()
Dim RefreshAlea 'Num Aleatoire
Dim RefreshSec 'Nb de secondes depuis le 31/12/95
Dim RefreshNum
Randomize
RefreshAlea = Int((100 * Rnd) + 1)
RefreshSec = DateDiff("s", "12/31/95", Now)
RefreshNum = CStr(RefreshSec) & CStr(RefreshAlea)
GenereAlea = RefreshNum
End Function
Function AccessDate(dateandtime)
Dim myDay
Dim myMonth
Dim myYear
myDay = Day(dateandtime)
If Len(myDay)=1 Then myDay="0" & myDay
myMonth = Month(dateandtime)
If Len(myMonth)=1 Then myMonth="0" & myMonth
myYear = Year(dateandtime)
AccessDate = myYear & "-" & myMonth & "-" & myDay
End Function
'Build connection
'set conn = server.CreateObject ("ADODB.Connection")
'conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
'Open all records
rs.Open "SELECT * FROM clients", conn, 3, 3
'Check if username doesn't already exist
do while not rs.EOF
if rs("Email_client")=email then
set rs=nothing
set conn=nothing
Response.Redirect("login.asp?login=createnamefailed")
end if
rs.MoveNext
loop
dbrec = "INSERT INTO clients (Code_client, login, password, Secu_level, Cat_client, tva_client, DateCreation, HeureCreation, Email_client, Genre_client_facturation, Nom_client_facturation, Prenom_Client_facturation, Societe_client_facturation, Adresse1_client_facturation, Adresse2_client_facturation, Postal_client_facturation, Ville_client_facturation, Pays_client_facturation, Tel_client_facturation, Fax_client_facturation, Gsm_client_facturation) VALUES (" & GenereAlea & ",'" & login & "','" & pass1 & "',1,1,1,#" & AccessDate(Date) & "#,#" & Time & "#,'" & email & "','" & gender & "','" & nom & "','" & prenom & "','" & societe & "','" & adress1 & "','" & adress2 & "','" & postal & "','" & ville & "','" & pays & "','" & tel & "','" & fax & "','" & gsm & "')"
'response.Write(dbrec)
conn.execute(dbrec)
%> |
Partager