From: Chris S. <san...@us...> - 2005-09-20 16:32:33
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006 Added Files: vista.php Log Message: --- NEW FILE: vista.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * * @package Stack */ session_start(); require_once('stackConfig.php'); require_once('stackLib.php'); /** * To use this script, add a variable $choosequiz_store * to stackConfig.php which is an array of the subjectID numbers * of subjects you wish to be available through this page. * * eg $choosequiz_store = array('1','2'); * where 1 & 2 are the subjectID numbers you wish to release. * * You also need to add a variable $choosequiz_auth to stackConf.php * This is used by VISTA to authorise the page. */ $user = stack_user_guest(); //show_array($_GET); $auth = ''; if (array_key_exists('auth',$_GET)) { $auth = ''; } else { echo "You are not authorized to use this page."; die(); } //if ($auth != md5($choosequiz_auth)) { // echo "You are not authorized to use this page."; // die(); //} if (array_key_exists('?username',$_GET)) { $username = $_GET['?username']; $userID = $_GET['userID']; $user = stack_user_login_vista($username,$userID); $_SESSION['user'] = $user; } if (array_key_exists('subjectID',$_GET)) { // Check this is permitted. if (isset($choosequiz_store)) { if (FALSE !== array_search($_GET['subjectID'],$choosequiz_store)) { $subjectID = $_GET['subjectID']; } else { echo "This subject is not available through this page."; die(); } } else { echo "The administrator of this STACK server has not released any subjects."; die(); } $subject = stack_db_subject_get($subjectID,FALSE); $_SESSION['subject'] = $subject; } else if (array_key_exists('subject',$_SESSION)) { $subject = $_SESSION['subject']; $subjectID = $subject['subjectID']; } else { echo "You need to supply details of a STACK subjectID number."; die(); } echo "<table width='100%'>\n<tr>\n <td align='left'><h1>STACK quizzes</h1></td>\n"; echo " <td align='right'><img src='pics/logo.png' alt='STACK logo' /></td>\n</tr>\n</table>"; echo $subject['subjectHTMLHead']; $quiz_store = stack_db_subject_quiz_list_student($subjectID); stack_quiz_student_select($subjectID,$quiz_store, $user, FALSE, "choosequiz.php"); echo $subject['subjectHTMLFoot']; |