aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'GradeBook.tcl')
-rwxr-xr-xGradeBook.tcl29
1 files changed, 24 insertions, 5 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl
index 3275ae8..a9d00cc 100755
--- a/GradeBook.tcl
+++ b/GradeBook.tcl
@@ -1,6 +1,6 @@
#!/bin/sh
# FILE: "/home/evmik/src/my_src/GradeBook/GradeBook.tcl"
-# LAST MODIFICATION: "Wed, 15 Dec 2010 09:58:11 -0500 (evmik)"
+# LAST MODIFICATION: "Wed, 15 Dec 2010 14:55:38 -0500 (evmik)"
# (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
# $Id:$
# vim:set ft=tcl: \
@@ -9,6 +9,8 @@ exec tclsh "$0" "$@"
#load libtclsqlite3.so.0 Sqlite3
package require sqlite3
package require ncgi
+package require md5
+
::ncgi::parse
# defaults
@@ -42,13 +44,29 @@ set dbfile "./testdb"
sqlite3 db $dbfile
+proc CreatePasswordsTable {db} {
+ db eval {CREATE TABLE PasswordsTable(UserName text, PasswordHash text, GroupName text)}
+ set eval_str [list INSERT INTO PasswordsTable VALUES('instructor', '[::md5::md5 -hex qwerty]', 'instructor')]
+ db eval $eval_str
+ set eval_str [list INSERT INTO PasswordsTable VALUES('ta', '[::md5::md5 -hex qwerty]', 'ta')]
+ db eval $eval_str
+
+ set eval_str [list INSERT INTO PasswordsTable VALUES('jhn', '[::md5::md5 -hex qwerty]', 'student')]
+ db eval $eval_str
+ set eval_str [list INSERT INTO PasswordsTable VALUES('ale', '[::md5::md5 -hex qwerty]', 'student')]
+ db eval $eval_str
+ set eval_str [list INSERT INTO PasswordsTable VALUES('dan', '[::md5::md5 -hex qwerty]', 'student')]
+ db eval $eval_str
+}
+
proc CreateGradesTable {db} {
db eval {CREATE TABLE GradesTable(FirstName text, LastName text, UserName text, HW01 real)}
- db eval {INSERT INTO GradesTable VALUES('John','Lname1', 'jhn', 7)}
- db eval {INSERT INTO GradesTable VALUES('Ale','Lname2', 'ale', 5)}
- db eval {INSERT INTO GradesTable VALUES('Dan','Lname3', 'dan', 9)}
- #db1 eval {ALTER TABLE GradesTable ADD c int }
+ set eval_str [list INSERT INTO GradesTable VALUES('John','Lname1', 'jhn', 7)]
+ db eval $eval_str
+ set eval_str [list INSERT INTO GradesTable VALUES('Ale','Lname2', 'ale', 5)]
+ db eval $eval_str
+ set eval_str [list INSERT INTO GradesTable VALUES('Dan','Lname3', 'dan', 3)]
}
proc CreateAccessRightsTable {db} {
@@ -211,6 +229,7 @@ proc AccessGroupRights {db user password } {
##################### end of procs ####################################
set timestamp [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"]
+#CreatePasswordsTable db
#CreateGradesTable db
#CreateAccessRightsTable db
dbg [::ncgi::names] 4