phplib-users Mailing List for PHPLIB (Page 83)
Brought to you by:
nhruby,
richardarcher
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(106) |
Sep
(99) |
Oct
(44) |
Nov
(97) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(56) |
Feb
(81) |
Mar
(134) |
Apr
(69) |
May
(106) |
Jun
(122) |
Jul
(98) |
Aug
(52) |
Sep
(184) |
Oct
(219) |
Nov
(102) |
Dec
(106) |
2003 |
Jan
(88) |
Feb
(37) |
Mar
(46) |
Apr
(51) |
May
(30) |
Jun
(17) |
Jul
(45) |
Aug
(19) |
Sep
(5) |
Oct
(4) |
Nov
(12) |
Dec
(7) |
2004 |
Jan
(11) |
Feb
(7) |
Mar
|
Apr
(15) |
May
(17) |
Jun
(13) |
Jul
(5) |
Aug
|
Sep
(8) |
Oct
(6) |
Nov
(21) |
Dec
(13) |
2005 |
Jan
(4) |
Feb
(3) |
Mar
(7) |
Apr
(7) |
May
|
Jun
(11) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
2006 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
(5) |
2007 |
Jan
(15) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
(3) |
Jul
(1) |
Aug
(19) |
Sep
(2) |
Oct
|
Nov
|
Dec
(6) |
2009 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
From: Sascha R. <Rag...@pe...> - 2001-11-08 18:45:12
|
Cause I need all mailings from yesterday... Thanks! |
From: <jv...@co...> - 2001-11-08 18:28:00
|
Hi, I=B4ve got a page self-identificated as (=93nobody=94). <? page_open(array( =93'sess'=94=3D> =93'Rev_sess'=94, =93'auth'=94=3D>=93'= Rev_Default_auth'=94)); if ($login) $auth->login_if(=93'yes'=94); if ($auth->auth[=93uid=94] !=3D =93'nobody'=94) { ........... code php private } else { ............ code php public } page_close(); ?> =20 This code works with all the clients that have access to the page, excep= t=20 a few ones (The Internet Explorer users). These ones are unable to see the form that ask the username and pasword.= =20 (loginform.ihtml). Other navigators programs don=B4t have this kind of troubles. I would thank any suggestion that you can give me, Victor |
From: Bob B. <bo...@iN...> - 2001-11-08 18:02:31
|
Hi -- OK, here goes ... ================================================== "sys_procedures" is a table which contains the actual SQL queries ... CREATE TABLE sys_procedures ( id int(11) NOT NULL auto_increment, name varchar(20) NOT NULL default '', description varchar(40) default NULL, sql text, dt_create datetime NOT NULL default '0000-00-00 00:00:00', dt_modify timestamp(14) NOT NULL, argc int(2) unsigned NOT NULL default '0', PRIMARY KEY (id), KEY name (name,dt_create,dt_modify) ) TYPE=MyISAM; ================================================== Within your DB class, add the following: /* Store procedure enhancement: configurable*/ var $procedure_table = "sys_procedures"; var $proc_name; var $sql = array(); var $argc; var $finalQuery; function proc($name) { if ( !is_array($this->sql) ) { $this->sql[$name] = ""; $this->argc[$name] = 0; } if ( strlen($name) > 0) { ##This should be the only line of embedded Sql in the application $qry = "SELECT sql, argc FROM ".$this->procedure_table." WHERE name = '".$name."' "; if (strlen($this->sql[$name]) == 0 && $this->query($qry)){ $this->next_record(); $this->sql[$name] = $this->f("sql"); $this->argc[$name] = $this->f("argc"); } $this->proc_name = $name; return true; } return false; } function execproc($argv="") { $this->finalQuery = $this->sql[$this->proc_name]; if (is_array($argv)) { reset($argv); $c = count($argv); for ($i=0 ; $i<$c ; $i++) { $value = $argv[key($argv)]; $this->finalQuery = ereg_replace("{".strtoupper(key($argv))."}", $value, $this->finalQuery); next($argv); } } $qry = $this->finalQuery; if (( count($argv) >= $this->argc[$this->proc_name] ) || ($this->argc[$this->proc_name] == 0) ) { return $this->query($qry); } else { return false; } } ================================================== Let's say you have an SQL query that searches 400,000 records for "Madonna" and "DVD" ... the data is normalized across a half-dozen tables, and the query uses JOIN and every MySQL trick I know to speed things up. I'm also going to want to search (elsewhere) for "CD", and "Collector", and "VHS". I used to debug the query in DVDs, then cut-and-paste it into the CD script, change the variables, and debug it all over again ... ditto for Collector, VHS, and so on. Or, in the CD PHP code, you can do the following: $word = "Madonna"; $fmt = "CD"; $query = $db->proc("get_2_specials"); $argv = array(FORMAT=>"$fmt",TYPE=>"$word"); $db->execproc($argv); Or, in the DVD "department", the following: $word = "Madonna"; $fmt = "DVD"; $query = $db->proc("get_2_specials"); $argv = array(FORMAT=>"$fmt",TYPE=>"$word"); $db->execproc($argv); For clarity, I've deleted a dozen other members of the array which get passed to the class function ... but I'm sure you get the idea. The "finalQuery" variable, by the way, is *very* useful for debugging! ================================================== In practice ... 1. I write the query and test it using hard values and "explain" in PhpMyAdmin ... 2. when the tables are optimized and the query is working the way I want, I copy the query into my PHP script and substitute variables for the hard values ... 3. when that's working the way I want, I re-write the query substituting placeholders for the variables and store that in the sys_procedures table ... 4. finally, I substitute the 3 lines (or so) of PHP code for the query itself in my script, and I'm done. The tables are now optimized for the query, and the debugged query is available to all other scripts (I can cut-and-paste just the 3 lines of code) ... and I may get out of here on time tonight! ================================================== Please let me know if I've left anything out ... and give a shout if I can help ... Bob. |
From: Sascha R. <Rag...@pe...> - 2001-11-08 17:45:09
|
Yesterday I posted to this mailing list, and some people had really good replies on my question. Somehow I deleted all my mails, and all messages were lost. Could you guys please reply again to my question: Is it possible to track, when a user has lost its session and therefore showing a error message like "your session has expired...". Is that possible with PHPlib? Does anyone have experience with such thing? Thanks in advance... Sascha Ragtschaa |
From: Bob B. <bo...@iN...> - 2001-11-08 17:02:54
|
Brian -- "sys_procedures" is a table which contains the actual SQL queries ... CREATE TABLE sys_procedures ( id int(11) NOT NULL auto_increment, name varchar(20) NOT NULL default '', description varchar(40) default NULL, sql text, dt_create datetime NOT NULL default '0000-00-00 00:00:00', dt_modify timestamp(14) NOT NULL, argc int(2) unsigned NOT NULL default '0', PRIMARY KEY (id), KEY name (name,dt_create,dt_modify) ) TYPE=MyISAM; We have functions in the DB class we include in phpLib which read the SQL from this table, substitute an array of variables for the "argc" placeholders within the SQL (e.g. "{FORMAT}" and "{TYPE}") and then execute the resulting query. Now the PHP contains only the following 3 lines, not 37 lines of complex SQL: $query = $db->proc("get_2_specials"); $argv = array(FORMAT=>"$word",TYPE=>"special"); $db->execproc($argv); I'd be glad to share details and code if you're interested ... IMHO, this methodology is a whole lot more useful tool, to me, than even TEMPLATES ... I don't mind mixing PHP and HTML (that's sorta the way my mind works anyway), but once a complex query is debugged, I want it out of there - plus, the query is available this way to multiple scripts without "cut-and-paste-and-debug" all over again every time it's re-used ... Once I optimize a query which searches 400,000 records normalized across a half-dozen or more tables, I want to use it for CDs, DVDs and VHSs, not copy the query, edit it for the new department, and debug it again and again and again ... My SQL and PHP abilities are "practical" vs "theoretical", so the concept of sys_procedures was a real eye-opener for me about 3 years ago ... with deepest thanks to Cheng-Wei Cheng for teaching me this and many other things. Bob. At 10:16 AM 11/8/2001 -0600, you wrote: >I'm fairly fluent with SQL joins, but I've never heard of a sys_procedures >table. Could you explain how that works? How does that remove the joins from >your PHP code? > >-----Original Message----- >From: Bob Bowker [mailto:bo...@iN...] >Sent: Thursday, November 08, 2001 10:04 AM >To: Php...@li... >Subject: Re: [Phplib-users] OT: Database Design Help > > >Hi -- > >Jesse (and others) focused my attention and helped solve the original issue >- how to organize the basic data - but I have also addressed this new >problem of attributes ... > >I've got 2500 products, 11 categories, 88 sub-categories, and 24 attributes >... each product can belong to several sub-categories, and attributes can >change daily. I have tried to normalize the data as follows: > >attributes id,attribName,icon,ref_AttribsFieldName >categories id,catName >subcats id,subName,ref_catId >prods prodnum,name,keywords >prods_details prodnum,price,colors, ... description >prods_attribs prodnum,attr1,attr2, ... attr24 >prods_assign prodnum,ref_subcatIdCsv > >MySQL queries are straightforward and fast ... I'm not happy with the CSV >list of sub-categories to which a product belongs in the prods_assign table >- but for now, using MySQL's "like '%xxxx%'" and a few extra lines of PHP >seems simpler than 88 more fields ... > >The one time-saver I stumbled on quite innocently (no deep thought and >planning here!) is the ref_AttribsFieldName field in table attributes - it >contains the name of the corresponding field in prods_attribs, which makes >both the query and the input form variable naming quite simple ... > >BTW, all queries get moved into a sys_procedures table as soon as debugging >is complete, so all those messy JOINs are removed from the PHP as soon as >we know they're working correctly ... > >The design requirements are driven by the fact that we are creating a >Control Panel page for the client to manage his own database ... >add/edit/delete products and add/edit categories, sub-categories, >attributes, etc. etc. Leaves us to write code, not do data entry at 15% of >our programming rate! > >Bob. > >At 05:56 AM 11/8/2001 -0500, you wrote: > >Yes, this is a dilemma. I am sure there are lots of ways to solve this > >problem and a lot depends on the way the data is being used. The way you > >suggest is probably the best for speed. But, I can make a mess of a table > >by having lots of extra columns. > > > >Another way would be to create a table of attributes. The columns would be > >something like > > > >Product_attributes > > product_id > > attr_type > > attr_value > > > >It makes queries a little harder because you have to join in this table and > >you may want to add other columns to better describe the attribute. But > >this is how I would do it. > >-- > >Jesse > > > > > > > From: Philip Strnad <ph...@st...> > > > Date: Wed, 07 Nov 2001 22:28:54 -0800 > > > To: Jesse Swensen <ph...@sw...> > > > Cc: Bob Bowker <bo...@iN...>, > > "php...@li..." > > > <Php...@li...> > > > Subject: Re: [Phplib-users] OT: Database Design Help > > > > > > How would you go about storing attributes for the products? Let's say >you > > > have > > > three product types: > > > > > > - books > > > - CDs > > > - electronics > > > > > > Each of these categories could have many attributes, and to make matters > > > worse, > > > each one can have different attributes. For example, a book would have >an > > > ISBN > > > number, which a CD wouldn't have. The electronics might have a color > > > attribute, > > > which CDs and books wouldn't have (at least there would be no point in > > storing > > > this attribute). > > > > > > I've run into this situation a few times and have never found an ideal > > > solution. The only solution I see is to have lots of attribute columns > > in the > > > products table and for every product a bunch of these would have null > > values > > > since certain attributes wouldn't be applicable. > > > > > > > >_______________________________________________ > >Phplib-users mailing list > >Php...@li... > >https://lists.sourceforge.net/lists/listinfo/phplib-users > > >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Brian P. <bp...@ct...> - 2001-11-08 16:15:34
|
I'm fairly fluent with SQL joins, but I've never heard of a sys_procedures table. Could you explain how that works? How does that remove the joins from your PHP code? -----Original Message----- From: Bob Bowker [mailto:bo...@iN...] Sent: Thursday, November 08, 2001 10:04 AM To: Php...@li... Subject: Re: [Phplib-users] OT: Database Design Help Hi -- Jesse (and others) focused my attention and helped solve the original issue - how to organize the basic data - but I have also addressed this new problem of attributes ... I've got 2500 products, 11 categories, 88 sub-categories, and 24 attributes ... each product can belong to several sub-categories, and attributes can change daily. I have tried to normalize the data as follows: attributes id,attribName,icon,ref_AttribsFieldName categories id,catName subcats id,subName,ref_catId prods prodnum,name,keywords prods_details prodnum,price,colors, ... description prods_attribs prodnum,attr1,attr2, ... attr24 prods_assign prodnum,ref_subcatIdCsv MySQL queries are straightforward and fast ... I'm not happy with the CSV list of sub-categories to which a product belongs in the prods_assign table - but for now, using MySQL's "like '%xxxx%'" and a few extra lines of PHP seems simpler than 88 more fields ... The one time-saver I stumbled on quite innocently (no deep thought and planning here!) is the ref_AttribsFieldName field in table attributes - it contains the name of the corresponding field in prods_attribs, which makes both the query and the input form variable naming quite simple ... BTW, all queries get moved into a sys_procedures table as soon as debugging is complete, so all those messy JOINs are removed from the PHP as soon as we know they're working correctly ... The design requirements are driven by the fact that we are creating a Control Panel page for the client to manage his own database ... add/edit/delete products and add/edit categories, sub-categories, attributes, etc. etc. Leaves us to write code, not do data entry at 15% of our programming rate! Bob. At 05:56 AM 11/8/2001 -0500, you wrote: >Yes, this is a dilemma. I am sure there are lots of ways to solve this >problem and a lot depends on the way the data is being used. The way you >suggest is probably the best for speed. But, I can make a mess of a table >by having lots of extra columns. > >Another way would be to create a table of attributes. The columns would be >something like > >Product_attributes > product_id > attr_type > attr_value > >It makes queries a little harder because you have to join in this table and >you may want to add other columns to better describe the attribute. But >this is how I would do it. >-- >Jesse > > > > From: Philip Strnad <ph...@st...> > > Date: Wed, 07 Nov 2001 22:28:54 -0800 > > To: Jesse Swensen <ph...@sw...> > > Cc: Bob Bowker <bo...@iN...>, > "php...@li..." > > <Php...@li...> > > Subject: Re: [Phplib-users] OT: Database Design Help > > > > How would you go about storing attributes for the products? Let's say you > > have > > three product types: > > > > - books > > - CDs > > - electronics > > > > Each of these categories could have many attributes, and to make matters > > worse, > > each one can have different attributes. For example, a book would have an > > ISBN > > number, which a CD wouldn't have. The electronics might have a color > > attribute, > > which CDs and books wouldn't have (at least there would be no point in > storing > > this attribute). > > > > I've run into this situation a few times and have never found an ideal > > solution. The only solution I see is to have lots of attribute columns > in the > > products table and for every product a bunch of these would have null > values > > since certain attributes wouldn't be applicable. > > > >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users _______________________________________________ Phplib-users mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Bob B. <bo...@iN...> - 2001-11-08 16:04:17
|
Hi -- Jesse (and others) focused my attention and helped solve the original issue - how to organize the basic data - but I have also addressed this new problem of attributes ... I've got 2500 products, 11 categories, 88 sub-categories, and 24 attributes ... each product can belong to several sub-categories, and attributes can change daily. I have tried to normalize the data as follows: attributes id,attribName,icon,ref_AttribsFieldName categories id,catName subcats id,subName,ref_catId prods prodnum,name,keywords prods_details prodnum,price,colors, ... description prods_attribs prodnum,attr1,attr2, ... attr24 prods_assign prodnum,ref_subcatIdCsv MySQL queries are straightforward and fast ... I'm not happy with the CSV list of sub-categories to which a product belongs in the prods_assign table - but for now, using MySQL's "like '%xxxx%'" and a few extra lines of PHP seems simpler than 88 more fields ... The one time-saver I stumbled on quite innocently (no deep thought and planning here!) is the ref_AttribsFieldName field in table attributes - it contains the name of the corresponding field in prods_attribs, which makes both the query and the input form variable naming quite simple ... BTW, all queries get moved into a sys_procedures table as soon as debugging is complete, so all those messy JOINs are removed from the PHP as soon as we know they're working correctly ... The design requirements are driven by the fact that we are creating a Control Panel page for the client to manage his own database ... add/edit/delete products and add/edit categories, sub-categories, attributes, etc. etc. Leaves us to write code, not do data entry at 15% of our programming rate! Bob. At 05:56 AM 11/8/2001 -0500, you wrote: >Yes, this is a dilemma. I am sure there are lots of ways to solve this >problem and a lot depends on the way the data is being used. The way you >suggest is probably the best for speed. But, I can make a mess of a table >by having lots of extra columns. > >Another way would be to create a table of attributes. The columns would be >something like > >Product_attributes > product_id > attr_type > attr_value > >It makes queries a little harder because you have to join in this table and >you may want to add other columns to better describe the attribute. But >this is how I would do it. >-- >Jesse > > > > From: Philip Strnad <ph...@st...> > > Date: Wed, 07 Nov 2001 22:28:54 -0800 > > To: Jesse Swensen <ph...@sw...> > > Cc: Bob Bowker <bo...@iN...>, > "php...@li..." > > <Php...@li...> > > Subject: Re: [Phplib-users] OT: Database Design Help > > > > How would you go about storing attributes for the products? Let's say you > > have > > three product types: > > > > - books > > - CDs > > - electronics > > > > Each of these categories could have many attributes, and to make matters > > worse, > > each one can have different attributes. For example, a book would have an > > ISBN > > number, which a CD wouldn't have. The electronics might have a color > > attribute, > > which CDs and books wouldn't have (at least there would be no point in > storing > > this attribute). > > > > I've run into this situation a few times and have never found an ideal > > solution. The only solution I see is to have lots of attribute columns > in the > > products table and for every product a bunch of these would have null > values > > since certain attributes wouldn't be applicable. > > > >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Jesse S. <ph...@sw...> - 2001-11-08 10:57:11
|
Yes, this is a dilemma. I am sure there are lots of ways to solve this problem and a lot depends on the way the data is being used. The way you suggest is probably the best for speed. But, I can make a mess of a table by having lots of extra columns. Another way would be to create a table of attributes. The columns would be something like Product_attributes product_id attr_type attr_value It makes queries a little harder because you have to join in this table and you may want to add other columns to better describe the attribute. But this is how I would do it. -- Jesse > From: Philip Strnad <ph...@st...> > Date: Wed, 07 Nov 2001 22:28:54 -0800 > To: Jesse Swensen <ph...@sw...> > Cc: Bob Bowker <bo...@iN...>, "php...@li..." > <Php...@li...> > Subject: Re: [Phplib-users] OT: Database Design Help > > How would you go about storing attributes for the products? Let's say you > have > three product types: > > - books > - CDs > - electronics > > Each of these categories could have many attributes, and to make matters > worse, > each one can have different attributes. For example, a book would have an > ISBN > number, which a CD wouldn't have. The electronics might have a color > attribute, > which CDs and books wouldn't have (at least there would be no point in storing > this attribute). > > I've run into this situation a few times and have never found an ideal > solution. The only solution I see is to have lots of attribute columns in the > products table and for every product a bunch of these would have null values > since certain attributes wouldn't be applicable. |
From: Philip S. <ph...@st...> - 2001-11-08 06:30:22
|
Jesse, How would you go about storing attributes for the products? Let's say you have three product types: - books - CDs - electronics Each of these categories could have many attributes, and to make matters worse, each one can have different attributes. For example, a book would have an ISBN number, which a CD wouldn't have. The electronics might have a color attribute, which CDs and books wouldn't have (at least there would be no point in storing this attribute). I've run into this situation a few times and have never found an ideal solution. The only solution I see is to have lots of attribute columns in the products table and for every product a bunch of these would have null values since certain attributes wouldn't be applicable. Anyway, I would just like to hear how others have solved this problem in the past since it must be a pretty common one. Thanks Philip Jesse Swensen wrote: > You will need 3 tables > > Products > product_id > product_name > > sub_category > sub_cat_id > sub_cat_name > cat_id > > Category > cat_id > cat_name > > So far this is pretty straight forward. But you need one more table to make > the many to many join. > > Product_sub_category > product_id > sub_cat_id > > Now if you want to find all the products of sub category you would do > something like: > > SELECT > p.* > FROM > product_sub_category psc, > sub_category sc > product p > WHERE > sc.sub_cat_name = 'PURPLE' > AND sc.sub_cat_id = psc.sub_cat_id > AND psc.product_id = p.product_id > > Or maybe you want all the products of a given category, then: > > SELECT > p.* > FROM > category c, > product_sub_category psc, > sub_category sc > product p > WHERE > cat_name = 'RED' > AND sc.cat_id = c.cat_id > AND sc.sub_cat_id = psc.sub_cat_id > AND psc.product_id = p.product_id > > Now you want all the sub categories a given product is in: > > SELECT > sc.sub_cat_name > FROM > product p, > product_sub_category psc, > sub_category sc > WHERE > p.product_name = 'KEYBOARD' > AND p.product_id = psc.product_id > AND psc.sub_cat_id = sc.sub_cat_id > > And so forth.... > > -- > Jesse > > From: Bob Bowker <bo...@iN...> > > Date: Wed, 07 Nov 2001 06:03:43 -0800 > > To: <Php...@li...> > > Subject: [Phplib-users] OT: Database Design Help > > > > Hi -- > > > > My apologies for an OT subject, but I figured this group of people was the > > most logical place to seek help ... > > > > I'm setting up a database with the following parameters: > > 2500 products > > 11 main categories > > 88 subcategories > > Each subcategory belongs to a single category, and each product belongs to > > several subcategories ... > > > > ... and I can't wrap my head around the best layout. Searching by name, > > product number, keywords, etc., is trivial, but I will need to search for > > and group products on the following terms: > > by category > > by subcategory > > > > How do I normalize this data ...? > > > > Thanks -- > > > > Bob. > > > > > > _______________________________________________ > > Phplib-users mailing list > > Php...@li... > > https://lists.sourceforge.net/lists/listinfo/phplib-users > > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Marco <ma...@dk...> - 2001-11-07 21:13:29
|
Hello, I've installed PHPLIB on my Windows98 PC. The test pages are running well but there are a few mistakes on the page I cannot solve. While executing auth.inc it occurs the following error: *Warning*: Undefined property: in in *c:\programme\Apache Group\Apache\phplib\php\auth.inc* on line *52* In the session script I get the following: *Warning*: Undefined variable: again in *c:\programme\apache group\apache\htdocs\pages\defauth.php3* on line *20* Table class test active_sessions metadata *Warning*: Undefined property: fields in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *836* *Warning*: Undefined variable: row in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *299* *Warning*: Undefined property: check in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *511* *Warning*: Undefined variable: col in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *568* *Warning*: Undefined property: add_extra in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *304* *Warning*: Undefined property: check in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *536* *Warning*: Undefined property: add_extra in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *481* *Warning*: Undefined property: check in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *536* *Warning*: Undefined property: add_extra in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *481* *Warning*: Undefined property: check in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *536* *Warning*: Undefined property: add_extra in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *481* *Warning*: Undefined property: check in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *536* *Warning*: Undefined property: add_extra in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *481* *Warning*: Undefined property: map_cols in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *657* table *Warning*: Undefined property: map_cols in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *657* name *Warning*: Undefined property: map_cols in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *657* type *Warning*: Undefined property: map_cols in *c:\programme\Apache Group\Apache\phplib\php\table.inc* on line *657* I don't know why. I am using the most actual version of PHPLIB. Could somebody tell me if this could be an installation problem - I don't think because I used a step-by-step installation-documentation? :-) Bye Marco |
From: Manuel A. <mpa...@so...> - 2001-11-07 20:09:18
|
At 06:03 07/11/01 -0800, you wrote: >I'm setting up a database with the following parameters: > 2500 products > 11 main categories > 88 subcategories >Each subcategory belongs to a single category, and each product belongs to= =20 >several subcategories ... I'd try this: product: product_id + category_id + product_whatever_1 + ... +=20 product_whatever_n category: category_id + category_whatever_1 + ... + category_whatever_n subcategory: subcategory_id + category_id + ... product_subcategory_assoc: product_id + subcategory_id to search by attributes of a product: search in product table to search by category: same as above to search by subcategory: search in product_subcategory_assoc being the number of categories and subcategories rather small, perhaps you= =20 could hardcode the table somewhere in your code, but i don't know if they=20 need to be updated. in addition, you can implement the product_subcategory_assoc association as= =20 a "belongs_to" column in the product table of type SET. But i wouldn't do=20 that if the number of subcats a product belongs to is big. Manuel Aristar=E1n Bah=EDa Blanca, Argentina mpa...@so... |
From: Jesse S. <ph...@sw...> - 2001-11-07 14:29:06
|
You will need 3 tables Products product_id product_name sub_category sub_cat_id sub_cat_name cat_id Category cat_id cat_name So far this is pretty straight forward. But you need one more table to make the many to many join. Product_sub_category product_id sub_cat_id Now if you want to find all the products of sub category you would do something like: SELECT p.* FROM product_sub_category psc, sub_category sc product p WHERE sc.sub_cat_name = 'PURPLE' AND sc.sub_cat_id = psc.sub_cat_id AND psc.product_id = p.product_id Or maybe you want all the products of a given category, then: SELECT p.* FROM category c, product_sub_category psc, sub_category sc product p WHERE cat_name = 'RED' AND sc.cat_id = c.cat_id AND sc.sub_cat_id = psc.sub_cat_id AND psc.product_id = p.product_id Now you want all the sub categories a given product is in: SELECT sc.sub_cat_name FROM product p, product_sub_category psc, sub_category sc WHERE p.product_name = 'KEYBOARD' AND p.product_id = psc.product_id AND psc.sub_cat_id = sc.sub_cat_id And so forth.... -- Jesse > From: Bob Bowker <bo...@iN...> > Date: Wed, 07 Nov 2001 06:03:43 -0800 > To: <Php...@li...> > Subject: [Phplib-users] OT: Database Design Help > > Hi -- > > My apologies for an OT subject, but I figured this group of people was the > most logical place to seek help ... > > I'm setting up a database with the following parameters: > 2500 products > 11 main categories > 88 subcategories > Each subcategory belongs to a single category, and each product belongs to > several subcategories ... > > ... and I can't wrap my head around the best layout. Searching by name, > product number, keywords, etc., is trivial, but I will need to search for > and group products on the following terms: > by category > by subcategory > > How do I normalize this data ...? > > Thanks -- > > Bob. > > > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Bob B. <bo...@iN...> - 2001-11-07 14:03:46
|
Hi -- My apologies for an OT subject, but I figured this group of people was the most logical place to seek help ... I'm setting up a database with the following parameters: 2500 products 11 main categories 88 subcategories Each subcategory belongs to a single category, and each product belongs to several subcategories ... ... and I can't wrap my head around the best layout. Searching by name, product number, keywords, etc., is trivial, but I will need to search for and group products on the following terms: by category by subcategory How do I normalize this data ...? Thanks -- Bob. |
From: Oliver Duke-W. <ol...@ge...> - 2001-11-07 13:45:19
|
On Wed, Nov 07, 2001 at 12:14:37PM +0100, Sascha Ragtschaa wrote: > Is it possible to track, when a user has lost its session and therefore > showing a error message like "your session has expired...". Is that possible > with PHPlib? Does anyone have experience with such thing? I've done that in the following manner: i) The function unauth() in whichever auth class you use is overridden or modified like this: function unauth($nobody = false) { /* * Add flag indicating whether session has expired */ if ($this->lifetime > 0 && ((isset($this->auth["exp"]) && $this->auth["exp"]) && (time() > $this->auth["exp"]))) { $this->auth["expired"] = true; } else { $this->auth["expired"] = false; } $this->auth["uid"] = ""; $this->auth["perm"] = ""; $this->auth["exp"] = 0; ## Back compatibility: passing $nobody to this method is ## deprecated if ($nobody) { $this->auth["uid"] = "nobody"; $this->auth["perm"] = ""; $this->auth["exp"] = 0x7fffffff; } } Secondly, the function auth_loginform() can now use the flag set up above. The rest of the function will depend on what sort of auth class you use: function auth_loginform() { ... if (isset($this->auth["expired"]) && $this->auth['expired']) { /* * form to be used for sessions that have expired */ include($_PHPLIB["libdir"] . "crloginform_exp.html"); } else { /* * form to be used for new logins */ include($_PHPLIB["libdir"] . "crloginform.html"); } return; } Thus, both users starting a new session and users trying to load a page in a session that has expired will be forced to login, but you can use an alternative page for expired sessions that gives more appropriate instructions. Cheers, Oliver -- Oliver Duke-Williams <ol...@ge...> Tel 0113 233 3286 Centre for Computational Geography, University of Leeds, UK |
From: Donncha O C. <don...@tr...> - 2001-11-07 12:27:10
|
You have to approach it in a different manner. I implemented this and it works very nicely to keep multiple users out of the one account :) When someone logs in, set a cookie on their machine with a session ID(SID) and record this session ID in a table along with their UID. There's only one record in that table per user. Each time they visit the site you check that table so that the UID matches the SID, if not, they must be logged in twice! What this does is effectively logout the first user. The second user gets in and knocks the first off. When the first user logs in again the SID is updated and the second user then gets logged out. This should discourage people sharing their login info fairly quickly and gets over the problem of trying to figure out when people logout! Donncha. Sascha Ragtschaa wrote: > > Hello, > > I have a problem. I am using PHPlib and need a way of authentification, in > which a user logs into a system, and will be recognized that he is a logged > user. If another user tries to log in with the same Account (username, > password), he has to be rejected. Only one user with the same account should > be in the system at one time! How can I do such thing with PHPlib? Did > anyone already write a function of that? > |
From: Rogers, P. <Pau...@mo...> - 2001-11-07 11:56:51
|
Dear All THis is slightly off topic but i'm sure one of you will know the answer, so i thought i'd give it a whirl. I am designing a site which uses phplib's auth and sessions to validate a user. The database storing the data is the same as that used to store user details and validate against our EDMS (Electronic Document Management System). The problem arises when the user tries to access the EDMS web pages. The EDMS web server expects the user to validate again, which seems a bit pointless. I'd like to have just the initial PHPLIB login. The process for accessing the EDMS system (in this instance it's free text retrieval function) is as follows: The user clicks on the url/button which uses the following url http://edmwebserver:3559/EDM/dosetvault?vaultname=MCE_QA_Control&destination =http://edmwebserver:3559/EDM/ftr The edm web server then checks for a valid cookie and if its not there asks the user to login. This is done via a similiar url thus. http://edmwebserver:3559/EDM/dologin/?username=username&password=password I would like to have it so that only one login is required ie the initial login via PHPLIB. I thought of spoofing the cookie, but a) can't work out its format EDMSESSION UCWKTERL edmwebserver/ 0 3530499328 29406357 1469498128 29332932 * b) I'm not sure if the server checks the cookie to see if it is valid or actually compares it with a record it keeps? How does this work? I then thought of sending this login url to the server. I tried using sockets <?php //A test script to open a port on the edm server and login //Set up the variables $edmServer = "192.168.10.01"; $edmPort = 3559; $edmTimeOut = 10; // open a socket if(!edmTimeOut) { // without timeout $edm_handle = fsockopen($edmServer, $edmPort); } else { // with timeout $edm_handle = fsockopen($edmServer, $edmPort, &$errno, &$errstr, $edmTimeOut); } if(!$edm_handle) { echo "Connection Failed!!\n"; printf("Error: %s (%s)\n",$errstr, $errno); exit(); } else { echo "Connected\n"; $tmp = fgets($edm_handle, 1024); echo "$tmp"; } ?> This script does seem to open the socket (ie I don't get the connection failed message)to the server but takes about 5 miniutes to do so. I can only assume the edm webserver isn't happy with the sockets approach. :p( Any ideas? Finally is it possible to "transmit" the url http://edmwebserver:3559/EDM/dologin/?username=username&password=password from the server, on the users behalf (so they don't know it's happening) and have the cookie returned to them? Ideally I would like to use the cookie approach but any thoughts any one might have would be much appreciated. I hope the e mail wasn't too long winded :p) Paul ***************************************************************************** This email and any attachments transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender and do not store, copy or disclose the content to any other person. It is the responsibility of the recipient to ensure that opening this message and/or any of its attachments will not adversely affect its systems. No responsibility is accepted by the Company. ***************************************************************************** |
From: Sascha R. <Rag...@pe...> - 2001-11-07 11:14:45
|
Is it possible to track, when a user has lost its session and therefore showing a error message like "your session has expired...". Is that possible with PHPlib? Does anyone have experience with such thing? Thanks in advance... Sascha Ragtschaa |
From: Michael C. <mdc...@mi...> - 2001-11-07 00:22:47
|
On Tue, Nov 06, 2001 at 04:21:09PM -0500, darcy w. christ wrote: > hi, > > i have a strange problem. While testing, i occasionally need to > remove my session records from the db. Upon doing so, it immediately > tries to get me to login back in (obviously since i am no longer > authenticated). The strange thing is that i do have my sessions > variables anymore. i've just looked around and discovered that it's not > setting a new cookie. Instead, it must be using the cookie, i already > have. Is it possible for me to turn that off (ie. create a new cookie) > or better yet just make sure that the auto_init gets run again. Actually, it's a non-issue for the most part. If you have removed the records from active_sessions, then all your session variables are lost. Your browser still has the cookie, which means that it still will use the same session id, but ultimately that session id is nothing more than a lookup key for the active_sessions table. If the key isn't there, it creates a new session. Same cookie, new session, no problem. However, see below for an easier solution. > i know it sounds like a very unlikely scenerio, but i've come to > understand that computers love unlikely scenerios. In fact, i think > they are immediately considered likely scenerios because they are > unlikely. ;-) This will create a new session without you having to dork around in the database. newsession.php: <?php if (!isset($dest)) { $dest='/'; } if (isset($newsession)) { page_open(array("sess"=>"My_Session")); if (isset($auth) && $auth->is_authenticated()) { $auth->unauth(); } $sess->delete(); } header("Status: 302 Moved Temporarily"); header("Location: $dest"); ?> You can then put a link at the bottom of each page on your test site that looks like this: <a href="/newsession.php?newsession=1">New Session</a> I use something similar at patsgold.com for making a new session. If you're logged in, it shows your email address at the top, along with a simple "click here if that's not you". It just destroys the current session and gives the user a new one. Useful if someone has posted a link with a session variable to Usenet or a web site. Michael -- Michael Darrin Chaney mdc...@mi... http://www.michaelchaney.com/ |
From: Bob B. <bo...@iN...> - 2001-11-06 22:45:41
|
Darcy -- We use Netscape for development ... and I keep an icon on my desktop for a text editor which opens the Netscape cookie file - then I can delete the entries I want, and re-save the file. Works great ... you could probably set up the same thing for MSIE ... Bob. At 04:21 PM 11/6/2001 -0500, you wrote: >hi, > > i have a strange problem. While testing, i occasionally need to >remove my session records from the db. Upon doing so, it immediately >tries to get me to login back in (obviously since i am no longer >authenticated). The strange thing is that i do have my sessions >variables anymore. i've just looked around and discovered that it's not >setting a new cookie. Instead, it must be using the cookie, i already >have. Is it possible for me to turn that off (ie. create a new cookie) >or better yet just make sure that the auto_init gets run again. > > i know it sounds like a very unlikely scenerio, but i've come to >understand that computers love unlikely scenerios. In fact, i think >they are immediately considered likely scenerios because they are >unlikely. ;-) > >-- >~darcy w. christ >Elegant Communications Inc. >416.362.9772 x222 | 416.362.8324 fax > >_______________________________________________ >Phplib-users mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: darcy w. c. <da...@el...> - 2001-11-06 21:22:21
|
hi, i have a strange problem. While testing, i occasionally need to remove my session records from the db. Upon doing so, it immediately tries to get me to login back in (obviously since i am no longer authenticated). The strange thing is that i do have my sessions variables anymore. i've just looked around and discovered that it's not setting a new cookie. Instead, it must be using the cookie, i already have. Is it possible for me to turn that off (ie. create a new cookie) or better yet just make sure that the auto_init gets run again. i know it sounds like a very unlikely scenerio, but i've come to understand that computers love unlikely scenerios. In fact, i think they are immediately considered likely scenerios because they are unlikely. ;-) -- ~darcy w. christ Elegant Communications Inc. 416.362.9772 x222 | 416.362.8324 fax |
From: Brian P. <bp...@ct...> - 2001-11-06 20:58:00
|
These two variables: var $gc_time = 1440; ## Purge all session data older than 1440 minutes. var $gc_probability = 1; ## Garbage collect probability in percent determine how often a garbage collection routine is called and which old session records are deleted (with the gc function). function gc() { srand(time()); if ((rand()%100) < $this->gc_probability) { $this->that->ac_gc($this->gc_time, $this->name); } } gc() gets called in the start function of the session class. The probability variable is used so that the gc() function will only be "working" a small percentage of the time (by default). -----Original Message----- From: darcy w. christ [mailto:da...@el...] Sent: Tuesday, November 06, 2001 2:49 PM To: php...@li... Subject: Re: [Phplib-users] One User logged in at the same time... No, you are right. i was being sloppy. in fact, what was i thinking? still, there might be a way. If you added a timestamp to your session and make sure the timestamp is updated everytime the user continues in a state of authentication, it would be possible to know if a user is logged on beyond the authentication timeout. i've built in a javascript refresh into my site, so that the page is refreshed after the authentication timeout, just to force a logout. question: how and when are session records removed? Jens Benecke wrote: > > On Tue, Nov 06, 2001 at 02:40:22PM -0500, darcy w. christ wrote: > > > i have not done this, but it's certainly possible. One thing you could > > do is create a new table for logging who has been authenticated. i have > > done this by adding this function to my auth class. > > (...) > > But if you did this where the user is being authenticated and you put the > > last_insert_id() into the table, you would be able check both the session > > table and this auth log table for someone logged in. Does that make > > sense? > > I don't think this works as advertised. How do you know when a user logs > off? That's the whole problem. You can of course keep a log of all logged > in users, but this doesn't help if you don't know when users > > - go to another site (i.e. log off, practically speaking) > - close their browser window (i.e. log off) > - computer crashes (i.e. they loose session cookie anyway) > - etc. > > so you don't know when to allow a second user in. > > Or did I miss the point? -- ~darcy w. christ Elegant Communications Inc. 416.362.9772 x222 | 416.362.8324 fax _______________________________________________ Phplib-users mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: darcy w. c. <da...@el...> - 2001-11-06 20:50:32
|
No, you are right. i was being sloppy. in fact, what was i thinking? still, there might be a way. If you added a timestamp to your session and make sure the timestamp is updated everytime the user continues in a state of authentication, it would be possible to know if a user is logged on beyond the authentication timeout. i've built in a javascript refresh into my site, so that the page is refreshed after the authentication timeout, just to force a logout. question: how and when are session records removed? Jens Benecke wrote: > > On Tue, Nov 06, 2001 at 02:40:22PM -0500, darcy w. christ wrote: > > > i have not done this, but it's certainly possible. One thing you could > > do is create a new table for logging who has been authenticated. i have > > done this by adding this function to my auth class. > > (...) > > But if you did this where the user is being authenticated and you put the > > last_insert_id() into the table, you would be able check both the session > > table and this auth log table for someone logged in. Does that make > > sense? > > I don't think this works as advertised. How do you know when a user logs > off? That's the whole problem. You can of course keep a log of all logged > in users, but this doesn't help if you don't know when users > > - go to another site (i.e. log off, practically speaking) > - close their browser window (i.e. log off) > - computer crashes (i.e. they loose session cookie anyway) > - etc. > > so you don't know when to allow a second user in. > > Or did I miss the point? -- ~darcy w. christ Elegant Communications Inc. 416.362.9772 x222 | 416.362.8324 fax |
From: darcy w. c. <da...@el...> - 2001-11-06 19:41:35
|
i have not done this, but it's certainly possible. One thing you could do is create a new table for logging who has been authenticated. i have done this by adding this function to my auth class. function log_auth($uid,$first_name,$last_name,$email) { global $HTTP_REFERER, $REMOTE_ADDR, $HTTP_USER_AGENT; $db = new DB_simple; $table = "auth_stats"; $now = date("YmdHis", time()); $query = sprintf("insert into %s (user_id,first_name,last_name,email,start_time,addr,user_agent) values ('%s','%s','%s','%s','%s','%s','%s')", $table, $uid, $first_name, $last_name, $email, $now, $REMOTE_ADDR, $HTTP_USER_AGENT); $db->query($query); } But if you did this where the user is being authenticated and you put the last_insert_id() into the table, you would be able check both the session table and this auth log table for someone logged in. Does that make sense? Jens Benecke wrote: > > On Tue, Nov 06, 2001 at 06:58:52PM +0100, Sascha Ragtschaa wrote: > > > I have a problem. I am using PHPlib and need a way of authentification, > > in which a user logs into a system, and will be recognized that he is a > > logged user. If another user tries to log in with the same Account > > (username, password), he has to be rejected. Only one user with the same > > account should be in the system at one time! How can I do such thing with > > PHPlib? Did anyone already write a function of that? > > This will not be easy to do, because HTTP still is a stateless protocol. > There is no such state as 'logged in' because there are no states in a > stateless protocol, and even sessions cannot really help this. > > What is 'logged in'? That means a user with a certain IP address has > provided sufficient credentials (login, password, cookies, etc) to be > treated as a 'known person'. It does NOT mean that the user is connected to > the server at all times, so you never know when (if!) s?he'll 'log off' > (i.e. close h{is,er} browser window and so destroy the session cookie > pointing to the login data). S?he can be idle for hours, even days, and > then suddenly make another request for a page, including the session cookie > or URL parameter that qualifys h{im,er} for a logged in user. > > What you need is something that guarantees a log-off. I can imagine > something like this being done with Javascript, with a 'onClose=' and/or > 'onUnLoad=' in the HTML BODY tag that calls a log-off script. This will > annoy many users though because closing the window pops up another one (and > don't tell me you've never seen sites where this is used. Just about every > pr0n site uses it. ;) You will also need a "Redirect: $TIME, > $logout_page") HTTP header to log off automatically after idle time. You > will probably need to take care of several more methods of not logging off. > > If you don't guarantee log-off, the second user will be refused until the > session of the first user expires, which can be days. This is probably not > what you want. ;) -- ~darcy w. christ Elegant Communications Inc. 416.362.9772 x222 | 416.362.8324 fax |
From: Sascha R. <Rag...@pe...> - 2001-11-06 17:58:58
|
Hello, I have a problem. I am using PHPlib and need a way of authentification, in which a user logs into a system, and will be recognized that he is a logged user. If another user tries to log in with the same Account (username, password), he has to be rejected. Only one user with the same account should be in the system at one time! How can I do such thing with PHPlib? Did anyone already write a function of that? Thanks in advance.... Sascha |
From: Lazaro F. <la...@ii...> - 2001-11-06 15:32:32
|
Hi An off topic question, how can I evoid my PHP code render input quotes = (') as ( " ) this a mysql problem, can I fix it setting on a PHP config variable ? Thanks in advance Lazaro |