From: Chris S. <san...@us...> - 2005-09-20 16:32:33
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006/scripts Modified Files: stackDatabase.php stackUser.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** stackDatabase.php 17 Sep 2005 11:31:04 -0000 1.50 --- stackDatabase.php 20 Sep 2005 16:32:24 -0000 1.51 *************** *** 1260,1264 **** /** - * Takes the itemSource and returns a PHP array containing the item. * * @param string $username The username of the student. --- 1260,1263 ---- *************** *** 1290,1294 **** /** - * Takes the itemSource and returns a PHP array containing the item. * * @param array $user The array containing the user. --- 1289,1292 ---- *************** *** 1400,1403 **** --- 1398,1422 ---- } + /** + * @param int $quizid The quizid of the quuiz. + * @return boolean + */ + function stack_db_user_confirm_vista($idnumber) { + + $exists = FALSE; + + if ('' != $idnumber ) { + + $query = 'SELECT id FROM stackUser WHERE idnumber = "'.$idnumber.'"'; + $result= stack_db_query($query); + + if(0 != mysql_num_rows($result)) { + $exists = TRUE; + } + } + + return $exists; + } + ////////////////////////////////////////////////////// Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** stackUser.php 4 Sep 2005 19:24:58 -0000 1.15 --- stackUser.php 20 Sep 2005 16:32:24 -0000 1.16 *************** *** 402,404 **** --- 402,431 ---- } + /** + * Return a valid $user array, having checked usernames and passwords. + * Has to cope with two special users: 'guest' and 'admin' + * + */ + function stack_user_login_vista($username,$userID) { + + global $stackUser; + + $user = stack_user_blank(); + + $user['idnumber'] = 'vista '.$userID; + $user['username'] = 'Vista user: '.$username; + $user['password'] = ''; + $user['firstname'] = ''; + $user['lastname'] = ''; + $user['loggedin'] = TRUE; + + if (strpos($user['username'],'webct_demo')>0) { + $user = stack_user_guest(); + } else if (!stack_db_user_confirm_vista($user['idnumber'])) { + $user['id'] = stack_db_user_store($user); + } + + return $user; + } + ?> |