aboutsummaryrefslogtreecommitdiff
path: root/GradeBook.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2010-12-15 14:55:49 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2010-12-15 14:55:49 -0500
commite1b5d933c9fb496c460d622998ccbdd9d92b7bdf (patch)
treeb90153c867c22c609b56b8cfe3d0edb963083e07 /GradeBook.tcl
parentfda53373c10d59534e2ff28c334e35f011d464b9 (diff)
downloadGradeBook-e1b5d933c9fb496c460d622998ccbdd9d92b7bdf.tar.gz
GradeBook-e1b5d933c9fb496c460d622998ccbdd9d92b7bdf.zip
added password table with hashed passwords (md5)
darcs-hash:20101215195549-067c0-4172a5808adc79e46f0c57535fd0e0cb88ff048c.gz
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