%@ Language="VBScript" %> <% Response.Buffer = True Response.CharSet = "UTF-8" ' ------- À ADAPTER : même chaîne de connexion que save_results.asp ------- Dim connString connString = "Provider=SQLOLEDB;Data Source=sql.bsite.net\MSSQL2016;" & _ "Initial Catalog=nextgnformation_reponses_exercices;" & _ "User ID=nextgnformation_reponses_exercices;" & _ "Password=S5$NyFXzEjJCg6jD;" ' ------- À ADAPTER : mot de passe d'accès à cette page ------- Dim ADMIN_PASSWORD ADMIN_PASSWORD = "Sm#gnttCaYE5f3ED" ' ----------------------------------------------------------------------- Dim authenticated authenticated = False If Request.Cookies("tp_admin_auth") = "ok" Then authenticated = True End If If Request.Form("password") <> "" Then If Request.Form("password") = ADMIN_PASSWORD Then authenticated = True Response.Cookies("tp_admin_auth") = "ok" Response.Cookies("tp_admin_auth").Expires = DateAdd("h", 8, Now) Else authenticated = False End If End If Function HtmlEscape(s) If IsNull(s) Then HtmlEscape = "" Exit Function End If s = CStr(s) s = Replace(s, "&", "&") s = Replace(s, "<", "<") s = Replace(s, ">", ">") HtmlEscape = s End Function %>
Erreur de connexion à la base : <%= HtmlEscape(Err.Description) %>
<% Else Err.Clear Set rs = conn.Execute("SELECT * FROM tp_resultats ORDER BY date_enregistrement DESC") If Err.Number <> 0 Then %>La table tp_resultats n'existe pas encore — aucun envoi reçu pour le moment.
<% Else %>| Groupe / Stagiaire | Date session | Cas pratique | Reçu le | Détail |
|---|---|---|---|---|
| <%= HtmlEscape(rs("nom")) %> | <%= HtmlEscape(rs("date_session")) %> | <%= HtmlEscape(rs("cas_choisi")) %> | <%= HtmlEscape(rs("date_enregistrement")) %> | |
Réponses TP1 & TP2<%= RenderReponses(rs("reponses_json")) %>TP3 — Analyse de risquesIntitulé : <%= HtmlEscape(rs("tp3_intitule")) %> Description : <%= HtmlEscape(rs("tp3_description")) %> Lieu : <%= HtmlEscape(rs("tp3_lieu")) %> Début prévu : <%= HtmlEscape(rs("tp3_debut")) %> <%= RenderTableau(rs("tp3_tableau_json")) %>Réalisée par : <%= HtmlEscape(rs("tp3_realise_par")) %> — Vérifiée par : <%= HtmlEscape(rs("tp3_verifie_par")) %> — MAJ par : <%= HtmlEscape(rs("tp3_maj_par")) %> |
||||
Aucune réponse.
" Exit Function End If Dim sc Set sc = Server.CreateObject("MSScriptControl.ScriptControl") sc.Language = "JScript" sc.AddCode "function parseArr(s){ return eval('(' + s + ')'); }" On Error Resume Next Dim arr Set arr = sc.Run("parseArr", jsonStr) If Err.Number <> 0 Then RenderReponses = "Erreur de lecture des réponses.
" Exit Function End If On Error Goto 0 Dim i For i = 0 To arr.length - 1 Dim q, r q = arr.Item(i).question r = arr.Item(i).reponse If Trim(r) = "" Then r = "(sans réponse)" out = out & "" & ServerHtmlEscape(q) & " : " & ServerHtmlEscape(r) & "
" Next RenderReponses = out End Function Function RenderTableau(jsonStr) Dim out out = "" If Trim(jsonStr) = "" Then RenderTableau = "" Exit Function End If Dim sc Set sc = Server.CreateObject("MSScriptControl.ScriptControl") sc.Language = "JScript" sc.AddCode "function parseArr(s){ return eval('(' + s + ')'); }" On Error Resume Next Dim arr Set arr = sc.Run("parseArr", jsonStr) If Err.Number <> 0 Then RenderTableau = "Erreur de lecture du tableau.
" Exit Function End If On Error Goto 0 out = "| Étape | Risque | Mesure |
|---|---|---|
| " & ServerHtmlEscape(arr.Item(i).etape) & " | " & _ ServerHtmlEscape(arr.Item(i).risque) & " | " & _ ServerHtmlEscape(arr.Item(i).mesure) & " |