phpmp-commits Mailing List for phpMyPublications (Page 2)
Status: Pre-Alpha
Brought to you by:
heimidal
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
(69) |
May
(1) |
Jun
|
Jul
(53) |
Aug
(27) |
Sep
|
Oct
|
Nov
(35) |
Dec
(71) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(5) |
Feb
(65) |
Mar
|
Apr
(15) |
May
(40) |
Jun
(72) |
Jul
|
Aug
(2) |
Sep
(95) |
Oct
(37) |
Nov
|
Dec
|
| 2005 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/language/en In directory sc8-pr-cvs1:/tmp/cvs-serv25621/language/en Removed Files: index.html lang_main.php Log Message: Fresh start... --- index.html DELETED --- --- lang_main.php DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/templates/BlueMP/images In directory sc8-pr-cvs1:/tmp/cvs-serv25621/templates/BlueMP/images Removed Files: phpMP_logo.png Log Message: Fresh start... --- phpMP_logo.png DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/templates_cache In directory sc8-pr-cvs1:/tmp/cvs-serv25621/templates_cache Removed Files: index.html Log Message: Fresh start... --- index.html DELETED --- |
Update of /cvsroot/phpmp/phpMP/core In directory sc8-pr-cvs1:/tmp/cvs-serv25621/core Removed Files: constants.php debug.php functions.php index.html main.php mpcode.php mpcode_arrays.php sessions.php template.php user.php Log Message: Fresh start... --- constants.php DELETED --- --- debug.php DELETED --- --- functions.php DELETED --- --- index.html DELETED --- --- main.php DELETED --- --- mpcode.php DELETED --- --- mpcode_arrays.php DELETED --- --- sessions.php DELETED --- --- template.php DELETED --- --- user.php DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:32
|
Update of /cvsroot/phpmp/phpMP/install In directory sc8-pr-cvs1:/tmp/cvs-serv25621/install Removed Files: index.php Log Message: Fresh start... --- index.php DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:30
|
Update of /cvsroot/phpmp/phpMP/modules In directory sc8-pr-cvs1:/tmp/cvs-serv25621/modules Removed Files: index.html Log Message: Fresh start... --- index.html DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:29
|
Update of /cvsroot/phpmp/phpMP/core/dba In directory sc8-pr-cvs1:/tmp/cvs-serv25621/core/dba Removed Files: firebird.php index.html mysql.php oracle8.php postgresql.php Log Message: Fresh start... --- firebird.php DELETED --- --- index.html DELETED --- --- mysql.php DELETED --- --- oracle8.php DELETED --- --- postgresql.php DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:29
|
Update of /cvsroot/phpmp/phpMP/docs/sql In directory sc8-pr-cvs1:/tmp/cvs-serv25621/docs/sql Removed Files: mysql_default_vals.sql mysql_structure.sql Log Message: Fresh start... --- mysql_default_vals.sql DELETED --- --- mysql_structure.sql DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:29
|
Update of /cvsroot/phpmp/phpMP/admin In directory sc8-pr-cvs1:/tmp/cvs-serv25621/admin Removed Files: index.html Log Message: Fresh start... --- index.html DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:07:29
|
Update of /cvsroot/phpmp/phpMP/docs In directory sc8-pr-cvs1:/tmp/cvs-serv25621/docs Removed Files: Changelog MODULES NOTES TODO config.php.sample Log Message: Fresh start... --- Changelog DELETED --- --- MODULES DELETED --- --- NOTES DELETED --- --- TODO DELETED --- --- config.php.sample DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-15 03:02:49
|
Update of /cvsroot/phpmp/phpMP In directory sc8-pr-cvs1:/tmp/cvs-serv25032 Removed Files: config.php directories.php index.php login_test.php profile.php Log Message: --- config.php DELETED --- --- directories.php DELETED --- --- index.php DELETED --- --- login_test.php DELETED --- --- profile.php DELETED --- |
|
From: Adam A. <ra...@us...> - 2003-10-09 05:37:52
|
Update of /cvsroot/phpmp/phpMP/core/dba
In directory sc8-pr-cvs1:/tmp/cvs-serv8299/core/dba
Modified Files:
firebird.php mysql.php postgresql.php
Log Message:
Final commits for the night, fixed some small issues with mysql and pgsql, initial checkin of Firebase API (really is far from complete, just putting in what I could do on first glance)
Index: firebird.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/firebird.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** firebird.php 14 Sep 2003 21:09:11 -0000 1.1
--- firebird.php 9 Oct 2003 05:37:46 -0000 1.2
***************
*** 22,25 ****
*
*/
!
! ?>
\ No newline at end of file
--- 22,258 ----
*
*/
!
! // Firebird 1.x Database API
!
! class sql_db
! {
! var $db_connection_id;
! var $db_query;
! var $db_query_result = 0;
! var $db_query_count = 0;
! var $db_rowset = array();
!
! // Open database connection, select database
! function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL )
! {
! $db_path = $hostname.":".$database;
!
! if( !is_null($this->persistant) )
! {
! $this->db_connection_id = @ibase_pconnect($db_path, $username, $password);
! }
! else
! {
! $this->db_connection_id = @ibase_connect($db_path, $username, $password);
!
! }
!
! if( !$this->db_connection_id )
! {
! if( !is_null($error_handling) )
! {
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id));
! }
! else
! {
! return false;
! }
! }
!
! return $this->db_connection_id;
! }
!
! function sql_close($db_connect_id = NULL)
! {
! if( is_null($db_connect_id) )
! {
! $db_connect_id = $this->db_connection_id;
! }
!
! if($db_connect_id != FALSE)
! {
! if($this->db_query_result)
! {
! @$this->sql_free_result($this->db_query_result);
! }
!
! return @ibase_close($db_connect_id);
! }
! }
!
! // Query database
! // If you pass no query, it will try to execute the last query again
! function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL )
! {
! $this->sql_free_result($this->db_query_result); // remove previous query result
!
! if( !empty($sql) )
! {
! $this->db_query = $sql;
! }
!
! $this->db_query_count++;
!
! $this->db_query_result = @ibase_query($this->db_connection_id, $this->db_query);
!
! if( $this->db_query_result)
! {
! unset($this->db_rowset[$this->db_query_result]);
! return $this->db_query_result;
! }
! else
! {
! if( !is_null($sql_explain) )
! {
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file);
! }
! else
! {
! return false;
! }
! }
! }
!
! // Select a row as an Associative, Numeric or Both (array)
! function sql_fetch_row($db_query_id = NULL, $row = NULL, $type = 'ASSOC')
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! switch($type)
! {
! case 'NUM':
! return @ibase_fetch_row($db_query_id);
! case 'ASSOC':
! default:
! return @ibase_fetch_assoc($db_query_id, $type);
! }
! }
!
! // Select all rows in one big array
! function sql_fetch_rowset($db_query_id = NULL, $type = 'ASSOC')
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! unset($this->db_rowset[$this->db_query_result]);
!
! $this->db_rowset[$this->db_query_result] = Array();
!
! while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) )
! {
! $this->db_rowset[$this->db_query_result][] = $row;
! }
!
! return $this->db_rowset[$this->db_query_result];
! }
!
! // Number of rows from the last select query. Shouldn't be used for
! // Firebird compatability (hopefully an ibase_num_rows function will
! // be soon)
! function sql_num_rows($db_query_id = NULL)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! // VOID for now
! }
!
! // Get last ID generated from an INSERT query
! function sql_insert_id($db_query_id = NULL)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! // VOID for now
! }
!
! // Free result resource
! function sql_free_result($db_query_id = NULL)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! unset($this->db_rowset[$db_query_id]);
!
! return @ibase_free_result($db_query_id);
! }
!
! // Number of fields selected in last query
! function sql_num_fields($db_query_id = NULL)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! return @ibase_num_fields($db_query_id);
! }
!
! // Name of a specific field from a result
! function sql_field_name($db_query_id = NULL, $field_offset)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! // VOID for now
! }
!
! // Field type from a result
! function sql_field_type($db_query_id = NULL, $field_offset)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! // VOID for now
! }
!
! // Amount of rows affected in last query
! function sql_affected_rows()
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! // VOID for now
! }
!
! // SQL Error message from connection
! function sql_error($db_connection_id = NULL)
! {
! if( is_null($db_connection_id) )
! {
! $db_connection_id = $this->db_connect_id;
! }
!
! return @ibase_errmsg($db_connection_id);
! }
!
! // SQL Error number from connection
! function sql_errno($db_connection_id = NULL)
! {
! if( is_null($db_connection_id) )
! {
! $db_connection_id = $this->db_connect_id;
! }
!
! // VOID for now
! }
! } // End of sql_db
!
! ?>
\ No newline at end of file
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/mysql.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** mysql.php 9 Oct 2003 05:16:37 -0000 1.16
--- mysql.php 9 Oct 2003 05:37:46 -0000 1.17
***************
*** 37,45 ****
if( !is_null($this->persistant) )
{
! $this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
}
else
{
! $this->db_connection_id = @mysql_connect($this->hostname, $this->username, $this->password);
}
--- 37,45 ----
if( !is_null($this->persistant) )
{
! $this->db_connection_id = @mysql_pconnect($host, $username, $password);
}
else
{
! $this->db_connection_id = @mysql_connect($host, $username, $password);
}
***************
*** 58,62 ****
else
{
! if(! empty($this->database))
{
if( !is_null($error_handling) )
--- 58,64 ----
else
{
! $db_select = @mysql_select_db($database, $this->db_connection_id);
!
! if( !$db_select )
{
if( !is_null($error_handling) )
***************
*** 148,152 ****
$this->db_rowset[$this->db_query_result] = Array();
! while( $row = @this->sql_fetch_row($db_query_id, NULL, $type) )
{
$this->db_rowset[$this->db_query_result][] = $row;
--- 150,154 ----
$this->db_rowset[$this->db_query_result] = Array();
! while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) )
{
$this->db_rowset[$this->db_query_result][] = $row;
Index: postgresql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/postgresql.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** postgresql.php 9 Oct 2003 05:16:37 -0000 1.5
--- postgresql.php 9 Oct 2003 05:37:46 -0000 1.6
***************
*** 56,59 ****
--- 56,61 ----
}
}
+
+ return $this->db_connection_id;
}
|
|
From: Adam A. <ra...@us...> - 2003-10-09 05:16:40
|
Update of /cvsroot/phpmp/phpMP/core/dba
In directory sc8-pr-cvs1:/tmp/cvs-serv5771/core/dba
Modified Files:
mysql.php postgresql.php
Log Message:
PostgreSQL should be as functional as MySQL (if that says much). Removed some functions, we can rework them later if we need them.
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/mysql.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** mysql.php 9 Oct 2003 04:35:58 -0000 1.15
--- mysql.php 9 Oct 2003 05:16:37 -0000 1.16
***************
*** 27,30 ****
--- 27,31 ----
{
var $db_connection_id;
+ var $db_query;
var $db_query_result = 0;
var $db_query_count = 0;
***************
*** 34,44 ****
function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL )
{
- $this->hostname = $hostname;
- $this->port = $port;
- $this->username = $username;
- $this->password = $password;
- $this->database = $database;
- $this->persistant = $persistant;
-
if( !is_null($this->persistant) )
{
--- 35,38 ----
***************
*** 91,95 ****
if($this->db_query_result)
{
! @mysql_free_result($this->db_query_result);
}
--- 85,89 ----
if($this->db_query_result)
{
! @$this->sql_free_result($this->db_query_result);
}
***************
*** 99,112 ****
// Query database
! function sql_query($sql, $sql_explain = NULL, $line = NULL, $file = NULL )
{
$this->sql_free_result($this->db_query_result); // remove previous query result
!
! if(! empty($sql))
{
! $this->db_query_count++;
!
! $this->db_query_result = @mysql_query($sql, $this->db_connection_id);
}
if( $this->db_query_result)
--- 93,109 ----
// Query database
! // If you pass no query, it will try to execute the last query again
! function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL )
{
$this->sql_free_result($this->db_query_result); // remove previous query result
!
! if( !empty($sql) )
{
! $this->db_query = $sql;
}
+
+ $this->db_query_count++;
+
+ $this->db_query_result = @mysql_query($this->db_query, $this->db_connection_id);
if( $this->db_query_result)
***************
*** 129,133 ****
// Select a row as an Associative, Numeric or Both (array)
! function sql_fetch_row($db_query_id = NULL, $type = MYSQL_BOTH)
{
if( is_null($db_query_id) )
--- 126,130 ----
// Select a row as an Associative, Numeric or Both (array)
! function sql_fetch_row($db_query_id = NULL, $row = NULL, $type = MYSQL_BOTH)
{
if( is_null($db_query_id) )
***************
*** 151,155 ****
$this->db_rowset[$this->db_query_result] = Array();
! while($row = @mysql_fetch_array($db_query_id, $type))
{
$this->db_rowset[$this->db_query_result][] = $row;
--- 148,152 ----
$this->db_rowset[$this->db_query_result] = Array();
! while( $row = @this->sql_fetch_row($db_query_id, NULL, $type) )
{
$this->db_rowset[$this->db_query_result][] = $row;
***************
*** 227,248 ****
return @mysql_field_type($db_query_id, $field_offset);
- }
-
- // Gets column information and returns it object forum
- function sql_fetch_field($db_query_id = NULL, $field_offset = NULL)
- {
- if( is_null($db_query_id) )
- {
- $db_query_id = $this->db_query_result;
- }
-
- if( is_null($field_offset) )
- {
- return @mysql_fetch_field($db_query_id);
- }
- else
- {
- return @mysql_fetch_field($db_query_id, $field_offset);
- }
}
--- 224,227 ----
Index: postgresql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/postgresql.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** postgresql.php 27 Sep 2003 03:42:22 -0000 1.4
--- postgresql.php 9 Oct 2003 05:16:37 -0000 1.5
***************
*** 23,56 ****
*/
class sql_db
{
var $db_connection_id;
var $db_query_result = 0;
var $db_query_count = 0;
- var $db_row = array();
var $db_rowset = array();
! //
! // CONSTRUCTOR - sql_connect
! //
! function sql_db($hostname, $port, $username, $password, $database, $persistant)
! {
! $this->hostname = $hostname;
! $this->port = $port;
! $this->username = $username;
! $this->password = $password;
! $this->database = $database;
! $this->persistant = $persistant;
! if( $this->persistant)
{
! $this->db_connection_id = pg_pconnect("host=$this->hostname port=$this->port user=$this->username password=$this->password dbname=$this->database");
}
else
{
! $this->db_connection_id = pg_connect("host=$this->hostname port=$this->port user=$this->username password=$this->password dbname=$this->database");
}
}
// Attempt to get PostgreSQL Error code
// Blame me (R45) if this fails
--- 23,257 ----
*/
+ // PostgreSQL 7.x Database API
+
class sql_db
{
var $db_connection_id;
+ var $db_query;
var $db_query_result = 0;
var $db_query_count = 0;
var $db_rowset = array();
! // Open database connection, select database
! function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL )
! {
! if( !is_null($this->persistant) )
! {
! $this->db_connection_id = pg_pconnect("host=$hostname port=$port user=$username password=$password dbname=$database");
! }
! else
! {
! $this->db_connection_id = pg_connect("host=$hostname port=$port user=$username password=$password dbname=$database");
! }
!
! if( !$this->db_connection_id )
! {
! if( !is_null($error_handling) )
! {
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), NULL);
! }
! else
! {
! return false;
! }
! }
! }
!
! function sql_close($db_connect_id = NULL)
! {
! if( is_null($db_connect_id) )
! {
! $db_connect_id = $this->db_connection_id;
! }
!
! if($db_connect_id != FALSE)
! {
! if($this->db_query_result)
! {
! $this->sql_free_result($this->db_query_result);
! }
!
! return @pg_close($db_connect_id);
! }
! }
!
! // Query database
! // If you pass no query, it will try to execute the last query again
! function sql_query($sql = '', $sql_explain = NULL, $line = NULL, $file = NULL )
! {
! $this->sql_free_result($this->db_query_result); // remove previous query result
!
! if( !empty($sql) )
! {
! $this->db_query = $sql;
! }
!
! $this->db_query_count++;
!
! $this->db_query_result = @pg_exec($this->db_query, $this->db_connection_id);
! if( $this->db_query_result)
{
! unset($this->db_rowset[$this->db_query_result]);
! return $this->db_query_result;
}
else
{
! if( !is_null($sql_explain) )
! {
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file);
! }
! else
! {
! return false;
! }
! }
! }
!
! // Select a row as an Associative, Numeric or Both (array)
! function sql_fetch_row($db_query_id = NULL, $row_number = NULL, $type = PGSQL_BOTH)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! if ( !is_null($row_number) )
! {
! return @pg_fetch_array($db_query_id, $row_number, $type);
! }
! else
! {
! return @pg_fetch_array($db_query_id);
! }
! }
!
! // Select all rows in one big array
! function sql_fetch_rowset($db_query_id = NULL, $type = PGSQL_BOTH)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
! }
!
! unset($this->db_rowset[$this->db_query_result]);
!
! $this->db_rowset[$this->db_query_result] = Array();
!
! while( $row = $this->sql_fetch_row($db_query_id, NULL, $type) )
! {
! $this->db_rowset[$this->db_query_result][] = $row;
! }
!
! return $this->db_rowset[$this->db_query_result];
! }
!
! // Number of rows from the last select query. Shouldn't be used for
! // Firebird compatability (hopefully an ibase_num_rows function will
! // be soon)
! function sql_num_rows($db_query_id = NULL)
! {
! if( is_null($db_query_id) )
! {
! $db_query_id = $this->db_query_result;
}
+
+ return @pg_numrows($db_query_id);
}
+ // Get last ID generated from an INSERT query
+ // We will base this ID on the last query. The only way this function
+ // to work is to execute this right after you run the INSERT query.
+ function sql_insert_id($db_query_id = NULL)
+ {
+ // Regex used from phpBB 2.0.x
+ if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->db_query, $tablename) )
+ {
+ $sequence_result = $this->sql_query("SELECT currval('".$tablename[1]."_seq') AS last_id");
+
+ if( !$sequence_data )
+ {
+ return false;
+ }
+
+ $sequence_data = $this->sql_fetch_row($sequence_result, 0, PGSQL_ASSOC);
+
+ if( $sequence_data )
+ {
+ return $sequence_data['last_id'];
+ }
+ }
+
+ return false;
+ }
+
+ // Free result resource
+ function sql_free_result($db_query_id = NULL)
+ {
+ if( is_null($db_query_id) )
+ {
+ $db_query_id = $this->db_query_result;
+ }
+
+ unset($this->db_rowset[$db_query_id]);
+
+ return @pg_freeresult($db_query_id);
+ }
+
+ // Number of fields selected in last query
+ function sql_num_fields($db_query_id = NULL)
+ {
+ if( is_null($db_query_id) )
+ {
+ $db_query_id = $this->db_query_result;
+ }
+
+ return @pg_numfields($db_query_id);
+ }
+
+ // Name of a specific field from a result
+ function sql_field_name($db_query_id = NULL, $field_offset)
+ {
+ if( is_null($db_query_id) )
+ {
+ $db_query_id = $this->db_query_result;
+ }
+
+ return @pg_fieldname($db_query_id, $field_offset);
+ }
+
+ // Field type from a result
+ function sql_field_type($db_query_id = NULL, $field_offset)
+ {
+ if( is_null($db_query_id) )
+ {
+ $db_query_id = $this->db_query_result;
+ }
+
+ return @pg_fieldtype($db_query_id, $field_offset);
+ }
+
+ // Amount of rows affected in last query
+ function sql_affected_rows()
+ {
+ if( is_null($db_query_id) )
+ {
+ $db_query_id = $this->db_query_result;
+ }
+
+ return @pg_cmdtuples($this->db_connection_id);
+ }
+
+ // SQL Error message from connection
+ function sql_error($db_connection_id = NULL)
+ {
+ if( is_null($db_connection_id) )
+ {
+ $db_connection_id = $this->db_connect_id;
+ }
+
+ return @pg_errormessage($db_connection_id);
+ }
+
// Attempt to get PostgreSQL Error code
// Blame me (R45) if this fails
***************
*** 66,70 ****
// We'll get the last message here, feel free to adjust this Booster
// if you want it as an object variable created elsewhere
! $last_error = @pg_errormessage($connection);
// So we don't have to set the error messages again
--- 267,271 ----
// We'll get the last message here, feel free to adjust this Booster
// if you want it as an object variable created elsewhere
! $last_error = $this->sql_error($connection);
// So we don't have to set the error messages again
***************
*** 115,120 ****
// No error number exists, so 0 will do
! return 0;
}
! }
! ?>
--- 316,323 ----
// No error number exists, so 0 will do
! return NULL;
}
!
! } // End of sql_db
!
! ?>
\ No newline at end of file
|
|
From: Adam A. <ra...@us...> - 2003-10-09 04:36:02
|
Update of /cvsroot/phpmp/phpMP/core/dba In directory sc8-pr-cvs1:/tmp/cvs-serv982/core/dba Modified Files: mysql.php Log Message: whitespace at the end of a file .. oops Index: mysql.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/core/dba/mysql.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** mysql.php 9 Oct 2003 04:34:19 -0000 1.14 --- mysql.php 9 Oct 2003 04:35:58 -0000 1.15 *************** *** 280,282 **** } } // End of sql_db ! ?> --- 280,283 ---- } } // End of sql_db ! ! ?> \ No newline at end of file |
|
From: Adam A. <ra...@us...> - 2003-10-09 04:34:24
|
Update of /cvsroot/phpmp/phpMP/core/dba
In directory sc8-pr-cvs1:/tmp/cvs-serv842/core/dba
Modified Files:
mysql.php
Log Message:
Cleaned up file, remove row_seek (not needed), removed many unneccessary statements, standardised on passing NULL references for null variables
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/mysql.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** mysql.php 5 Oct 2003 22:10:32 -0000 1.13
--- mysql.php 9 Oct 2003 04:34:19 -0000 1.14
***************
*** 22,33 ****
*/
! //
! // some parts of this file based upon code in phpBB 2.0.6
! //
!
! //
! // To clear up misconception, there will be use of a error handler in the future
! // when one is written ^_^
! //
class sql_db
--- 22,26 ----
*/
! // MySQL 3.x/4.0 Database API
class sql_db
***************
*** 36,46 ****
var $db_query_result = 0;
var $db_query_count = 0;
- var $db_row = array();
var $db_rowset = array();
! //
! // CONSTRUCTOR - sql_connect
! //
! function sql_db($hostname, $port, $username, $password, $database, $persistant)
{
$this->hostname = $hostname;
--- 29,36 ----
var $db_query_result = 0;
var $db_query_count = 0;
var $db_rowset = array();
! // Open database connection, select database
! function sql_connect($hostname, $port, $username, $password, $database, $persistant = NULL, $error_handling = NULL )
{
$this->hostname = $hostname;
***************
*** 51,55 ****
$this->persistant = $persistant;
! if( $this->persistant)
{
$this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
--- 41,45 ----
$this->persistant = $persistant;
! if( !is_null($this->persistant) )
{
$this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
***************
*** 61,67 ****
}
! if(! $this->db_connection_id)
{
! return false;
}
else
--- 51,64 ----
}
! if( !$this->db_connection_id )
{
! if( !is_null($error_handling) )
! {
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id));
! }
! else
! {
! return false;
! }
}
else
***************
*** 69,130 ****
if(! empty($this->database))
{
! $dbselect = @mysql_select_db($this->database);
! if(! $dbselect)
{
! @mysql_close($this->db_connection_id);
! $this->db_connection_id = $dbselect;
}
}
return $this->db_connection_id;
}
}
! //
! // DESTRUCTOR - sql_close
! // - based on sql_close from phpBB 2.0.6
! //
! function sql_close($db_connect_id = 0)
{
! if($db_connect_id == 0)
{
$db_connect_id = $this->db_connection_id;
}
! if($db_connect_id != FALSE)
! {
! if($this->db_query_result)
! {
! @mysql_free_result($this->db_query_result);
! }
! $result = @mysql_close($db_connect_id);
! return $result;
! }
! else
! {
! return false;
! }
! }
!
! //
! // OTHER BASE METHODS
! //
!
! //
! // sql_query
! //
! function sql_query($query = '', $return_off = TRUE)
{
! unset($this->db_query_result); // remove previous query result
! if(! empty($query))
{
$this->db_query_count++;
! $this->db_query_result = @mysql_query($query, $this->db_connection_id);
}
if( $this->db_query_result)
{
- unset($this->db_row[$this->db_query_result]);
unset($this->db_rowset[$this->db_query_result]);
return $this->db_query_result;
--- 66,115 ----
if(! empty($this->database))
{
! if( !is_null($error_handling) )
{
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id));
! }
! else
! {
! return false;
}
}
+
return $this->db_connection_id;
}
}
! function sql_close($db_connect_id = NULL)
{
! if( is_null($db_connect_id) )
{
$db_connect_id = $this->db_connection_id;
}
! if($db_connect_id != FALSE)
! {
! if($this->db_query_result)
! {
! @mysql_free_result($this->db_query_result);
! }
!
! return @mysql_close($db_connect_id);
! }
! }
!
! // Query database
! function sql_query($sql, $sql_explain = NULL, $line = NULL, $file = NULL )
{
! $this->sql_free_result($this->db_query_result); // remove previous query result
! if(! empty($sql))
{
$this->db_query_count++;
! $this->db_query_result = @mysql_query($sql, $this->db_connection_id);
}
if( $this->db_query_result)
{
unset($this->db_rowset[$this->db_query_result]);
return $this->db_query_result;
***************
*** 132,138 ****
else
{
! if($return_off == TRUE)
{
! die(mysql_error());
}
else
--- 117,123 ----
else
{
! if( !is_null($sql_explain) )
{
! // to db error handler (ERROR_FLAG, $this->sql_error($this->db_connection_id), $this->sql_errno($this->db_connection_id), $sql_explain, $line, $file);
}
else
***************
*** 143,419 ****
}
! //
! // sql_fetch_row
! //
! function sql_fetch_row($db_query_id = 0)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
!
! if( $this->db_row[$db_query_id] = @mysql_fetch_array($db_query_id))
! {
! return $this->db_row[$db_query_id];
! }
! else
! {
! return false;
! }
}
! //
! // sql_fetch_rowset
! //
! function sql_fetch_rowset($db_query_id = 0)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
- unset($this->db_row[$this->db_query_result]);
unset($this->db_rowset[$this->db_query_result]);
! while($this->db_rowset[$this->db_query_result] = @mysql_fetch_array($db_query_id))
{
! $rowset[] = $this->db_rowset[$db_query_id];
}
! return $rowset;
}
! //
! // sql_num_rows
! //
! function sql_num_rows($db_query_id = 0)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
! if( $this->db_row[$db_query_id] = @mysql_num_rows($db_query_id))
! {
! return $this->db_row[$db_query_id];
! }
! else
! {
! return false;
! }
}
! //
! // sql_insert_id
! //
! function sql_insert_id()
{
! if( $this->db_connection_id)
! {
! if( $result = @mysql_insert_id($this->db_connection_id))
! {
! return $result;
! }
! else
! {
! return false;
! }
! }
! else
{
! return false;
}
}
! //
! // sql_free_result
! //
! function sql_free_result($db_query_id = 0)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
- unset($this->db_row[$db_query_id]);
unset($this->db_rowset[$db_query_id]);
! if( @mysql_free_result($db_query_id))
! {
! return true;
! }
! else
! {
! return false;
! }
}
! //
! // sql_num_fields
! //
! function sql_num_fields($db_query_id = 0)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
! if( $result = @mysql_num_fields($db_connect_id))
! {
! return $return;
! }
! else
! {
! return false;
! }
}
! //
! // sql_field_name
! //
! function sql_field_name($db_query_id = 0, $field_offset)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
! if( $result = @mysql_fielf_name($db_query_id, $field_offset))
! {
! return $result;
! }
! else
! {
! return false;
! }
}
! //
! // sql_field_type
! //
! function sql_field_type($db_query_id = 0, $field_offset)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
! if( $result = @mysql_field_type($db_query_id, $field_offset))
! {
! return $result;
! }
! else
! {
! return false;
! }
}
! //
! // sql_fetch_field
! //
! function sql_fetch_field($db_query_id = 0, $field_row = -1, $field_name)
{
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
! if( $field_row > -1)
{
! $result = @mysql_fetch_field($db_query_id, $field_row, $field_name);
}
else
{
! if( empty($this->db_row[$db_query_id]) && empty($this->db_rowset[$db_query_id]))
! {
! if( $this->sql_fetch_row($db_query_id))
! {
! $result = $this->db_row[$query_id][$field_name];
! }
! }
! else
! {
! if( $this->db_rowset[$db_query_id])
! {
! $result = $this->db_rowset[$db_query_id][$field_name];
! }
! else if( $this->db_row[$db_query_id])
! {
! $result = $this->db_row[$query_id][$field_name];
! }
! }
}
-
- return $result;
}
! //
! // sql_affected_rows
! //
function sql_affected_rows()
{
! if( $this->db_connection_id)
! {
! if( $result = @mysql_affected_rows($this->db_connection_id))
! {
! return $result;
! }
! else
! {
! return false;
! }
! }
! else
! {
! return false;
! }
! }
!
! //
! // sql_row_seek
! //
! function sql_row_seek($db_query_id = 0, $row)
! {
! if(! $db_query_id)
{
$db_query_id = $this->db_query_result;
}
! if( $result = @mysql_row_seek($db_query_id, $row))
! {
! return $result;
! }
! else
! {
! return false;
! }
}
! //
! // sql_error
! //
! function sql_error($db_query_id = 0)
{
! if(! $db_query_id)
{
! $db_query_id = $this->db_query_result;
}
! $result = @mysql_error($db_query_id);
! return $result;
}
! //
! // sql_errno
! //
! function sql_errno($db_query_id = 0)
{
! if(! $db_query_id)
{
! $db_query_id = $this->db_query_result;
}
! $result = @mysql_errno($db_query_id);
! return $result;
}
} // End of sql_db
--- 128,281 ----
}
! // Select a row as an Associative, Numeric or Both (array)
! function sql_fetch_row($db_query_id = NULL, $type = MYSQL_BOTH)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
!
! return @mysql_fetch_array($db_query_id, $type);
}
! // Select all rows in one big array
! function sql_fetch_rowset($db_query_id = NULL, $type = MYSQL_BOTH)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
unset($this->db_rowset[$this->db_query_result]);
! $this->db_rowset[$this->db_query_result] = Array();
!
! while($row = @mysql_fetch_array($db_query_id, $type))
{
! $this->db_rowset[$this->db_query_result][] = $row;
}
! return $this->db_rowset[$this->db_query_result];
}
! // Number of rows from the last select query. Shouldn't be used for
! // Firebird compatability (hopefully an ibase_num_rows function will
! // be soon)
! function sql_num_rows($db_query_id = NULL)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
! return @mysql_num_rows($db_query_id);
}
! // Get last ID generated from an INSERT query
! function sql_insert_id($db_query_id = NULL)
{
! if( is_null($db_query_id) )
{
! $db_query_id = $this->db_query_result;
}
+
+ return @mysql_insert_id($this->db_connection_id);
}
! // Free result resource
! function sql_free_result($db_query_id = NULL)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
unset($this->db_rowset[$db_query_id]);
! return @mysql_free_result($db_query_id);
}
! // Number of fields selected in last query
! function sql_num_fields($db_query_id = NULL)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
! return @mysql_num_fields($db_query_id);
}
! // Name of a specific field from a result
! function sql_field_name($db_query_id = NULL, $field_offset)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
! return @mysql_field_name($db_query_id, $field_offset);
}
! // Field type from a result
! function sql_field_type($db_query_id = NULL, $field_offset)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
! return @mysql_field_type($db_query_id, $field_offset);
}
! // Gets column information and returns it object forum
! function sql_fetch_field($db_query_id = NULL, $field_offset = NULL)
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
! if( is_null($field_offset) )
{
! return @mysql_fetch_field($db_query_id);
}
else
{
! return @mysql_fetch_field($db_query_id, $field_offset);
}
}
! // Amount of rows affected in last query
function sql_affected_rows()
{
! if( is_null($db_query_id) )
{
$db_query_id = $this->db_query_result;
}
! return @mysql_affected_rows($this->db_connection_id);
}
! // SQL Error message from connection
! function sql_error($db_connection_id = NULL)
{
! if( is_null($db_connection_id) )
{
! $db_connection_id = $this->db_connect_id;
}
! return @mysql_error($db_connection_id);
}
! // SQL Error number from connection
! function sql_errno($db_connection_id = NULL)
{
! if( is_null($db_connection_id) )
{
! $db_connection_id = $this->db_connect_id;
}
! return @mysql_errno($db_connection_id);
}
} // End of sql_db
|
|
From: Cameron C. <nor...@us...> - 2003-10-05 22:10:37
|
Update of /cvsroot/phpmp/phpMP/core/dba
In directory sc8-pr-cvs1:/tmp/cvs-serv5708
Modified Files:
mysql.php
Log Message:
added a warning of sorts...
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/mysql.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** mysql.php 25 Sep 2003 03:43:54 -0000 1.12
--- mysql.php 5 Oct 2003 22:10:32 -0000 1.13
***************
*** 26,29 ****
--- 26,34 ----
//
+ //
+ // To clear up misconception, there will be use of a error handler in the future
+ // when one is written ^_^
+ //
+
class sql_db
{
***************
*** 40,43 ****
--- 45,49 ----
{
$this->hostname = $hostname;
+ $this->port = $port;
$this->username = $username;
$this->password = $password;
***************
*** 45,49 ****
$this->persistant = $persistant;
! if( $this->persistant == TRUE)
{
$this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
--- 51,55 ----
$this->persistant = $persistant;
! if( $this->persistant)
{
$this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
|
|
From: Brian R. <hei...@us...> - 2003-09-28 06:28:59
|
Update of /cvsroot/phpmp/phpMP/docs In directory sc8-pr-cvs1:/tmp/cvs-serv23213/docs Modified Files: config.php.sample Log Message: Fixing Cam's fix. Index: config.php.sample =================================================================== RCS file: /cvsroot/phpmp/phpMP/docs/config.php.sample,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** config.php.sample 14 Sep 2003 22:11:04 -0000 1.3 --- config.php.sample 28 Sep 2003 04:06:17 -0000 1.4 *************** *** 12,15 **** --- 12,16 ---- 'type' => 'mysql', 'host' => 'localhost', + 'port' => '', 'name' => 'phpmp', 'prefix'=> 'phpmp_', |
|
From: Brian R. <hei...@us...> - 2003-09-28 06:02:31
|
Update of /cvsroot/phpmp/phpMP/core
In directory sc8-pr-cvs1:/tmp/cvs-serv23213/core
Modified Files:
main.php
Log Message:
Fixing Cam's fix.
Index: main.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/main.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** main.php 22 Sep 2003 10:05:10 -0000 1.13
--- main.php 28 Sep 2003 04:06:17 -0000 1.14
***************
*** 84,88 ****
include_once( C_PHPMP_ROOT . CORE_DIR . 'dba/' . $dbinfo['type'] . '.php' );
! $DB = new sql_db($dbinfo['host'], $dbinfo['user'], $dbinfo['passwd'], $dbinfo['name'], false);
define('DB_CONFIG_TABLE', $dbinfo['name'] . '.' . $dbinfo['prefix'] . 'config');
--- 84,88 ----
include_once( C_PHPMP_ROOT . CORE_DIR . 'dba/' . $dbinfo['type'] . '.php' );
! $DB = new sql_db($dbinfo['host'], $dbinfo['port'], $dbinfo['user'], $dbinfo['passwd'], $dbinfo['name'], false);
define('DB_CONFIG_TABLE', $dbinfo['name'] . '.' . $dbinfo['prefix'] . 'config');
|
|
From: Adam A. <ra...@us...> - 2003-09-27 04:09:19
|
Update of /cvsroot/phpmp/phpMP/core/dba
In directory sc8-pr-cvs1:/tmp/cvs-serv12737/core/dba
Modified Files:
postgresql.php
Log Message:
I remember being called an idiot and non developer but I think this might work slightly better than @mysql_errno() ... IMHO of course!
Index: postgresql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/postgresql.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** postgresql.php 25 Sep 2003 03:43:55 -0000 1.3
--- postgresql.php 27 Sep 2003 03:42:22 -0000 1.4
***************
*** 52,55 ****
--- 52,120 ----
}
}
+
+ // Attempt to get PostgreSQL Error code
+ // Blame me (R45) if this fails
+ function sql_errno($connection = NULL)
+ {
+ if( is_null($connection) )
+ {
+ $connection = $this->db_connection_id;
+ }
+
+ // With postgres, there is no unified error number system. We will need
+ // to get the number based on the message
+ // We'll get the last message here, feel free to adjust this Booster
+ // if you want it as an object variable created elsewhere
+ $last_error = @pg_errormessage($connection);
+
+ // So we don't have to set the error messages again
+ static $pgsql_errors;
+
+ // If we didn't do this before
+ if( empty($pgsql_errors) )
+ {
+ // This is an array of error messages that PostgreSQL has error numbers for
+ $pgsql_errors = Array(
+ '/Out of memory in line [0-9]+/' => -12,
+ '/Data not found line [0-9]+/' => -100,
+ '/Unsupported type .* on line ([0-9])+/' => -200,
+ '/Too many arguments line [0-9]+/' => -201,
+ '/Too few arguments line [0-9]+/' => -202,
+ '/Too many matches line [0-9]+/' => -203,
+ '/Not correctly formatted int type: .* line [0-9]+/' => -204,
+ '/Not correctly formatted unsigned type: .* line [0-9]+/' => -205,
+ '/Not correctly formatted floating-point type: .* line [0-9]+/' => -206,
+ '/Unable to convert .* to bool on line [0-9]+/' => -207,
+ '/Empty query line [0-9]+/' => -208,
+ '/NULL value without indicator in line [0-9]+/' => -209,
+ '/Variable is not an array in line [0-9]+/' => -210,
+ '/Data read from backend is not an array in line [0-9]+/' => -211,
+ '/No such connection .* in line [0-9]+/' => -220,
+ '/Not connected in line [0-9]+/' => -221,
+ '/Invalid statement name .* in line [0-9]+/' => -230,
+ '/Descriptor .* not found in line [0-9]+/' => -240,
+ '/Descriptor index out of range in line [0-9]+/' => -241,
+ '/Descriptor .* not found in line [0-9]+/' => -242,
+ '/Variable is not a numeric type in line [0-9]+/' => -243,
+ '/Variable is not a character type in line [0-9]+/' => -244,
+ '/Postgres error: .* line [0-9]+/' => -400,
+ '/Error in transaction processing line [0-9]+/' => -401,
+ '/Could not connect to database .* in line [0-9]+/' => -402,
+ );
+ }
+
+ // Lets juggle the error messages
+ foreach ($pgsql_errors as $error => $number)
+ {
+ if( preg_match($error, $last_error))
+ {
+ // return appropriate number for this error
+ return $number;
+ }
+ }
+
+ // No error number exists, so 0 will do
+ return 0;
+ }
}
?>
|
|
From: Cameron C. <nor...@us...> - 2003-09-25 03:43:59
|
Update of /cvsroot/phpmp/phpMP/core/dba
In directory sc8-pr-cvs1:/tmp/cvs-serv8234
Modified Files:
mysql.php postgresql.php
Log Message:
changes to mysql are some formatting things, and postgres is the begining of
the sql_db function... I have no idea if it works yet... (I'm recompiling
php as I write this...).
Index: mysql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/mysql.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** mysql.php 17 Sep 2003 03:02:42 -0000 1.11
--- mysql.php 25 Sep 2003 03:43:54 -0000 1.12
***************
*** 35,41 ****
//
! // CONSTRUCTOR - sql_connect
//
! function sql_db($hostname, $username, $password, $database, $persistant)
{
$this->hostname = $hostname;
--- 35,41 ----
//
! // CONSTRUCTOR - sql_connect
//
! function sql_db($hostname, $port, $username, $password, $database, $persistant)
{
$this->hostname = $hostname;
***************
*** 45,49 ****
$this->persistant = $persistant;
! if($this->persistant == TRUE)
{
$this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
--- 45,49 ----
$this->persistant = $persistant;
! if( $this->persistant == TRUE)
{
$this->db_connection_id = @mysql_pconnect($this->hostname, $this->username, $this->password);
Index: postgresql.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/dba/postgresql.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** postgresql.php 14 Sep 2003 21:03:31 -0000 1.2
--- postgresql.php 25 Sep 2003 03:43:55 -0000 1.3
***************
*** 22,25 ****
*
*/
!
! ?>
\ No newline at end of file
--- 22,55 ----
*
*/
!
! class sql_db
! {
! var $db_connection_id;
! var $db_query_result = 0;
! var $db_query_count = 0;
! var $db_row = array();
! var $db_rowset = array();
!
! //
! // CONSTRUCTOR - sql_connect
! //
! function sql_db($hostname, $port, $username, $password, $database, $persistant)
! {
! $this->hostname = $hostname;
! $this->port = $port;
! $this->username = $username;
! $this->password = $password;
! $this->database = $database;
! $this->persistant = $persistant;
!
! if( $this->persistant)
! {
! $this->db_connection_id = pg_pconnect("host=$this->hostname port=$this->port user=$this->username password=$this->password dbname=$this->database");
! }
! else
! {
! $this->db_connection_id = pg_connect("host=$this->hostname port=$this->port user=$this->username password=$this->password dbname=$this->database");
! }
! }
! }
! ?>
|
|
From: Brian R. <hei...@us...> - 2003-09-22 10:56:37
|
Update of /cvsroot/phpmp/phpMP/docs/sql
In directory sc8-pr-cvs1:/tmp/cvs-serv27261/docs/sql
Modified Files:
mysql_structure.sql
Log Message:
Settling on the IP system for now.
Index: mysql_structure.sql
===================================================================
RCS file: /cvsroot/phpmp/phpMP/docs/sql/mysql_structure.sql,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** mysql_structure.sql 15 Sep 2003 02:44:12 -0000 1.2
--- mysql_structure.sql 22 Sep 2003 10:56:34 -0000 1.3
***************
*** 98,102 ****
`session_exp_time` int(10) NOT NULL default '0',
`session_page` varchar(50) NOT NULL default '',
! `session_ip` varchar(8) NOT NULL default '',
PRIMARY KEY (`session_key`)
) TYPE=HEAP;
--- 98,102 ----
`session_exp_time` int(10) NOT NULL default '0',
`session_page` varchar(50) NOT NULL default '',
! `session_ip` varchar(40) NOT NULL default '',
PRIMARY KEY (`session_key`)
) TYPE=HEAP;
|
|
From: Brian R. <hei...@us...> - 2003-09-22 10:55:50
|
Update of /cvsroot/phpmp/phpMP/core
In directory sc8-pr-cvs1:/tmp/cvs-serv27154/core
Modified Files:
sessions.php
Log Message:
Settling on the IP system for now.
Index: sessions.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/sessions.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** sessions.php 22 Sep 2003 10:39:03 -0000 1.9
--- sessions.php 22 Sep 2003 10:55:46 -0000 1.10
***************
*** 263,278 ****
}
- /**
- * @return string
- * @param encoded_ip string
- * @desc Decodes a hexed IP.
- * Taken from phpBB2.
- */
- function _sess_decode_ip($encoded_ip)
- {
- $hexipbang = explode('.', chunk_split($encoded_ip, 2, '.'));
- return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
- }
-
function sess_clean($all = false)
{
--- 263,266 ----
|
|
From: Brian R. <hei...@us...> - 2003-09-22 10:39:06
|
Update of /cvsroot/phpmp/phpMP/core
In directory sc8-pr-cvs1:/tmp/cvs-serv24976/core
Modified Files:
sessions.php
Log Message:
Moving IP stuff around.
Index: sessions.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/sessions.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** sessions.php 22 Sep 2003 10:38:01 -0000 1.8
--- sessions.php 22 Sep 2003 10:39:03 -0000 1.9
***************
*** 166,170 ****
$sql = "INSERT INTO " . DB_SESSIONS_TABLE . "
(session_key, session_user_id, session_start_time, session_exp_time, session_ip)
! VALUES('" . $this->_sess_key . "', " . $user_id . ", " . $time . ", " . $exp_time . ", '" . $this->ip . "')";
$result = $DB->sql_query($sql);
--- 166,170 ----
$sql = "INSERT INTO " . DB_SESSIONS_TABLE . "
(session_key, session_user_id, session_start_time, session_exp_time, session_ip)
! VALUES('" . $this->_sess_key . "', " . $user_id . ", " . $time . ", " . $exp_time . ", '" . $ip . "')";
$result = $DB->sql_query($sql);
***************
*** 174,178 ****
$this->_data['session_start_time'] = $time;
$this->_data['session_exp_time'] = $exp_time;
! $this->_data['session_ip'] = $this->ip;
}
else
--- 174,178 ----
$this->_data['session_start_time'] = $time;
$this->_data['session_exp_time'] = $exp_time;
! $this->_data['session_ip'] = $ip;
}
else
|
|
From: Brian R. <hei...@us...> - 2003-09-22 10:38:05
|
Update of /cvsroot/phpmp/phpMP/core
In directory sc8-pr-cvs1:/tmp/cvs-serv24754/core
Modified Files:
sessions.php
Log Message:
Moving IP stuff around.
Index: sessions.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/sessions.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** sessions.php 22 Sep 2003 10:28:35 -0000 1.7
--- sessions.php 22 Sep 2003 10:38:01 -0000 1.8
***************
*** 30,34 ****
var $_session_exists = false;
var $_sess_key = false;
- var $ip = false;
function sess_start($create=true)
--- 30,33 ----
***************
*** 64,71 ****
$time = time();
$exp_time = $time + $Portal->cfg_get('session_length');
- $this->_sess_ip_encoded();
$session_exists = false;
$user_id = false;
if(!$this->_logged_in)
{
--- 63,88 ----
$time = time();
$exp_time = $time + $Portal->cfg_get('session_length');
$session_exists = false;
$user_id = false;
+
+ // IP fetching taken from phpBB2.2.
+ $ip = (!empty($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : getenv('REMOTE_ADDR');
+
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
+ {
+ $private_ip = array('#^0\.#', '#^127\.0\.0\.1#', '#^192\.168\.#', '#^172\.16\.#', '#^10\.#', '#^224\.#', '#^240\.#');
+ foreach (explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']) as $x_ip)
+ {
+ if (preg_match('#([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)#', $x_ip, $ip_list))
+ {
+ if (($ip = trim(preg_replace($private_ip, $ip, $ip_list[1]))) == trim($ip_list[1]))
+ {
+ break;
+ }
+ }
+ }
+ }
+
if(!$this->_logged_in)
{
***************
*** 244,266 ****
}
- }
-
- /**
- * @return void
- * @desc Fetches the user's IP in hex-encoded form.
- * Taken from phpBB2.
- */
- function _sess_ip_encoded()
- {
- $this->ip = $_SERVER['REMOTE_ADDR'];
-
- if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
- {
- if (preg_match('#^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)#', $_SERVER['HTTP_X_FORWARDED_FOR'], $ip_list))
- {
- $private_ip = array('#^0\.#', '#^127\.0\.0\.1#', '#^192\.168\.#', '#^172\.16\.#', '#^10\.#', '#^224\.#', '#^240\.#');
- $this->ip = preg_replace($private_ip, $this->ip, $ip_list[1]);
- }
- }
}
--- 261,264 ----
|
|
From: Brian R. <hei...@us...> - 2003-09-22 10:28:38
|
Update of /cvsroot/phpmp/phpMP/core
In directory sc8-pr-cvs1:/tmp/cvs-serv23339/core
Modified Files:
sessions.php
Log Message:
Index: sessions.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/sessions.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** sessions.php 22 Sep 2003 10:26:20 -0000 1.6
--- sessions.php 22 Sep 2003 10:28:35 -0000 1.7
***************
*** 64,68 ****
$time = time();
$exp_time = $time + $Portal->cfg_get('session_length');
! $ip = $this->_sess_ip_encoded();
$session_exists = false;
$user_id = false;
--- 64,68 ----
$time = time();
$exp_time = $time + $Portal->cfg_get('session_length');
! $this->_sess_ip_encoded();
$session_exists = false;
$user_id = false;
***************
*** 157,161 ****
$this->_data['session_start_time'] = $time;
$this->_data['session_exp_time'] = $exp_time;
! $this->_data['session_ip'] = $ip;
}
else
--- 157,161 ----
$this->_data['session_start_time'] = $time;
$this->_data['session_exp_time'] = $exp_time;
! $this->_data['session_ip'] = $this->ip;
}
else
|