[PHPLIB] trouble upgrading From: Jay Pfaffman (pfaffman <email protected>)
Date: 10/29/99

I'm upgrading from 6.1 to 7.2. I managed to find the
README.migrate_V7 file & have changed my local.inc as (almost)
recommended in the file, but I'm getting the following error:

    Fatal error: Call to unsupported or undefined function query() in
                ct_sql.inc on line 109

I've waded through the code, but don't see anything that I've
screwed up.

Any help would be appreciated. My local.inc & prepend.inc files are
appended.

-- 
Jay Pfaffman                           pfaffman <email protected>
+1-615-343-1720 (office)               +1-615-460-9299 (home) 
http://relax.ltc.vanderbilt.edu/~pfaffman/

<?php /* * Session Management for PHP3 * * (C) Copyright 1998 SH Online Dienst GmbH * Boris Erdmann, Kristian Koehntopp * * $Id: local.inc,v 1.8 1998/11/17 13:33:22 sas Exp $ * */

class DB_smart extends DB_Sql { var $Host = "localhost"; ## var $Database = "cpe"; ## var $User = ""; ## var $Password = ""; ##

function table_data($tablename){ $meta=$this->metadata($tablename); $numfields=count($meta); $i=0; while ($i < $numfields) { $thisname=$meta[$i][name]; $fielddata[$thisname][name] = $meta[$i][name]; $fielddata[$thisname][type]= $meta[$i][type]; $fielddata[$thisname][length]= $meta[$i][len]; $fielddata[$thisname][flags]= $meta[$i][flags]; $i++; } return $fielddata; } // end of table_data

function keymap($tablename,$key,$name){ $this->query("select $key,$name from $tablename"); while ($this->next_record()){ $map[$this->f($key)]=$this->f($name); } return($map); } }

class my_sql extends CT_Sql { var $classname = "my_sql"; var $database_class = "smart_User"; var $database_table = "active_sessions"; };

class smart_Session extends Session { var $classname = "smart_Session"; var $cookiename = ""; ## defaults to classname var $magic = "Relax!"; ## ID seed var $mode = "cookie"; ## We propagate session IDs with cookies var $fallback_mode = "get"; var $lifetime = 0; ## 0 = do session cookies, else minutes var $database_class = "DB_smart"; ## Which database to connect... var $database_table = "active_sessions"; ## find our session data in this table. var $gc_probability = 5; var $that_class = "my_sql"; }

class smart_User extends User { var $classname = "smart_User"; var $magic = "Relax!"; ## ID seed var $database_class = "DB_smart"; ## Which database to connect... var $database_table = "active_sessions"; ## and find our session data in this table. }

class smart_Auth extends Auth { var $classname = "smart_Auth"; var $lifetime = 15; var $database_class = "DB_smart"; var $database_table = "people"; function auth_loginform() { global $sess; include("loginform.php3"); }

function auth_validatelogin() { global $username, $password;

$this->auth["uname"]=$username; ## This provides access for "loginform.ihtml" $uid = false;

$this->db->query(sprintf("select userid, perms from %s where userid = '%s' and password = '%s'",

// $this->database_table, "people", addslashes($username), addslashes($password)));

while($this->db->next_record()) { $uid = $this->db->f("userid"); $this->auth["perm"] = $this->db->f("perms"); } return $uid; } }

class smart_Default_Auth extends smart_Auth { var $classname = "smart_Default_Auth"; var $nobody = true;

}

class smart_Challenge_Auth extends Auth { var $classname = "smart_Challenge_Auth";

var $lifetime = 1;

var $magic = "Simsalabim"; ## Challenge seed var $database_class = "DB_smart"; // var $database_table = "auth_user"; var $database_table = "people";

function auth_loginform() { global $sess; global $challenge; $challenge = md5(uniqid($this->magic)); $sess->register("challenge"); include("class.php3"); } function auth_validatelogin() { global $username, $password, $challenge, $response;

$this->auth["uname"]=$username; ## This provides access for "loginform.ihtml" $this->db->query(sprintf("select userid,perms,password ". "from %s where userid = '%s'", $this->database_table, addslashes($username)));

while($this->db->next_record()) { $uid = $this->db->f("userid"); $perm = $this->db->f("perms"); $pass = $this->db->f("password"); } $exspected_response = md5("$username:$pass:$challenge");

## True when JS is disabled if ($response == "") { if ($password != $pass) { return false; } else { $this->auth["perm"] = $perm; return $uid; } } ## Response is set, JS is enabled if ($exspected_response != $response) { return false; } else { $this->auth["perm"] = $perm; return $uid; } } }

class smart_Perm extends Perm { var $classname = "smart_Perm"; var $permissions = array( "Student" => 1, "Teacher" => 3, "Editor" => 7, "Researcher" => 15, "admin" => 31 );

function perm_invalid($does_have, $must_have) { global $perm, $auth, $sess; include("perminvalid.ihtml"); } }

?>

----------------------------------------

prepend.inc:

<?php require("db_mysql.inc"); /* Change this to match your database. */ require("session.inc"); /* Required for everything below. */ require("auth.inc"); /* Disable this, if you are not using authentication. */ require("perm.inc"); /* Disable this, if you are not using permission checks. */ require("user.inc"); /* Disable this, if you are not using per-user variables. */ require("page.inc"); /* Required, contains the page management functions. */ require("ct_sql.inc"); require("mylocal.inc"); /* Required, contains your local configuration. */

?> - PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in the body, not the subject, of your message.