%
Response.Write logState
'Response.Write "
admin=" & Session("admin")
'Response.Write "
enabled=" & Session("enabled") & "
"
if isAdmin then
Response.Write "
Sei loggato come amministratore"
%> <%
Dim Action 'as string
Dim myPath 'as string
Dim myDBName 'as string
'Obtention des variables
Action = Request.QueryString("Action")
myPath = Request.QueryString("Path")
myDBName = Request.QueryString("DBName")
If myPath = "" then myPath = Server.MapPath("_private")
If myDBName = "" then Action = "ListDBinDir"
'Affichage de la page selon Action
Select Case Action
Case "LogIn" : subDoLogIn
Case "ListDBinDir" subListDBinDirPage MyPath
Case "ViewDB" : subShowDBTablesPage MyPath, MyDBName
Case "AddTable" : 'available in version 2
Case "ViewTable" : subViewTablePage MyPath, MyDBName
Case "ModTable" : subModTablePage MyPath, MyDBName
Case "DelTable" : subDelTablePage MyPath, MyDBName
Case "AddRecord" : subAddRecordPage MyPath, MyDBName
Case "ModRecord" : subModRecordPage MyPath, MyDBName
Case "UpdateRecord" : subUpdateRecordPage MyPath, MyDBName
Case "DelRecord" : subDelRecordPage MyPath, MyDBName
Case Else : subListDBinDirPage MyPath
End Select
Response.End
'DO NOT CHANGE THE ABOVE CODE
'************************************************
'SUBS AND FUNCTIONS
'************************************************
' HiddenErrMsg(ValidationType, FieldName, ErrMsg)
' FormValidate()
' subCreateDB(DBpath, DBName)
' subCreateTable(DBPath, DBName, TableName)
' fncListTables(DBPath,DBName)
' fncListColumns(DBPath,DBName,TableName)
' subShowDBTablesPage(DBPath, DBName)
' subViewTablePage(DBPath, DBName)
' subModRecordPage(DBPath, DBName)
' subUpdateRecordPage(DBPath, DBName)
' subAddRecordPage(DBPath, DBName)
' subDelRecordPage(DBPath, DBName)
' subModTablePage (DBPath, DBName)
' subDelTablePage(DBPath, DBName)
' subListDBinDirPage(DBPath)
'************************************************
'---- DataTypeEnum Values ----
Const adEmpty = 0
Const adTinyInt = 16
Const adSmallInt = 2
Const adInteger = 3
Const adBigInt = 20
Const adUnsignedTinyInt = 17
Const adUnsignedSmallInt = 18
Const adUnsignedInt = 19
Const adUnsignedBigInt = 21
Const adSingle = 4
Const adDouble = 5
Const adCurrency = 6
Const adDecimal = 14
Const adNumeric = 131
Const adBoolean = 11
Const adError = 10
Const adUserDefined = 132
Const adVariant = 12
Const adIDispatch = 9
Const adIUnknown = 13
Const adGUID = 72
Const adDate = 7
Const adDBDate = 133
Const adDBTime = 134
Const adDBTimeStamp = 135
Const adBSTR = 8
Const adChar = 129
Const adVarChar = 200
Const adLongVarChar = 201
Const adWChar = 130
Const adVarWChar = 202
Const adLongVarWChar = 203
Const adBinary = 128
Const adVarBinary = 204
Const adLongVarBinary = 205
'Arrays (for new table structure)
Dim Cols(100) 'as string
Dim ColTypes(100) 'as integer
Dim ColLens(100) 'as integer
Dim Keys(10) 'as string
Dim KeyNames(10) 'as string
Sub HiddenErrMsg(ValidationType, FieldName, ErrMsg)
'Validation Types:
' r = Required
' i = Integer
' d = Date (MM/DD/YY)
' e = Email
Response.Write "" & vbCrLf
End Sub
Sub subCreateDB(DBpath, DBName)
Dim objADOXDatabase
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & "\" & DBName & ".mdb"
Set objADOXDatabase = Nothing
End Sub
Sub subCreateTable(DBPath, DBName, TableName)
Dim objADOXDatabase
Dim objTable
Dim i 'as integer
'Ouverture de l'objet Database
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & "\" & DBName & ".mdb"
'Ouverture de l'objet Table
Set objTable = Server.CreateObject("ADOX.Table")
'Nom de la table
objTable.Name = TableName
'Ajout des columns
For i = 0 to 100
If Cols(i) = "" then exit for
'Ajout selon le type de column
Select Case ColTypes(i)
Case adEmpty
Case adTinyInt
Case adSmallInt
Case adInteger : objTable.Columns.Append Cols(i), ColTypes(i)
Case adBigInt
Case adUnsignedTinyInt
Case adUnsignedSmallInt
Case adUnsignedInt
Case adUnsignedBigInt
Case adSingle
Case adDouble
Case adCurrency
Case adDecimal
Case adNumeric
Case adBoolean
Case adError
Case adUserDefined
Case adVariant
Case adIDispatch
Case adIUnknown
Case adGUID
Case adDate
Case adDBDate
Case adDBTime
Case adDBTimeStamp
Case adBSTR
Case adChar
Case adVarChar
Case adLongVarChar
Case adWChar
Case adVarWChar : objTable.Columns.Append Cols(i), ColTypes(i), ColLens(i)
Case adLongVarWChar
Case adBinary
Case adVarBinary
Case adLongVarBinary
End Select
Next
'Ajout des keys
For i = 0 to 10
If Keys(i) = "" then exit for
objTable.Keys.Append Keys(i), 1, KeyNames(i)
Next
'Ajout de la table
objADOXDatabase.Tables.Append objTable
'Close up !
Set objTable = Nothing
Set objADOXDatabase = Nothing
End Sub
Function fncListTables(DBPath,DBName)
Dim objADOXDatabase
Dim objTable
Dim myStr 'as string
myStr = ""
'Ouverture de la db
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & "\" & DBName & ".mdb"
For Each objTable in objADOXDatabase.Tables
'Only display user-created tables...
If objTable.Type = "TABLE" then
myStr = myStr & objTable.Name & ","
End If
Next
fncListTables = myStr
'Close up !
Set objTable = Nothing
Set objADOXDatabase = Nothing
End Function
Function fncListColumns(DBPath,DBName,TableName)
Dim objADOXDatabase
Dim objTable
Dim objColumn
Dim myStr 'as string
myStr = ""
'Ouverture de la db
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & "\" & DBName & ".mdb"
'Obtention des nom de columns
For Each objTable in objADOXDatabase.Tables
If objTable.Name = TableName then
For Each objColumn in objTable.Columns
myStr = myStr & objColumn.Name & ","
Next
Exit for
End If
Next
fncListColumns = myStr
'Close up !
Set objColumn = Nothing
Set objTable = Nothing
Set objADOXDatabase = Nothing
End Function
Sub subShowDBTablesPage(DBPath, DBName)
Dim TableList
Dim i 'as integer
Dim bolPair 'as boolean
If DBPath = "" then exit sub
If DBName = "" then exit sub
'En-tête
Response.Write "
| " & DBName &" (" & DBPath & "\" & DBName & ".mdb) |
| Modifica il database degli utenti logon.mdb. |
Main menu" & _ "
| " & DBName &" (" & DBPath & "\" & DBName & ".mdb) |
| Modifica gli utenti. |
" 'CONSTRUCTION DE LA REQUÊTE SQL strSQL = "SELECT * FROM " & TableName & " WHERE " & FieldName & "=" & FieldValue 'OUVERTURE DE LA CONNECTION Set objCN = Server.CreateObject("ADODB.Connection") objCN.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & DBPath & "\" & DBName & ".mdb" Set objRS = Server.CreateObject("ADODB.Recordset") 'With objRS objRS.Open strSQL, objCN, 3, 3 If objRS.EOF then objRS.AddNew Response.Write "
" Else Response.Write "
" End If 'Début de la table confirmant les infos Response.Write "
" & _
"
|
Return to '" & TableName & "'" & _ "
Main menu" & _ "
| " & DBName &" (" & DBPath & "\" & DBName & ".mdb) |
| Use this page to add, delete or revise an access database on this web site. |
Main menu" & _ "
| " & DBName &" (" & DBPath & "\" & DBName & ".mdb) |
| Use this page to add, delete or revise an access database on this web site. |
Main menu" & _ "
| " & DBName &" (" & DBPath & "\" & DBName & ".mdb) |
| Use this page to add, delete or revise an access database on this web site. |
" 'Début du formulaire Response.Write "
" 'LINK POUR AJOUT ET RETOUR AU MENU PRINCIPAL Response.Write "Main menu" & _ "
| " & DBName &" (" & DBPath & "\" & DBName & ".mdb) |
| Use this page to add, delete or revise an access database on this web site. |
Main menu" & _ "
| " & DBPath &" |
| Use this page to add, delete or revise an access database on this web site. |
"
'Bas du tableau
Response.Write "
"
'Haut du tableau
Response.Write "
" & _
"
|
| Login |
| Please log in. |