Subversion Repositories wimsdev

Rev

Rev 17415 | Rev 17451 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17415 Rev 17435
Line 149... Line 149...
149
    exam_parm();
149
    exam_parm();
150
  }
150
  }
151
 
151
 
152
 /* detect open exam in other session and forbidden open a new */
152
 /* detect open exam in other session and forbidden open a new */
153
  char *pu, pbuf1[MAX_LINELEN+1];
153
  char *pu, pbuf1[MAX_LINELEN+1];
-
 
154
  if(pc==NULL) pc=getvar("wims_class");
-
 
155
  if(pc==NULL) pc="";
154
  pu=getvar("wims_user"); if(pu==NULL) pu="";
156
  pu=getvar("wims_user"); if(pu==NULL) pu="";
-
 
157
 /* line not needed at this step make directory is done later
155
  snprintf(pbuf1,sizeof(pbuf1),"%s/%s/.parmreg", class_base, pc);
158
  snprintf(pbuf1,sizeof(pbuf1),"%s/%s/.parmreg", class_base, pc);
156
  mkdirs(pbuf1);
159
  mkdirs(pbuf1);*/
157
  snprintf(pbuf1,sizeof(pbuf1),"%s/%s/.parmreg/%s.exam",class_base, pc, pu);
160
  snprintf(pbuf1,sizeof(pbuf1),"%s/%s/.parmreg/%s.exam",class_base, pc, pu);
158
  if(stat(pbuf1,&st)==0) { /* search for other session ?? */
161
  if(stat(pbuf1,&st)==0) { /* search for other session ?? */
159
    /* read file pbuf1 */
162
    /* read file pbuf1 */
160
    char pbuf2[MAX_LINELEN+1], *pf1, *pf2;
163
    char pbuf2[MAX_LINELEN+1], *pf1, *pf2;
161
    accessfile(pbuf2,"r",pbuf1);
164
    accessfile(pbuf2,"r",pbuf1);
Line 183... Line 186...
183
  }
186
  }
184
  else { /* First time call: register starting time */
187
  else { /* First time call: register starting time */
185
    char *p1, tbuf[MAX_LINELEN+1];
188
    char *p1, tbuf[MAX_LINELEN+1];
186
    snprintf(dbuf,sizeof(dbuf),"%u",(unsigned int) nowtime);
189
    snprintf(dbuf,sizeof(dbuf),"%u",(unsigned int) nowtime);
187
    accessfile(dbuf,"w","%s",vbuf); start=nowtime;
190
    accessfile(dbuf,"w","%s",vbuf); start=nowtime;
-
 
191
/*  variable initializing before
188
    if(pc==NULL) pc=getvar("wims_class");
192
    if(pc==NULL) pc=getvar("wims_class");
189
    if(pc==NULL) pc="";
193
    if(pc==NULL) pc="";
190
    pu=getvar("wims_user"); if(pu==NULL) pu="";
194
    pu=getvar("wims_user"); if(pu==NULL) pu="";*/
191
/*    snprintf(vbuf,sizeof(vbuf),"%s/%s/.parmreg", class_base, pc);
195
    snprintf(vbuf,sizeof(vbuf),"%s/%s/.parmreg", class_base, pc);
192
    mkdirs(vbuf);*/
196
    mkdirs(vbuf);
193
    snprintf(vbuf,sizeof(vbuf),"%s/%s/.parmreg/%s.exam",
197
    snprintf(vbuf,sizeof(vbuf),"%s/%s/.parmreg/%s.exam",
194
         class_base, pc, pu);
198
         class_base, pc, pu);
195
    p1=remote_addr;
199
    p1=remote_addr;
196
    snprintf(dbuf,sizeof(dbuf),"%s %s %u %d",
200
    snprintf(dbuf,sizeof(dbuf),"%s %s %u %d",
197
         p1, pb, (unsigned int) start+duration, t1);
201
         p1, pb, (unsigned int) start+duration, t1);