<%
lad=request.querystring("tas")
vidp=request.querystring("idp")
set cnx=Server.CreateObject("ADODB.Connection")
set myrs=CreateObject("ADODB.Recordset")
cnx.ConnectionString=Application("MyCon")
cnx.open
strsql="select * from personal where usuario='"+lad+"'"
myrs.ActiveConnection=cnx
myrs.source=strsql
myrs.open, ,0,2
%>
<script language="javascript">
function pb(log)
{
var rb=document.getElementsByName("res");
var nulo=100;
for(var i=0;i<rb.length;i++)
{
if(rb[i].checked)
{
nulo=rb[i].value
}
}
window.location.href="respuestas.asp?nul="+nulo+"&idp="+log;
}
</script>
<html>
<head>
<title>Cuerpo</title>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br><br><br>
<%
'Alumno
if vidp=3 then%>
<table border="2" align="center">
<tr>
<td><h1><p><%response.write myrs("Nombre")%></p></h1></td></tr>
</table><br><br>
<table border="2" align="center">
<tr>
<td>
<%
set myrsv=CreateObject("ADODB.Recordset")
vsql="SELECT Materia.*, Personal.Nombre, Personal.Usuario, Asignacion.*, Aplicacion.* FROM (Personal INNER JOIN (Materia INNER JOIN Asignacion ON Materia.Id_materia = Asignacion.Id_materia) ON Personal.Id_personal = Asignacion.Id_personal) INNER JOIN Aplicacion ON Asignacion.Id_asignacion = Aplicacion.Id_asignacion WHERE (((Personal.Usuario)='"+lad+"'))"
myrsv.ActiveConnection=cnx
myrsv.source=vsql
myrsv.open ,,0,2
vfechsis=date()
vhorasis=time()
myrsv.movefirst
do while(not(myrsv.eof))
vfech=myrsv("Fecha")
vhora=myrsv("Hora_inicio")
vhoraf=myrsv("Hora_fin")
if vfech=vfechsis then
if vhorasis>=vhora then
if vhorasis<=vhoraf then
vidm=myrsv("Asignacion.Id_Materia")
'random
inicio=1
fin=5
randomize()
num=int((fin-inicio+1)*rnd+inicio)
'Abre las preguntas de acuerdo al random
set myrsp=CreateObject("ADODB.Recordset")
sqlp="SELECT * FROM preguntas WHERE (((preguntas.id_materia)="+cstr(vidm)+") AND ((preguntas.[No])="+cstr(num)+"))"
myrsp.ActiveConnection=cnx
myrsp.source=sqlp
myrsp.open ,,0,2
vidr=myrsp("id_pregunta")
'Valida que no se repita la pregunta
set myrsl=CreateObject("ADODB.recordset")
sqll="select * from resultados"
myrsl.activeConnection=cnx
myrsl.source=sqll
myrsl.open, ,0,2
if (myrsl.eof and myrsl.bof) then
response.write myrsp("descripcion")
else
end if
%>
</td></tr></table><br><br>
<table border="2" align="center">
<tr><td>
<%
'abre las respuestas de cuerdo a la pregunta
set myrsr=CreateObject("ADODB.Recordset")
sqlr="SELECT * FROM respuestas WHERE id_pregunta="+cstr(vidr)
myrsr.ActiveConnection=cnx
myrsr.source=sqlr
myrsr.open ,,0,2
myrsr.movefirst
do while(not(myrsr.eof))
%>
<br><input type="radio" onclick="pb(<%response.write vidr%>)" name="res" value="<% response.write myrsr("id_respuesta") %>"><% response.write myrsr("respuesta") %>
<%
myrsr.movenext
loop
%>
<input type="hidden" name="idpre" id="idpre" value="<% response.write vidr %>">
<%
exit do
end if
end if
end if
myrsv.movenext
loop
%>
</td>
<script language="javascript">
setTimeout("pb(<%response.write vidr%>)",5000);
</script>
</tr>
<%
end if
%>
</table>