Date: 11/12/99
- Next message: Massimiliano Masserelli: "Re: [PHPLIB-DEV] cvs commit"
- Previous message: kk: "[PHPLIB-DEV] cvs commit"
- Next in thread: Massimiliano Masserelli: "Re: [PHPLIB-DEV] cvs commit"
- Reply: Massimiliano Masserelli: "Re: [PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: kk
Date: Fri Nov 12 08:11:28 1999
Modified files:
php-lib/CHANGES
php-lib/php/auth_sql.inc
php-lib/php/ct_dba.inc
php-lib/php/ct_dbm.inc
php-lib/php/ct_file.inc
php-lib/php/ct_informix.inc
php-lib/php/ct_ldap.inc
php-lib/php/ct_null.inc
php-lib/php/ct_shm.inc
php-lib/php/ct_split_sql.inc
php-lib/php/ct_sql.inc
php-lib/php/ct_sql_blob.inc
php-lib/php/ct_sql_compat.inc
php-lib/php/local.inc
php-lib/php/session.inc
php-lib/stuff/create_database.msaccess95
php-lib/stuff/create_database.msql
php-lib/stuff/create_database.mssql60
php-lib/stuff/create_database.mysql
php-lib/stuff/create_database.odbc
php-lib/stuff/create_database.oracle
php-lib/stuff/create_database.pgsql
php-lib/stuff/create_database.sybase
Log message:
OK, I broke the CVS. Cleanup over the weekend. Read CHANGES.
Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.147 php-lib/CHANGES:1.148
--- php-lib/CHANGES:1.147 Thu Nov 11 21:41:46 1999
+++ php-lib/CHANGES Fri Nov 12 08:11:23 1999
@@ -1,6 +1,51 @@
-$Id: CHANGES,v 1.147 1999/11/11 20:41:46 kk Exp $
+$Id: CHANGES,v 1.148 1999/11/12 07:11:23 kk Exp $
11-Nov-1999 kk
+ - OK, here is the plan. Read it, because the CVS is currently broken.
+ If you are working on a database adaptor (db_*.inc) or a storage
+ container (ct_*.inc), you'll want to know.
+
+ A database interface (any database interface) shall implement the
+ functions currently present in db_mysql.inc. Not all databases will
+ be able to implement all functions in a sane manner. For example,
+ num_rows() and seek() are extremely problematic in db_oracle.inc.
+ Don't build large emulation layers. If it is not natural to your
+ database, let it be. But bring your database interface up to speed
+ and make it look as close to db_mysql.inc as possible.
+
+ A storage container should be modelled after ct_mysql.inc, with
+ ct_split_sql.inc functionality. It can be database specific, in
+ fact it should be. I intend to get rid of the generic storage
+ containers ct_sql.inc and ct_split_sql.inc.
+
+ The following additional clarifications are necessary: The
+ ac_get_value() and ac_store() functions should be able to handle
+ large session data strings. That is, make use of the new database
+ table structure to split your session record or use the database
+ specific blob interface of your database (or work on a general
+ blob API container, using a database specific blob container).
+
+ The ac_get_value() and ac_store() functions must work atomic
+ themselves. They must do their own locking. They cannot
+ rely on ac_get_lock() and ac_release_lock() being called -
+ these functions have a different purpose.
+
+ The ac_get_lock() and ac_release_lock() functions are here
+ to brace a page_open()/page_close() pair with locking. That
+ is useful for user variables or application variables.
+ Activating this functionality is done by setting
+ database_lock_semaphore in ct_*.inc. If enabled, page_open()
+ will lock a session (NOT! the entire session table, PLEASE!)
+ and that lock will persist until page_close() where it is
+ released. This will effectively serialize your pages and
+ SERIOUSLY slows down an application, but some applications
+ may use it. I'd rather have a "per session variable" lock, but
+ that is not possible from within PHP3, but only with severe
+ modifications of the interpreter.
+
+ Locking is still broken in most non-sql containers like shm,
+ file, dba and dbm.
+
- Modelled db_msql.inc after db_mysql.inc to bringt database API up
to current revision. Have no msql running, so I cannot test it.
- Modelled db_mssql.inc after db_mysql.inc, but some functions
Index: php-lib/php/auth_sql.inc
diff -u php-lib/php/auth_sql.inc:1.1 php-lib/php/auth_sql.inc:1.2
--- php-lib/php/auth_sql.inc:1.1 Sat Nov 6 21:03:49 1999
+++ php-lib/php/auth_sql.inc Fri Nov 12 08:11:24 1999
@@ -5,7 +5,7 @@
* Copyright (c) 1998,1999 NetUSE GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: auth_sql.inc,v 1.1 1999/11/06 20:03:49 kk Exp $
+ * $Id: auth_sql.inc,v 1.2 1999/11/12 07:11:24 kk Exp $
*
*/
@@ -78,22 +78,22 @@
$uid = false;
- $this->db->query(sprintf("select user_id, pwenc, password, perms ".
+ $this->db->query(sprintf("select p_user_id, p_pwenc, p_password, p_perms ".
" from %s ".
" where username = '%s' ",
$this->database_table,
addslashes($username)));
while($this->db->next_record()) {
- $pwenc = $this->db->f("pwenc");
- $p = $this->db->f("password");
+ $pwenc = $this->db->f("p_pwenc");
+ $p = $this->db->f("p_password");
$salt = ($pwenc == "crypt")?substr($p, 0, 2):"";
$q = $this->password_encode($password, $pwenc, $salt);
if ($p == $q) {
- $uid = $this->db->f("user_id");
- $this->auth["perm"] = $this->db->f("perms");
+ $uid = $this->db->f("p_user_id");
+ $this->auth["perm"] = $this->db->f("p_perms");
break;
}
}
@@ -146,16 +146,16 @@
}
## See if the user is already present
- $query = sprintf("select user_id, username, password, perms from %s where username = '%s'",
+ $query = sprintf("select p_user_id, p_username, p_password, p_perms from %s where p_username = '%s'",
$this->database_table,
$username);
$this->db->query($query);
while($this->db->next_record()) {
## If user is present and password matches, silently log
## the user in.
- if ($this->db->f("password") == $pass1) {
- $this->auth["perm"] = $this->db->f("perms");
- return $this->db->f("user_id");
+ if ($this->db->f("p_password") == $pass1) {
+ $this->auth["perm"] = $this->db->f("p_perms");
+ return $this->db->f("p_user_id");
}
## If user is present and password does not match,
@@ -168,7 +168,7 @@
## and a user entry. The new user has no permissions (you
## might want to add some?)
$uid = md5(uniqid($this->magic));
- $query = sprintf("insert into %s ( user_id, username, pwenc, password ) values ('%s', '%s', '%s', '%s')",
+ $query = sprintf("insert into %s ( p_user_id, p_username, p_pwenc, p_password ) values ('%s', '%s', '%s', '%s')",
$this->database_table,
$uid,
$username,
Index: php-lib/php/ct_dba.inc
diff -u php-lib/php/ct_dba.inc:1.2 php-lib/php/ct_dba.inc:1.3
--- php-lib/php/ct_dba.inc:1.2 Thu Oct 28 13:14:53 1999
+++ php-lib/php/ct_dba.inc Fri Nov 12 08:11:24 1999
@@ -3,7 +3,7 @@
##
## Copyright (c) 1999 Guarneri Carmelo <carmelo <email protected>>
##
-## $Id: ct_dba.inc,v 1.2 1999/10/28 11:14:53 carmelo Exp $
+## $Id: ct_dba.inc,v 1.3 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using DBM Files with Database abstraction layer functions
##
@@ -30,11 +30,11 @@
$this->dbaid=dba_open($this->dbm_file, "w", $this->dba_handler);
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
# Not needed in this instance
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
# Not needed in this instance
dba_close($this->dbaid);
}
Index: php-lib/php/ct_dbm.inc
diff -u php-lib/php/ct_dbm.inc:1.2 php-lib/php/ct_dbm.inc:1.3
--- php-lib/php/ct_dbm.inc:1.2 Tue Oct 26 16:52:50 1999
+++ php-lib/php/ct_dbm.inc Fri Nov 12 08:11:24 1999
@@ -3,7 +3,7 @@
##
## Copyright (c) 1999 Daniel Lashua <daniel.lashua <email protected>>
##
-## $Id: ct_dbm.inc,v 1.2 1999/10/26 14:52:50 kk Exp $
+## $Id: ct_dbm.inc,v 1.3 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using DBM Files
##
@@ -27,11 +27,11 @@
$this->dbmid = dbmopen($this->dbm_file, "w");
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
# Not needed in this instance
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
# Not needed in this instance
}
Index: php-lib/php/ct_file.inc
diff -u php-lib/php/ct_file.inc:1.2 php-lib/php/ct_file.inc:1.3
--- php-lib/php/ct_file.inc:1.2 Fri Aug 27 17:27:11 1999
+++ php-lib/php/ct_file.inc Fri Nov 12 08:11:24 1999
@@ -22,11 +22,11 @@
# Not needed in this instance
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
# Not needed in this instance
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
# Not needed in this instance
}
Index: php-lib/php/ct_informix.inc
diff -u php-lib/php/ct_informix.inc:1.1 php-lib/php/ct_informix.inc:1.2
--- php-lib/php/ct_informix.inc:1.1 Wed Nov 3 18:26:33 1999
+++ php-lib/php/ct_informix.inc Fri Nov 12 08:11:24 1999
@@ -3,7 +3,7 @@
##
## Copyright (c) 1999 Daniel J. Lashua <djl <email protected>>
##
-## $Id: ct_informix.inc,v 1.1 1999/11/03 17:26:33 kk Exp $
+## $Id: ct_informix.inc,v 1.2 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using an Informix Server
##
@@ -29,10 +29,10 @@
$this->linkid = ifx_pconnect($this->database_name . "@" . $this->database_host,$this->database_username,$this->database_password);
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
}
function ac_gc($gc_time, $name) {
Index: php-lib/php/ct_ldap.inc
diff -u php-lib/php/ct_ldap.inc:1.3 php-lib/php/ct_ldap.inc:1.4
--- php-lib/php/ct_ldap.inc:1.3 Wed Jul 7 22:43:44 1999
+++ php-lib/php/ct_ldap.inc Fri Nov 12 08:11:24 1999
@@ -2,7 +2,7 @@
##
## Copyright (c) 1999 Sascha Schumann <sascha <email protected>>
##
-## $Id: ct_ldap.inc,v 1.3 1999/07/07 20:43:44 sas Exp $
+## $Id: ct_ldap.inc,v 1.4 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using a LDAP database
##
@@ -63,11 +63,11 @@
return $str;
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
}
Index: php-lib/php/ct_null.inc
diff -u php-lib/php/ct_null.inc:1.2 php-lib/php/ct_null.inc:1.3
--- php-lib/php/ct_null.inc:1.2 Wed Jul 7 22:43:44 1999
+++ php-lib/php/ct_null.inc Fri Nov 12 08:11:24 1999
@@ -3,7 +3,7 @@
##
## Copyright (c) 1998,1999 Sascha Schumann <sascha <email protected>>
##
-## $Id: ct_null.inc,v 1.2 1999/07/07 20:43:44 sas Exp $
+## $Id: ct_null.inc,v 1.3 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using nothing
##
@@ -17,10 +17,10 @@
function ac_start() {
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
}
function ac_newid($str, $name) {
Index: php-lib/php/ct_shm.inc
diff -u php-lib/php/ct_shm.inc:1.4 php-lib/php/ct_shm.inc:1.5
--- php-lib/php/ct_shm.inc:1.4 Wed Jul 7 22:43:44 1999
+++ php-lib/php/ct_shm.inc Fri Nov 12 08:11:24 1999
@@ -3,7 +3,7 @@
##
## Copyright (c) 1998,1999 Sascha Schumann <sascha <email protected>>
##
-## $Id: ct_shm.inc,v 1.4 1999/07/07 20:43:44 sas Exp $
+## $Id: ct_shm.inc,v 1.5 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using Shared Memory
##
@@ -31,12 +31,12 @@
$this->shmid = shm_attach($this->shm_key, $this->shm_size, 0600);
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
$this->semid = sem_get($this->shm_key + 1);
sem_acquire($this->semid);
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
shm_detach($this->shmid);
sem_release($this->semid);
}
Index: php-lib/php/ct_split_sql.inc
diff -u php-lib/php/ct_split_sql.inc:1.4 php-lib/php/ct_split_sql.inc:1.5
--- php-lib/php/ct_split_sql.inc:1.4 Fri Nov 5 12:18:18 1999
+++ php-lib/php/ct_split_sql.inc Fri Nov 12 08:11:24 1999
@@ -3,7 +3,7 @@
## Copyright (c) 1999 Internet Images srl
## Massimiliano Masserelli
##
-## $Id: ct_split_sql.inc,v 1.4 1999/11/05 11:18:18 kir Exp $
+## $Id: ct_split_sql.inc,v 1.5 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using a SQL database and multiple
## rows for each element
@@ -18,7 +18,7 @@
## deriving your own class from it (recommened)
##
- var $database_table = "active_sessions_split";
+ var $database_table = "active_sessions";
var $database_class = "";
var $database_lock_semaphore = "";
var $split_length = 4096; ## Split data every xxx bytes
@@ -37,19 +37,19 @@
$this->db = new $name;
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
while ( ! $this->db->query("SELECT get_lock('%s')",
- $this->database_lock_semaphore) ) {
+ $this->database_lock_semaphore, $name, $sid) ) {
$t = 1 + time(); while ( $t > time() ) { ; }
}
}
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
$this->db->query("SELECT release_lock('%s')",
- $this->database_lock_semaphore);
+ $this->database_lock_semaphore, $name, $sid);
}
}
@@ -57,7 +57,7 @@
$timeout = time();
$sqldate = date("YmdHis", $timeout - ($gc_time * 60));
$this->db->query(sprintf("DELETE FROM %s ".
- "WHERE ct_changed < '%s' AND ct_name = '%s'",
+ "WHERE changed < '%s' AND name = '%s'",
$this->database_table,
$sqldate,
addslashes($name)));
@@ -67,8 +67,7 @@
$ret = true;
$cmd = $this->enc_methods[$this->encoding_mode]["enc"];
- $str = sprintf("%s:%s", $this->encoding_mode, $cmd($str));
-
+ $str = $cmd($str);
$now = date("YmdHis", time());
if ( $this->db->type == "oracle" )
@@ -82,12 +81,13 @@
$count = 0;
while ($part = substr($str, 0, $this->split_length)) {
$this->db->query(sprintf("INSERT INTO %s ".
- " (ct_sid, ct_name, ct_pos, ct_val, ct_changed) ".
+ " (sid, name, valenc, valpos, val, changed) ".
" VALUES ".
- " ('%s','%s','%06d','%s','%s')",
+ " ('%s','%s','%s', '%06d','%s','%s')",
$this->database_table,
$id,
addslashes($name),
+ $this->encoding_mode,
$count++,
$part,
$now
@@ -111,38 +111,28 @@
function ac_delete($id, $name) {
$this->db->query(sprintf("DELETE FROM %s ".
- "WHERE ct_name = '%s' AND ct_sid = '%s'",
+ "WHERE name = '%s' AND sid = '%s'",
$this->database_table,
addslashes($name),
$id));
}
function ac_get_value($id, $name) {
- $this->db->query(sprintf("SELECT ct_val, ct_pos FROM %s ".
- "WHERE ct_sid = '%s' AND ct_name = '%s' ".
- "ORDER BY ct_pos",
+ $this->db->query(sprintf("SELECT valenc, val, valpos FROM %s ".
+ "WHERE sid = '%s' AND name = '%s' ".
+ "ORDER BY valpos",
$this->database_table,
$id,
addslashes($name)));
$str="";
while ($this->db->next_record()) {
- $str .= $this->db->f("ct_val");
- }
-
- # get encoding method from (method:value) pair
- $colon_pos = strpos($str,':');
- $str_method = substr ( $str , 0 , $colon_pos );
- if( empty($str_method) ) {
- // For compatibility with old sessions
- $str_method = "base64";
- $str_value = $str;
- } else {
- // New format case
- $str_value = substr ( $str , $colon_pos + 1 );
+ $str .= $this->db->f("val");
+ $enc = $this->db->f("valenc");
}
- $cmd = $this->enc_methods[$str_method]["dec"];
- $str = $cmd($str_value);
+ # get encoding method
+ $cmd = $enc?$this->enc_methods[$enc]["dec"]:"base64_decode";
+ $str = $cmd($str);
## DEB echo $str;
return $str;
Index: php-lib/php/ct_sql.inc
diff -u php-lib/php/ct_sql.inc:1.20 php-lib/php/ct_sql.inc:1.21
--- php-lib/php/ct_sql.inc:1.20 Fri Nov 5 12:18:18 1999
+++ php-lib/php/ct_sql.inc Fri Nov 12 08:11:24 1999
@@ -6,7 +6,7 @@
##
## Copyright (c) 1998,1999 Sascha Schumann <sascha <email protected>>
##
-## $Id: ct_sql.inc,v 1.20 1999/11/05 11:18:18 kir Exp $
+## $Id: ct_sql.inc,v 1.21 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using a SQL database
##
@@ -36,18 +36,20 @@
$this->db = new $name;
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
- $query = sprintf("SELECT get_lock('%s')", $this->database_lock_semaphore);
+ $query = sprintf("SELECT get_lock('%s-%s-%s')",
+ $this->database_lock_semaphore, $name, $sid);
while ( ! $this->db->query($query)) {
$t = 1 + time(); while ( $t > time() ) { ; }
}
}
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
- $query = sprintf("SELECT release_lock('%s')", $this->database_lock_semaphore);
+ $query = sprintf("SELECT release_lock('%s-%s-%s')",
+ $this->database_lock_semaphore, $name, $sid);
$this->db->query($query);
}
}
@@ -64,23 +66,26 @@
function ac_store($id, $name, $str) {
$ret = true;
- #encode > string='method:result'
+ #encode
$cmd = $this->enc_methods[$this->encoding_mode]["enc"];
- $str = sprintf("%s:%s", $this->encoding_mode, $cmd($str));
-
+ $str = $cmd($str);
$name = addslashes($name);
-
$now = date("YmdHis", time());
- $uquery = sprintf("update %s set val='%s', changed='%s' where sid='%s' and name='%s'",
+
+ $uquery = sprintf("update %s set valenc='%s', valpos='%s', val='%s', changed='%s' where sid='%s' and name='%s'",
$this->database_table,
+ $this->encoding_mode,
+ '000000',
$str,
$now,
$id,
$name);
- $iquery = sprintf("insert into %s ( sid, name, val, changed ) values ('%s', '%s', '%s', '%s')",
+ $iquery = sprintf("insert into %s ( sid, name, valenc, valpos, val, changed ) values ('%s', '%s', '%s', '%s', '%s', '%s')",
$this->database_table,
$id,
$name,
+ $this->encoding_mode,
+ '000000',
$str,
$now);
@@ -106,27 +111,15 @@
$str = '';
$this->db->query( sprintf(
- "SELECT val FROM %s WHERE sid = '%s' AND name = '%s'",
+ "SELECT valenc, val FROM %s WHERE sid = '%s' AND name = '%s'",
$this->database_table, $id, addslashes($name)) );
if ( $this->db->next_record() ) {
-
+ $enc = $this->db->f('valenc');
$str = $this->db->f('val');
-
- # get encoding method from (method:value) pair
- $colon_pos = strpos($str,':');
- $str_method = substr ( $str , 0 , $colon_pos );
- if( empty($str_method) ) {
- // For compatibility with old sessions
- $str_method = "base64";
- $str_value = $str;
- } else {
- // New format case
- $str_value = substr ( $str , $colon_pos + 1 );
- }
- $cmd = $this->enc_methods[$str_method]["dec"];
-
- $str = $cmd($str_value);
+ # get encoding method
+ $cmd = $this->enc_methods[$enc]["dec"];
+ $str = $cmd($str);
}
return $str;
Index: php-lib/php/ct_sql_blob.inc
diff -u php-lib/php/ct_sql_blob.inc:1.1 php-lib/php/ct_sql_blob.inc:1.2
--- php-lib/php/ct_sql_blob.inc:1.1 Thu Nov 11 13:40:57 1999
+++ php-lib/php/ct_sql_blob.inc Fri Nov 12 08:11:24 1999
@@ -7,7 +7,7 @@
## Copyright (c) 1999 Internet Image srl
## Massimiliano Masserelli <negro <email protected>>
##
-## $Id: ct_sql_blob.inc,v 1.1 1999/11/11 12:40:57 negro Exp $
+## $Id: ct_sql_blob.inc,v 1.2 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using a SQL database and BLOB support
## as implemented by be_xxx classes.
@@ -37,18 +37,20 @@
$this->blob = new $name;
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
- $query = sprintf("SELECT get_lock('%s')", $this->database_lock_semaphore);
+ $query = sprintf("SELECT get_lock('%s-%s-%s')",
+ $this->database_lock_semaphore, $name, $sid);
while ( ! $this->db->query($query)) {
$t = 1 + time(); while ( $t > time() ) { ; }
}
}
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
- $query = sprintf("SELECT release_lock('%s')", $this->database_lock_semaphore);
+ $query = sprintf("SELECT release_lock('%s-%s-%s')",
+ $this->database_lock_semaphore, $name, $sid);
$this->db->query($query);
}
}
Index: php-lib/php/ct_sql_compat.inc
diff -u php-lib/php/ct_sql_compat.inc:1.1 php-lib/php/ct_sql_compat.inc:1.2
--- php-lib/php/ct_sql_compat.inc:1.1 Thu Oct 28 20:22:02 1999
+++ php-lib/php/ct_sql_compat.inc Fri Nov 12 08:11:24 1999
@@ -6,7 +6,7 @@
##
## Copyright (c) 1998,1999 Sascha Schumann <sascha <email protected>>
##
-## $Id: ct_sql_compat.inc,v 1.1 1999/10/28 18:22:02 kk Exp $
+## $Id: ct_sql_compat.inc,v 1.2 1999/11/12 07:11:24 kk Exp $
##
## PHPLIB Data Storage Container using a SQL database
##
@@ -38,18 +38,20 @@
$this->db = new $name;
}
- function ac_get_lock() {
+ function ac_get_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
- $query = sprintf("SELECT get_lock('%s')", $this->database_lock_semaphore);
+ $query = sprintf("SELECT get_lock('%s-%s-%s')",
+ $this->database_lock_semaphore, $name, $sid);
while ( ! $this->db->query($query)) {
$t = 1 + time(); while ( $t > time() ) { ; }
}
}
}
- function ac_release_lock() {
+ function ac_release_lock($name, $sid) {
if ( "" != $this->database_lock_semaphore ) {
- $query = sprintf("SELECT release_lock('%s')", $this->database_lock_semaphore);
+ $query = sprintf("SELECT release_lock('%s-%s-%s')",
+ $this->database_lock_semaphore, $name, $sid);
$this->db->query($query);
}
}
Index: php-lib/php/local.inc
diff -u php-lib/php/local.inc:1.31 php-lib/php/local.inc:1.32
--- php-lib/php/local.inc:1.31 Fri Oct 29 15:55:13 1999
+++ php-lib/php/local.inc Fri Nov 12 08:11:25 1999
@@ -5,7 +5,7 @@
* Copyright (c) 1998,1999 NetUSE GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: local.inc,v 1.31 1999/10/29 13:55:13 kk Exp $
+ * $Id: local.inc,v 1.32 1999/11/12 07:11:25 kk Exp $
*
* All functions in this file are example classes, which can be used
* by your application to get you going. Once you get the hang of it,
@@ -34,7 +34,7 @@
#class Example_CT_Split_Sql extends CT_Split_Sql {
# var $database_class = "DB_Example"; ## Which database to connect...
# var $database_table = "active_sessions_split"; ## and find our session data in this table.
-# var $split_length = 4096 ## Split rows every 4096 bytes
+# var $split_length = 4096; ## Split rows every 4096 bytes
#}
#class Example_CT_Shm extends CT_Shm {
@@ -76,176 +76,27 @@
var $that_class = "Example_CT_Sql"; ## name of data storage container class
}
-##
-## The following Auth subclasses present different flavors of the
-## PHPLIB authentication schemes. In reality you would select one
-## and drop all the others from this file.
-##
-
-# An Auth class which authenticates against a database table.
-# Has examples for log mode (login only) and reg mode (registration).
-
-class Example_Auth extends Auth {
+class Example_Auth extends Auth_Sql {
var $classname = "Example_Auth";
+ var $lifetime = 15;
+ var $mode = "reg"; ## can do "log" as well.
- var $lifetime = 15;
-
- var $mode = "log"; ## also try "reg"
-
var $database_class = "DB_Example";
var $database_table = "auth_user";
-
- ## show login form
- ## this is a CI-less generic login form. Feel free to
- ## customize.
- function auth_loginform() {
- global $sess, $auth, $_PHPLIB, $PHP_SELF;
-
- include($_PHPLIB["libdir"] . "loginform.ihtml");
- }
-
- ## validate login information.
- ## please remember to adapt the global statements here to match the
- ## variables used in your loginform.ihtml.
- ## this function has to return false, if the login fails, or
- ## a valid user_id.
- function auth_validatelogin() {
- global $username, $password, $mode;
-
- if (isset($mode) && $mode == "reg") {
- $this->mode = "reg";
- $this->auth["uname"] = $username;
- $this->auth["error"] = "Please fill in the required registration information. Thank you.";
- return false;
- }
-
- if(isset($username)) {
- $this->auth["uname"]=$username; ## This provides access for "loginform.ihtml"
- }
-
- $uid = false;
-
- $this->db->query(sprintf("select user_id, perms ".
- " from %s ".
- " where username = '%s' ".
- " and password = '%s'",
- $this->database_table,
- addslashes($username),
- addslashes($password)));
-
- while($this->db->next_record()) {
- $uid = $this->db->f("user_id");
- $this->auth["perm"] = $this->db->f("perms");
- }
- if ($uid == false)
- $this->auth["error"] = "Either your username or password are invalid.<br>Please try again.";
- else
- SetCookie("auth_username", $username, pow(2, 31)-1, "/");
-
- return $uid;
- }
- function auth_preauth() {
- global $HTTP_COOKIE_VARS;
-
- if ($HTTP_COOKIE_VARS["auth_username"]) {
- $this->auth["uname"] = $HTTP_COOKIE_VARS["auth_username"];
- $this->mode = "log";
- }
- return false;
- }
-
- ## show registration form.
- ## this is a very basic one, you certainly want to
- ## add columns to that table and this form.
- function auth_registerform() {
- global $sess, $auth, $_PHPLIB, $PHP_SELF;
-
- include("registerform.ihtml");
- }
-
- function auth_doregister() {
- ## Import form variables
- global $username, $pass1, $pass2, $mode;
-
- ## Save the username for use in registerform.ihtml,
- ## should registration fail. If you add more fields,
- ## you will want to save them here, too.
- $this->auth["uname"] = $username;
-
- if (isset($mode) && $mode == "log") {
- $this->mode = "log";
- $this->auth["error"] = "Please enter your username and password. Thank you.";
- return false;
- }
-
- ## Check the passwords for validity.
- if ($pass1 != $pass2) {
- $this->auth["error"] = "Password and repeated password do not match. Please try again.";
- return false;
- }
-
- ## See if the user is already present
- $query = sprintf("select user_id, username, password, perms from %s where username = '%s'",
- $this->database_table,
- $username);
- $this->db->query($query);
- while($this->db->next_record()) {
- ## If user is present and password matches, silently log
- ## the user in.
- if ($this->db->f("password") == $pass1) {
- $this->auth["perm"] = $this->db->f("perms");
- return $this->db->f("user_id");
- }
-
- ## If user is present and password does not match,
- ## complain and fail.
- $this->auth["error"] = "This username is already taken. Please choose a different one.";
- return false;
- }
-
- ## password is good and user is new, create a uid
- ## and a user entry. The new user has no permissions (you
- ## might want to add some?)
- $uid = md5(uniqid($this->magic));
- $query = sprintf("insert into %s ( user_id, username, password ) values ('%s', '%s', '%s')",
- $this->database_table,
- $uid,
- $username,
- $pass1);
- $this->db->query($query);
-
- ## Set a cookie to remember the username.
- SetCookie("auth_username", $username, pow(2, 31)-1, "/");
-
- ## log in that new user. The new user has no permissions.
- ## If the user should have permissions, you put them
- ## into $auth->auth["perm"].
- return $uid;
- }
+ var $nobody = false; ## true for default authentication
}
-# This is Example_Auth with the $nobody flag set. Read up
-# on Default Authentication in the Documentation. You do not
-# need to derive this from Example_Auth, in fact it would be
-# better to set $nobody directly in Example_Auth.
-
-class Example_Default_Auth extends Example_Auth {
- var $classname = "Example_Default_Auth";
-
- var $nobody = true;
-}
-
# A variation of Example_Auth which uses a Challenge-Response
# Authentication. The password never crosses the net in clear,
# if the remote system supports JavaScript. Please read the
# Documentation section about CR Authentication to understand
# what is going on.
-class Example_Challenge_Auth extends Auth {
+class Example_Challenge_Auth extends Auth_Sql {
var $classname = "Example_Challenge_Auth";
- var $lifetime = 1;
+ var $lifetime = 15;
var $magic = "Simsalabim"; ## Challenge seed
var $database_class = "DB_Example";
@@ -268,15 +119,15 @@
if(isset($username)) {
$this->auth["uname"]=$username; ## This provides access for "loginform.ihtml"
}
- $this->db->query(sprintf("select user_id,perms,password ".
- "from %s where username = '%s'",
+ $this->db->query(sprintf("select p_user_id,p_perms,p_password ".
+ "from %s where p_username = '%s'",
$this->database_table,
addslashes($username)));
while($this->db->next_record()) {
- $uid = $this->db->f("user_id");
- $perm = $this->db->f("perms");
- $pass = $this->db->f("password");
+ $uid = $this->db->f("p_user_id");
+ $perm = $this->db->f("p_perms");
+ $pass = $this->db->f("p_password");
}
$exspected_response = md5("$username:$pass:$challenge");
@@ -332,15 +183,15 @@
$this->auth["uname"]=$username; ## This provides access for "loginform.ihtml"
- $this->db->query(sprintf("select user_id,perms,password ".
- "from %s where username = '%s'",
+ $this->db->query(sprintf("select p_user_id,p_perms,p_password ".
+ "from %s where p_username = '%s'",
$this->database_table,
addslashes($username)));
while($this->db->next_record()) {
- $uid = $this->db->f("user_id");
- $perm = $this->db->f("perms");
- $pass = $this->db->f("password"); ## Password is stored as a md5 hash
+ $uid = $this->db->f("p_user_id");
+ $perm = $this->db->f("p_perms");
+ $pass = $this->db->f("p_password"); ## Password is stored as a md5 hash
}
$exspected_response = md5("$username:$pass:$challenge");
@@ -396,14 +247,14 @@
## design stupidity.
##
## To use this, you must enable the require statement for
-## menu.inc in prepend.php3. If you are using Menu_Button
-## instead of Menu, you must also enable menu_button.inc in
-## prepend.php3.
+## menu.inc in prepend.php3.
##
## See /pages/menu for an example application of Example_Menu.
##
# class Example_Menu extends Menu {
+# var $classname = "Example_Menu";
+#
# # Map of PHP_SELF URL strings to menu positions
# var $urlmap = array(
# "/menu/index.php3" => "",
Index: php-lib/php/session.inc
diff -u php-lib/php/session.inc:1.54 php-lib/php/session.inc:1.55
--- php-lib/php/session.inc:1.54 Sat Nov 6 21:40:24 1999
+++ php-lib/php/session.inc Fri Nov 12 08:11:25 1999
@@ -5,7 +5,7 @@
* Copyright (c) 1998,1999 NetUSE GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: session.inc,v 1.54 1999/11/06 20:40:24 kk Exp $
+ * $Id: session.inc,v 1.55 1999/11/12 07:11:25 kk Exp $
*
*/
@@ -265,53 +265,6 @@
## and a variable $persistent_slots (containing the names of the slots
## to be saved as an array of strings).
- ## helper function for alternative serializer
- function u($v) {
- return unserialize(stripslashes($v));
- }
-
- ## this alternative serializer may be faster, but produces
- ## longer serialized data.
- function alternative_serialize($var, &$ser) {
- static $k;
-
- eval('$k = gettype($'.$var.');');
- switch ( $k ) {
-
- case "integer":
- case "double":
- case "string":
- case "array":
- eval("\$l = \$$var;");
- $ser .= "\$$var=\$this->u('".addslashes(serialize($l))."');";
- break;
-
- case "object":
-
- eval('
- $ser.="$$var=new ".$'.$var.'->classname.";";
- if ( is_array($'.$var.'->persistent_slots) ) {
- reset($'.$var.'->persistent_slots);
- while ( list(,$k) = each($'.$var.'->persistent_slots) ) {
- $this->serialize( "${var}->".$k, $ser );
- }
- } else {
- reset($'.$var.');
- while ( list($k) = each($'.$var.') ) {
- $this->serialize( "${var}->".$k, $ser );
- }
- }
-
- ');
-
- break;
- default:
- ;
- break;
- }
- }
-
- ## traditional serializer (patched 'object' handler)
function serialize($var, &$str) {
static $t,$l,$k;
@@ -368,11 +321,11 @@
}
function get_lock() {
- $this->that->ac_get_lock();
+ $this->that->ac_get_lock($this->name, $this->id);
}
function release_lock() {
- $this->that->ac_release_lock();
+ $this->that->ac_release_lock($this->name, $this->id);
}
## freeze():
Index: php-lib/stuff/create_database.msaccess95
diff -u php-lib/stuff/create_database.msaccess95:1.8 php-lib/stuff/create_database.msaccess95:1.9
--- php-lib/stuff/create_database.msaccess95:1.8 Thu Aug 26 12:51:08 1999
+++ php-lib/stuff/create_database.msaccess95 Fri Nov 12 08:11:25 1999
@@ -3,7 +3,7 @@
' Nom de SGBD : Microsoft Access 95
' Date de création : 9/24/98 10:48 AM
' ============================================================
-' $Id: create_database.msaccess95,v 1.8 1999/08/26 10:51:08 kk Exp $
+' $Id: create_database.msaccess95,v 1.9 1999/11/12 07:11:25 kk Exp $
' ============================================================
@@ -11,115 +11,68 @@
' ============================================================
Begin Table ACTIVE_SESSIONS
Name = active_sessions
- Begin Column SID
- Name = sid
+ Begin Column P_SID
+ Name = p_sid
DataType = Text(32)
Length = 32
Mandatory = YES
OrdinalNumber = 1
End Column
- Begin Column NAME
- Name = name
+ Begin Column P_NAME
+ Name = p_name
DataType = Text(32)
Length = 32
Mandatory = YES
OrdinalNumber = 2
End Column
- Begin Column VAL
- Name = val
- DataType = Memo
- Length = 4096
- OrdinalNumber = 3
- End Column
- Begin Column CHANGED
- Name = changed
- DataType = Text(14)
- Length = 14
- Mandatory = YES
- OrdinalNumber = 5
- End Column
- End Table
-
- ' ============================================================
- ' Index : ACTIVE_SESSIONS_PK
- ' ============================================================
- Begin Index ACTIVE_SESSIONS_PK
- Table = ACTIVE_SESSIONS
- Primary = primarykey
-
- Field = SID
- Field = NAME
- End Index
-
- ' ============================================================
- ' Index : CHANGED
- ' ============================================================
- Begin Index CHANGED
- Table = ACTIVE_SESSIONS
-
- Field = CHANGED
- End Index
-
- ' ============================================================
- ' Table : ACTIVE_SESSIONS_SPLIT
- ' ============================================================
- Begin Table ACTIVE_SESSIONS_SPLIT
- Name = active_sessions
- Begin Column CT_SID
- Name = ct_sid
- DataType = Text(32)
- Length = 32
- Mandatory = YES
- OrdinalNumber = 1
- End Column
- Begin Column CT_NAME
- Name = ct_name
- DataType = Text(32)
- Length = 32
- Mandatory = YES
- OrdinalNumber = 2
- End Column
- Begin Column CT_POS
- Name = ct_pos
+ Begin Column P_VALPOS
+ Name = p_valenc
DataType = Text(6)
Length = 6
Mandatory = YES
OrdinalNumber = 3
+ End Column
+ Begin Column P_VALENC
+ Name = p_valenc
+ DataType = Text(16)
+ Length = 16
+ Mandatory = YES
+ OrdinalNumber = 4
End Column
- Begin Column CT_VAL
- Name = ct_val
+ Begin Column P_VAL
+ Name = p_val
DataType = Memo
Length = 4096
- OrdinalNumber = 4
+ OrdinalNumber = 5
End Column
- Begin Column CT_CHANGED
- Name = ct_changed
+ Begin Column P_CHANGED
+ Name = p_changed
DataType = Text(14)
Length = 14
Mandatory = YES
- OrdinalNumber = 5
+ OrdinalNumber = 6
End Column
End Table
' ============================================================
- ' Index : ACTIVE_SESSIONS_SPLIT_PK
+ ' Index : ACTIVE_SESSIONS_PK
' ============================================================
- Begin Index ACTIVE_SESSIONS_SPLIT_PK
- Table = ACTIVE_SESSIONS_SPLIT
+ Begin Index ACTIVE_SESSIONS_PK
+ Table = ACTIVE_SESSIONS
Primary = primarykey
- Field = CT_SID
- Field = CT_NAME
- Field = CT_POS
+ Field = P_NAME
+ Field = P_SID
+ Field = P_VALPOS
End Index
' ============================================================
' Index : CHANGED
' ============================================================
Begin Index CHANGED
- Table = ACTIVE_SESSIONS_SPLIT
+ Table = ACTIVE_SESSIONS
- Field = CT_CHANGED
+ Field = P_CHANGED
End Index
' ============================================================
@@ -127,66 +80,39 @@
' ============================================================
Begin Table AUTH_USER
Name = auth_user
- Begin Column USER_ID
- Name = user_id
+ Begin Column P_USER_ID
+ Name = p_user_id
DataType = Text(32)
Length = 32
Mandatory = YES
OrdinalNumber = 1
End Column
- Begin Column USERNAME
- Name = username
+ Begin Column P_USERNAME
+ Name = p_username
DataType = Text(32)
Length = 32
Mandatory = YES
OrdinalNumber = 2
End Column
- Begin Column PASSWORD
- Name = password
- DataType = Text(32)
- Length = 32
+ Begin Column P_PWENC
+ Name = p_pwenc
+ DataType = Text(16)
+ Length = 16
Mandatory = YES
OrdinalNumber = 3
End Column
- Begin Column PERMS
- Name = perms
- DataType = Text(255)
- Length = 255
- OrdinalNumber = 4
- End Column
- End Table
-
- ' ============================================================
- ' Table : AUTH_USER_MD5
- ' ============================================================
- Begin Table AUTH_USER_MD5
- Name = auth_user_md5
- Begin Column USER_ID
- Name = user_id
- DataType = Text(32)
- Length = 32
- Mandatory = YES
- OrdinalNumber = 1
- End Column
- Begin Column USERNAME
- Name = username
+ Begin Column P_PASSWORD
+ Name = p_password
DataType = Text(32)
Length = 32
Mandatory = YES
- OrdinalNumber = 2
- End Column
- Begin Column PASSWORD
- Name = password
- DataType = Text(32)
- Length = 32
- Mandatory = YES
- OrdinalNumber = 3
+ OrdinalNumber = 4
End Column
- Begin Column PERMS
- Name = perms
+ Begin Column P_PERMS
+ Name = p_perms
DataType = Text(255)
Length = 255
- OrdinalNumber = 4
+ OrdinalNumber = 5
End Column
End Table
@@ -197,7 +123,7 @@
Table = AUTH_USER
Primary = primarykey
- Field = USER_ID
+ Field = P_USER_ID
End Index
' ============================================================
@@ -206,6 +132,6 @@
Begin Index K_USERNAME
Table = AUTH_USER
- Field = USERNAME
+ Field = P_USERNAME
End Index
Index: php-lib/stuff/create_database.msql
diff -u php-lib/stuff/create_database.msql:1.6 php-lib/stuff/create_database.msql:1.7
--- php-lib/stuff/create_database.msql:1.6 Thu Aug 26 12:51:08 1999
+++ php-lib/stuff/create_database.msql Fri Nov 12 08:11:25 1999
@@ -1,40 +1,28 @@
#
# This should work for mSQL 2.x
#
-# $Id: create_database.msql,v 1.6 1999/08/26 10:51:08 kk Exp $
+# $Id: create_database.msql,v 1.7 1999/11/12 07:11:25 kk Exp $
CREATE TABLE active_sessions (
- sid char(32),
- name char(32),
- val text(300),
- changed char(14),
+ p_sid char(32),
+ p_name char(32),
+ p_valpos char(6),
+ p_valenc char(16),
+ p_val text(300),
+ p_changed char(14),
) \g
-CREATE TABLE active_sessions_split (
- ct_sid char(32),
- ct_name char(32),
- ct_pos char(6),
- ct_val text(300),
- ct_changed char(14)
-) \g
-
CREATE TABLE auth_user (
- user_id char(32),
- username char(32),
- password char(32),
- perms char(255)
-) \g
-
-CREATE TABLE auth_user_md5 (
- user_id char(32),
- username char(32),
- password char(32),
- perms char(255)
+ p_user_id char(32),
+ p_username char(32),
+ p_pwenc char(16),
+ p_password char(32),
+ p_perms char(255)
) \g
-CREATE UNIQUE INDEX session_index ON active_sessions (sid,name) \g
-CREATE UNIQUE INDEX split_session_index ON active_sessions_split (ct_sid,ct_name,ct_pos) \g
-CREATE UNIQUE INDEX user_index ON auth_user (user_id) \g
+CREATE UNIQUE INDEX session_index ON active_sessions (p_name,p_sid,p_valpos) \g
+CREATE INDEX schanged_index ON active_sessions (p_changed) \g
+CREATE UNIQUE INDEX uid_index ON auth_user (p_user_id) \g
+CREATE UNIQUE INDEX user_index ON auth_user (p_username) \g
-INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','test','admin') \g
-INSERT INTO auth_user_md5 VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','098f6bcd4621d373cade4e832627b4f6','admin') \g
+INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','plain','test','admin') \g
Index: php-lib/stuff/create_database.mssql60
diff -u php-lib/stuff/create_database.mssql60:1.8 php-lib/stuff/create_database.mssql60:1.9
--- php-lib/stuff/create_database.mssql60:1.8 Thu Aug 26 12:51:09 1999
+++ php-lib/stuff/create_database.mssql60 Fri Nov 12 08:11:25 1999
@@ -3,7 +3,7 @@
/* Nom de SGBD : Microsoft SQL Server 6.0 */
/* Date de cr‚ation : 9/24/98 10:46 AM */
/* ============================================================ */
-/* $Id: create_database.mssql60,v 1.8 1999/08/26 10:51:09 kk Exp $ */
+/* $Id: create_database.mssql60,v 1.9 1999/11/12 07:11:25 kk Exp $ */
/* ============================================================ */
/* Nom de la base : myapp */
@@ -17,66 +17,39 @@
/* ============================================================ */
create table ACTIVE_SESSIONS
(
- SID varchar(32) not null,
- NAME varchar(32) not null,
- VAL varchar(4096) null ,
- CHANGED varchar(14) not null,
- constraint PK_ACTIVE_SESSIONS primary key (SID, NAME)
+ P_SID varchar(32) not null,
+ P_NAME varchar(32) not null,
+ P_VALPOS varchar(6) not null,
+ P_VALENC varchar(16) not null,
+ P_VAL varchar(4096) null ,
+ P_CHANGED varchar(14) not null,
+ constraint PK_ACTIVE_SESSIONS primary key (P_NAME, P_SID, P_VALPOS)
)
go
/* ============================================================ */
/* Index : CHANGED */
/* ============================================================ */
-create index CHANGED on ACTIVE_SESSIONS (CHANGED)
+create index CHANGED on ACTIVE_SESSIONS (P_CHANGED)
go
/* ============================================================ */
-/* Table : ACTIVE_SESSIONS_SPLIT */
-/* ============================================================ */
-create table ACTIVE_SESSIONS_SPLIT
-(
- CT_SID varchar(32) not null,
- CT_NAME varchar(32) not null,
- CT_POS varchar(6) not null,
- CT_VAL varchar(4096) null ,
- CT_CHANGED varchar(14) not null,
- constraint PK_ACTIVE_SESSIONS primary key (CT_SID, CT_NAME, CT_POS)
-)
-go
-
-/* ============================================================ */
-/* Index : CHANGED */
-/* ============================================================ */
-create index SCHANGED on ACTIVE_SESSIONS_SPLIT (CT_CHANGED)
-go
-
-/* ============================================================ */
/* Table : AUTH_USER */
/* ============================================================ */
create table AUTH_USER
-(
- USER_ID varchar(32) not null,
- USERNAME varchar(32) not null,
- PASSWORD varchar(32) not null,
- PERMS varchar(255) null ,
- constraint PK_AUTH_USER primary key (USER_ID)
-)
-go
-
-create table AUTH_USER_MD5
(
- USER_ID varchar(32) not null,
- USERNAME varchar(32) not null,
- PASSWORD varchar(32) not null,
- PERMS varchar(255) null ,
- constraint PK_AUTH_USER_MD5 primary key (USER_ID)
+ P_USER_ID varchar(32) not null,
+ P_USERNAME varchar(32) not null,
+ P_PWENC varchar(16) not null,
+ P_PASSWORD varchar(32) not null,
+ P_PERMS varchar(255) null ,
+ constraint PK_AUTH_USER primary key (P_USER_ID)
)
go
/* ============================================================ */
/* Index : K_USERNAME */
/* ============================================================ */
-create unique index K_USERNAME on AUTH_USER (USERNAME)
+create unique index K_USERNAME on AUTH_USER (P_USERNAME)
go
Index: php-lib/stuff/create_database.mysql
diff -u php-lib/stuff/create_database.mysql:1.14 php-lib/stuff/create_database.mysql:1.15
--- php-lib/stuff/create_database.mysql:1.14 Thu Aug 26 12:51:09 1999
+++ php-lib/stuff/create_database.mysql Fri Nov 12 08:11:25 1999
@@ -5,7 +5,7 @@
# Command:
# $ mysql -h host database_name <create_database.mysql
#
-# $Id: create_database.mysql,v 1.14 1999/08/26 10:51:09 kk Exp $
+# $Id: create_database.mysql,v 1.15 1999/11/12 07:11:25 kk Exp $
#
# Host: localhost Database: kris
#--------------------------------------------------------
@@ -15,60 +15,40 @@
#
CREATE TABLE active_sessions (
- sid varchar(32) NOT NULL,
- name varchar(32) NOT NULL,
- val text,
- changed varchar(14) DEFAULT '' NOT NULL,
- PRIMARY KEY (name, sid),
- KEY changed (changed)
+ p_sid varchar(32) NOT NULL,
+ p_name varchar(32) NOT NULL,
+ p_valpos varchar(6) NOT NULL,
+ p_valenc varchar(16) NOT NILL,
+ p_val text,
+ p_changed varchar(14) DEFAULT '' NOT NULL,
+ PRIMARY KEY (p_name, p_sid, p_valpos),
+ KEY changed (p_changed)
);
-CREATE TABLE active_sessions_split (
- ct_sid varchar(32) DEFAULT '' NOT NULL,
- ct_name varchar(32) DEFAULT '' NOT NULL,
- ct_pos varchar(6) DEFAULT '' NOT NULL,
- ct_val text,
- ct_changed varchar(14) DEFAULT '' NOT NULL,
- PRIMARY KEY (ct_name,ct_sid,ct_pos),
- KEY ct_changed (ct_changed)
-);
-
#
# Table structure for table 'auth_user'
#
CREATE TABLE auth_user (
- user_id varchar(32) DEFAULT '' NOT NULL,
- username varchar(32) DEFAULT '' NOT NULL,
- password varchar(32) DEFAULT '' NOT NULL,
- perms varchar(255),
- PRIMARY KEY (user_id),
- UNIQUE k_username (username)
-);
-
-#
-# Table structure for table 'auth_user_md5'
-#
-CREATE TABLE auth_user_md5 (
- user_id varchar(32) DEFAULT '' NOT NULL,
- username varchar(32) DEFAULT '' NOT NULL,
- password varchar(32) DEFAULT '' NOT NULL,
- perms varchar(255),
- PRIMARY KEY (user_id),
- UNIQUE k_username (username)
+ p_user_id varchar(32) DEFAULT '' NOT NULL,
+ p_username varchar(32) DEFAULT '' NOT NULL,
+ p_pwenc varchar(16) DEFAULT '' NOT NULL,
+ p_password varchar(32) DEFAULT '' NOT NULL,
+ p_perms varchar(255),
+ PRIMARY KEY (p_user_id),
+ UNIQUE k_username (p_username)
);
#
# Dumping data for table 'auth_user'
#
-INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','test','admin');
-INSERT INTO auth_user_md5 VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','098f6bcd4621d373cade4e832627b4f6','admin');
+INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','plain','test','admin');
#
# Table structure for table 'db_sequence'
#
CREATE TABLE db_sequence (
- seq_name varchar(127) DEFAULT '' NOT NULL,
- nextid int(10) unsigned DEFAULT '0' NOT NULL,
- PRIMARY KEY (seq_name)
+ p_seq_name varchar(127) DEFAULT '' NOT NULL,
+ p_nextid int(10) unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (p_seq_name)
);
Index: php-lib/stuff/create_database.odbc
diff -u php-lib/stuff/create_database.odbc:1.8 php-lib/stuff/create_database.odbc:1.9
--- php-lib/stuff/create_database.odbc:1.8 Thu Aug 26 12:51:09 1999
+++ php-lib/stuff/create_database.odbc Fri Nov 12 08:11:25 1999
@@ -1,50 +1,26 @@
create table ACTIVE_SESSIONS
(
- SID VARCHAR(32) not null,
- NAME VARCHAR(32) not null,
- VAL LONG VARCHAR ,
- CHANGED VARCHAR(14) not null,
- primary key (SID, NAME)
+ P_SID VARCHAR(32) not null,
+ P_NAME VARCHAR(32) not null,
+ P_VALPOS VARCHAR(6) not null,
+ P_VALENC VARCHAR(16) not null,
+ P_VAL LONG VARCHAR ,
+ P_CHANGED VARCHAR(14) not null,
+ primary key (P_NAME, P_SID, P_VALPOS)
);
-create unique index ACTIVE_SESSIONS_PK on ACTIVE_SESSIONS (SID asc, NAME asc);
+create unique index ACTIVE_SESSIONS_PK on ACTIVE_SESSIONS (P_NAME, P_SID asc, P_VALPOS asc);
+create index CHANGED on ACTIVE_SESSIONS (P_CHANGED asc);
-create index CHANGED on ACTIVE_SESSIONS (CHANGED asc);
-
-create table ACTIVE_SESSIONS_SPLIT
-(
- CT_SID VARCHAR(32) not null,
- CT_NAME VARCHAR(32) not null,
- CT_POS VARCHAR(6) not null,
- CT_VAL LONG VARCHAR ,
- CT_CHANGED VARCHAR(14) not null,
- primary key (CT_SID, CT_NAME, CT_POS)
-);
-
-create unique index ACTIVE_SESSIONS_SPLIT_PK on ACTIVE_SESSIONS (CT_SID asc, CT_NAME asc, CT_POS asc);
-
-create index SCHANGED on ACTIVE_SESSIONS_SPLIT (CT_CHANGED asc);
-
create table AUTH_USER
(
- USER_ID VARCHAR(32) not null,
- USERNAME VARCHAR(32) not null,
- PASSWORD VARCHAR(32) not null,
- PERMS VARCHAR(255) ,
- primary key (USER_ID)
+ P_USER_ID VARCHAR(32) not null,
+ P_USERNAME VARCHAR(32) not null,
+ P_PWENC VARCHAR(16) not null,
+ P_PASSWORD VARCHAR(32) not null,
+ P_PERMS VARCHAR(255) ,
+ primary key (P_USER_ID)
);
-
-create table AUTH_USER_MD5
-(
- USER_ID VARCHAR(32) not null,
- USERNAME VARCHAR(32) not null,
- PASSWORD VARCHAR(32) not null,
- PERMS VARCHAR(255) ,
- primary key (USER_ID)
-);
-
-create unique index AUTH_USER_PK on AUTH_USER (USER_ID asc);
-create unique index AUTH_USER_MD5_PK on AUTH_USER_MD5 (USER_ID asc);
-
-create unique index K_USERNAME on AUTH_USER (USERNAME asc);
+create unique index AUTH_USER_PK on AUTH_USER (P_USER_ID asc);
+create unique index K_USERNAME on AUTH_USER (P_USERNAME asc);
Index: php-lib/stuff/create_database.oracle
diff -u php-lib/stuff/create_database.oracle:1.10 php-lib/stuff/create_database.oracle:1.11
--- php-lib/stuff/create_database.oracle:1.10 Sat Sep 11 00:30:26 1999
+++ php-lib/stuff/create_database.oracle Fri Nov 12 08:11:26 1999
@@ -3,7 +3,7 @@
-- Nom de SGBD : ORACLE Version 7.x
-- Date de cr‚ation : 9/24/98 10:49 AM
-- ============================================================
--- $Id: create_database.oracle,v 1.10 1999/09/10 22:30:26 kk Exp $
+-- $Id: create_database.oracle,v 1.11 1999/11/12 07:11:26 kk Exp $
--
-- Update: should also work on 8.x
@@ -12,72 +12,40 @@
-- ============================================================
create table ACTIVE_SESSIONS
(
- SID VARCHAR2(32) not null,
- NAME VARCHAR2(32) not null,
- VAL LONG null ,
- CHANGED VARCHAR2(14) not null,
- constraint PK_ACTIVE_SESSIONS primary key (SID, NAME)
+ P_SID VARCHAR2(32) not null,
+ P_NAME VARCHAR2(32) not null,
+ P_VALPOS VARCHAR2(6) not null,
+ P_VALENC VARCHAR(16) not null,
+ P_VAL LONG null ,
+ P_CHANGED VARCHAR2(14) not null,
+ constraint PK_ACTIVE_SESSIONS primary key (P_NAME, P_SID, P_VALPOS)
)
/
-- ============================================================
-- Index : CHANGED
-- ============================================================
-create index CHANGED on ACTIVE_SESSIONS (CHANGED asc)
+create index CHANGED on ACTIVE_SESSIONS (P_CHANGED asc)
/
-- ============================================================
--- Table : ACTIVE_SESSIONS_SPLIT
--- ============================================================
-create table ACTIVE_SESSIONS_SPLIT
-(
- CT_SID VARCHAR2(32) not null,
- CT_NAME VARCHAR2(32) not null,
- CT_POS VARCHAR2(6) not null,
- CT_VAL LONG null ,
- CT_CHANGED VARCHAR2(14) not null,
- constraint PK_ACTIVE_SESSIONS_SPLIT primary key (CT_SID, CT_NAME, CT_POS)
-)
-/
-
--- ============================================================
--- Index : CHANGED
--- ============================================================
-create index SCHANGED on ACTIVE_SESSIONS_SPLIT (CT_CHANGED asc)
-/
-
--- ============================================================
-- Table : AUTH_USER
-- ============================================================
create table AUTH_USER
(
- USER_ID VARCHAR2(32) not null,
- USERNAME VARCHAR2(32) not null,
- PASSWORD VARCHAR2(32) not null,
- PERMS VARCHAR2(255) null ,
- constraint PK_AUTH_USER primary key (USER_ID)
+ P_USER_ID VARCHAR2(32) not null,
+ P_USERNAME VARCHAR2(32) not null,
+ P_PWENC VARCHAR(16) not null,
+ P_PASSWORD VARCHAR2(32) not null,
+ P_PERMS VARCHAR2(255) null ,
+ constraint PK_AUTH_USER primary key (P_USER_ID)
)
/
-- ============================================================
--- Table : AUTH_USER_MD5
--- ============================================================
-create table AUTH_USER_MD5
-(
- USER_ID VARCHAR2(32) not null,
- USERNAME VARCHAR2(32) not null,
- PASSWORD VARCHAR2(32) not null,
- PERMS VARCHAR2(255) null ,
- constraint PK_AUTH_USER_MD5 primary key (USER_ID)
-)
-/
-
--- ============================================================
-- Index : K_USERNAME
-- ============================================================
-create unique index K_USERNAME on AUTH_USER (USERNAME asc)
+create unique index K_USERNAME on AUTH_USER (P_USERNAME asc)
/
-
-INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','test','admin');
-INSERT INTO auth_user_md5 VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','098f6bcd4621d373cade4e832627b4f6','admin');
+INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','plain', 'test','admin');
Index: php-lib/stuff/create_database.pgsql
diff -u php-lib/stuff/create_database.pgsql:1.8 php-lib/stuff/create_database.pgsql:1.9
--- php-lib/stuff/create_database.pgsql:1.8 Thu Aug 26 12:51:09 1999
+++ php-lib/stuff/create_database.pgsql Fri Nov 12 08:11:26 1999
@@ -1,44 +1,28 @@
// creates basic database layout
// reincarnation of create_database.pgsql
-// $Id: create_database.pgsql,v 1.8 1999/08/26 10:51:09 kk Exp $
+// $Id: create_database.pgsql,v 1.9 1999/11/12 07:11:26 kk Exp $
CREATE TABLE active_sessions (
- sid varchar(32) DEFAULT '',
- name varchar(32) DEFAULT '',
- val text,
- changed varchar(14) DEFAULT '' NOT NULL,
- PRIMARY KEY (sid,name)
+ p_sid varchar(32) DEFAULT '',
+ p_name varchar(32) DEFAULT '',
+ p_valpos varchar(6) DEFAULT '',
+ p_valenc varchar(16) DEFAULT '',
+ p_val text,
+ p_changed varchar(14) DEFAULT '' NOT NULL,
+ PRIMARY KEY (p_name,p_sid,p_valpos)
);
-// CREATE INDEX k_changed ON active_sessions USING btree(changed);
+// CREATE INDEX k_changed ON active_sessions USING btree(p_changed);
-CREATE TABLE active_sessions_split (
- ct_sid varchar(32) NOT NULL,
- ct_name varchar(32) NOT NULL,
- ct_pos varchar(6) NOT NULL,
- ct_val text,
- ct_changed varchar(14) DEFAULT '' NOT NULL,
- PRIMARY KEY (ct_sid,ct_name,ct_pos)
-);
-CREATE INDEX k_asp_changed ON active_sessions_split USING btree(ct_changed);
-
CREATE TABLE auth_user (
- user_id varchar(32) PRIMARY KEY,
- username varchar(32) DEFAULT '' NOT NULL,
- password varchar(32) DEFAULT '' NOT NULL,
- perms varchar(255)
-);
-
-CREATE TABLE auth_user_md5 (
- user_id varchar(32) PRIMARY KEY,
- username varchar(32) DEFAULT '' NOT NULL,
- password varchar(32) DEFAULT '' NOT NULL,
- perms varchar(255)
+ p_user_id varchar(32) PRIMARY KEY,
+ p_username varchar(32) DEFAULT '' NOT NULL,
+ p_pwenc varchar(6) DEFAULT '' NOT NULL,
+ p_password varchar(32) DEFAULT '' NOT NULL,
+ p_perms varchar(255)
);
-CREATE UNIQUE INDEX k_username ON auth_user (username);
-CREATE UNIQUE INDEX k_username_md5 ON auth_user_md5 (username);
+CREATE UNIQUE INDEX k_username ON auth_user (p_username);
// This is an example of a sample row for auth_user
-INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','test','admin');
-INSERT INTO auth_user_md5 VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','098f6bcd4621d373cade4e832627b4f6','admin');
+INSERT INTO auth_user VALUES ('c14cbf141ab1b7cd009356f555b607dc','kris','plain','test','admin');
Index: php-lib/stuff/create_database.sybase
diff -u php-lib/stuff/create_database.sybase:1.10 php-lib/stuff/create_database.sybase:1.11
--- php-lib/stuff/create_database.sybase:1.10 Thu Aug 26 12:51:09 1999
+++ php-lib/stuff/create_database.sybase Fri Nov 12 08:11:26 1999
@@ -4,7 +4,7 @@
/* Date de cr‚ation : 9/24/98 10:50 AM */
/* ============================================================ */
-/* $Id: create_database.sybase,v 1.10 1999/08/26 10:51:09 kk Exp $ */
+/* $Id: create_database.sybase,v 1.11 1999/11/12 07:11:26 kk Exp $ */
/* ============================================================ */
/* Nom de la base : myapp */
@@ -17,69 +17,39 @@
/* ============================================================ */
create table ACTIVE_SESSIONS
(
- SID varchar(32) not null,
- NAME varchar(32) not null,
- VAL text null,
- CHANGED varchar(14) not null,
- constraint PK_ACTIVE_SESSIONS primary key (SID, NAME)
+ P_SID varchar(32) not null,
+ P_NAME varchar(32) not null,
+ P_VALPOS varchar(6) not null,
+ P_VALENC varchar(16) not null,
+ P_VAL text null,
+ P_CHANGED varchar(14) not null,
+ constraint PK_ACTIVE_SESSIONS primary key (P_NAME, P_SID, P_VALPOS)
)
go
/* ============================================================ */
/* Index : CHANGED */
/* ============================================================ */
-create index CHANGED on ACTIVE_SESSIONS (CHANGED)
+create index CHANGED on ACTIVE_SESSIONS (P_CHANGED)
go
/* ============================================================ */
-/* Table : ACTIVE_SESSIONS_SPLIT */
-/* ============================================================ */
-create table ACTIVE_SESSIONS_SPLIT
-(
- CT_SID varchar(32) not null,
- CT_NAME varchar(32) not null,
- CT_POS varchar(6) not null,
- CT_VAL text null,
- CT_CHANGED varchar(14) not null,
- constraint PK_ACTIVE_SESSIONS primary key (CT_SID, CT_NAME, CT_POS)
-)
-go
-
-/* ============================================================ */
-/* Index : CHANGED */
-/* ============================================================ */
-create index SCHANGED on ACTIVE_SESSIONS_SPLIT (SCHANGED)
-go
-
-/* ============================================================ */
/* Table : AUTH_USER */
/* ============================================================ */
create table AUTH_USER
-(
- USER_ID varchar(32) not null,
- USERNAME varchar(32) not null,
- PASSWORD varchar(32) not null,
- PERMS varchar(255) null ,
- constraint PK_AUTH_USER primary key (USER_ID)
-)
-go
-
-/* ============================================================ */
-/* Table : AUTH_USER_MD5 */
-/* ============================================================ */
-create table AUTH_USER_MD5
(
- USER_ID varchar(32) not null,
- USERNAME varchar(32) not null,
- PASSWORD varchar(32) not null,
- PERMS varchar(255) null ,
- constraint PK_AUTH_USER_MD5 primary key (USER_ID)
+ P_USER_ID varchar(32) not null,
+ P_USERNAME varchar(32) not null,
+ P_PWENC varchar(16) not null,
+ P_PASSWORD varchar(32) not null,
+ P_PERMS varchar(255) null ,
+ constraint PK_AUTH_USER primary key (P_USER_ID)
)
go
/* ============================================================ */
/* Index : K_USERNAME */
/* ============================================================ */
-create unique index K_USERNAME on AUTH_USER (USERNAME)
+create unique index K_USERNAME on AUTH_USER (P_USERNAME)
go
-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.
- Next message: Massimiliano Masserelli: "Re: [PHPLIB-DEV] cvs commit"
- Previous message: kk: "[PHPLIB-DEV] cvs commit"
- Next in thread: Massimiliano Masserelli: "Re: [PHPLIB-DEV] cvs commit"
- Reply: Massimiliano Masserelli: "Re: [PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ su

