phplib-users Mailing List for PHPLIB (Page 85)
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: Brian P. <bp...@ct...> - 2001-10-26 16:08:35
|
A database would obviously be the most portable. How about modifying page_open and page_close to include a database object (and it's corresponding cache) which gets restored/frozen at the start and finish of each page. I'm not sure if the additional overhead would offset any performance gains from the cache though? I guess it depends on the application. -----Original Message----- From: Donncha O Caoimh [mailto:don...@tr...] Sent: Friday, October 26, 2001 10:36 AM To: nathan r. hruby Cc: Brian Popp; Phplib (E-mail) Subject: Re: [Phplib-users] Caching MySQL queries "nathan r. hruby" wrote: > > On Fri, 26 Oct 2001, Donncha O Caoimh wrote: > > > That's the simple explanation. I serialize the array and base64_encode > > it before caching it and seperate each record by a "\n". When I read it > > back I split the cache by "\n" and eval() the correct row. Not the best > > way of doing it but it's the most obvious way I thought of and the > > quickest to see if it'd work :) > > > > I picked up on this late, so please shoot me if I'm straying or this has > been covered. > > base64 encoding increases the size of stored vaules by a lot which could > be part of the problem when working with large result sets. Unless you > need base64 I'd say just to just serialize the mysql result arrays, add > whatever delim you nedd and addslash() them then jsut stripslash(), > split() and eval() Did that and it's easier to debug the cache now.. mimencode just makes sure that things are def. not 8 bit characters.. > > Question is what kind of metadata does the cache have to make sure the > data is fresh and to determine a hit (looking back, md5 sums of the > original sql query statement.. i see that should work) and where does this > cache live? If it's living in a db, well, then what's the point except to > speed up very complex queries. Now if it's living in a shmem ssegment, > well, that's just darn fast.. With something like Zend cache, you may be > able to use a file and let *that* cache engine take care of it too, if you > don't feel like coding your own shmem functions I haven't even looked at that yet. All I'm doing is setting an arbitrary timeout on every query. The cache gets stored in /tmp at the moment. Again, I'm trying to get it to work first before I do anything exotic with it. And also allowing for dropping in other caching scripts too. Donncha. |
From: nathan r. h. <na...@ds...> - 2001-10-26 15:43:01
|
On Fri, 26 Oct 2001, Donncha O Caoimh wrote: > 1. Yes, he could leave out that $db->connect() call. Creating the $db > object should be enough. > 2. I would suspect that accessing the Record[] array directly instead of > calling the f() function is slightly faster. This is the way I've always > accessed the MySQL result set. f() is handy in situations where you can use it. You can also get $db->Record['column_name'] as DB_Sql will by default retrive numricaly indexed and named indexed arrays in parallel $db->Record[0] and $db->Record['first_col'] are the same. This can be tuned by specifiying mysql_fest_array's result_type in the class. This at some point shoul be a class definable option, as well as using *_fetch_object. The DB classes are going to get an overhaul soon. > 3. By using integer indexes he may save some milliseconds. I'm only > guessing since text inside "quotes" is interpreted by PHP. > 4. I would also question his use of $db->free() as well. I have never > had to use it, and AFAIK db_mysql.inc calls the MySQL free() function > when it's needed. It's outside the main while() loop so it shouldn't be > too much of a slow down. > > I don't think he could have done much to make this query faster, and I > was happy to see Phplib do so well. The fact that adodb won wasn't a > surprise, but I won't discount that it may be better in certain > conditions than phplib. > I belive his record sets were small (200 entires) I'd like to see something with 2,000 entires as well. Yes, php did quite well, but there are a few places where the code can be tightend, espiaclly in terms of tuning for php4. If AODB is written for php, there's cerianly where the speed gain is. -n -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Donncha O C. <don...@tr...> - 2001-10-26 15:37:47
|
"nathan r. hruby" wrote: > > On Fri, 26 Oct 2001, Donncha O Caoimh wrote: > > > That's the simple explanation. I serialize the array and base64_encode > > it before caching it and seperate each record by a "\n". When I read it > > back I split the cache by "\n" and eval() the correct row. Not the best > > way of doing it but it's the most obvious way I thought of and the > > quickest to see if it'd work :) > > > > I picked up on this late, so please shoot me if I'm straying or this has > been covered. > > base64 encoding increases the size of stored vaules by a lot which could > be part of the problem when working with large result sets. Unless you > need base64 I'd say just to just serialize the mysql result arrays, add > whatever delim you nedd and addslash() them then jsut stripslash(), > split() and eval() Did that and it's easier to debug the cache now.. mimencode just makes sure that things are def. not 8 bit characters.. > > Question is what kind of metadata does the cache have to make sure the > data is fresh and to determine a hit (looking back, md5 sums of the > original sql query statement.. i see that should work) and where does this > cache live? If it's living in a db, well, then what's the point except to > speed up very complex queries. Now if it's living in a shmem ssegment, > well, that's just darn fast.. With something like Zend cache, you may be > able to use a file and let *that* cache engine take care of it too, if you > don't feel like coding your own shmem functions I haven't even looked at that yet. All I'm doing is setting an arbitrary timeout on every query. The cache gets stored in /tmp at the moment. Again, I'm trying to get it to work first before I do anything exotic with it. And also allowing for dropping in other caching scripts too. Donncha. |
From: nathan r. h. <na...@ds...> - 2001-10-26 15:25:25
|
On Fri, 26 Oct 2001, Donncha O Caoimh wrote: > That's the simple explanation. I serialize the array and base64_encode > it before caching it and seperate each record by a "\n". When I read it > back I split the cache by "\n" and eval() the correct row. Not the best > way of doing it but it's the most obvious way I thought of and the > quickest to see if it'd work :) > I picked up on this late, so please shoot me if I'm straying or this has been covered. base64 encoding increases the size of stored vaules by a lot which could be part of the problem when working with large result sets. Unless you need base64 I'd say just to just serialize the mysql result arrays, add whatever delim you nedd and addslash() them then jsut stripslash(), split() and eval() Question is what kind of metadata does the cache have to make sure the data is fresh and to determine a hit (looking back, md5 sums of the original sql query statement.. i see that should work) and where does this cache live? If it's living in a db, well, then what's the point except to speed up very complex queries. Now if it's living in a shmem ssegment, well, that's just darn fast.. With something like Zend cache, you may be able to use a file and let *that* cache engine take care of it too, if you don't feel like coding your own shmem functions -n -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- nathan hruby / digital statement na...@ds... http://www.dstatement.com/ Public GPG key can be found at: http://www.dstatement.com/nathan-gpg-key.txt ED54 9A5E 132D BD01 9103 EEF3 E1B9 4738 EC90 801B -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: Donncha O C. <don...@tr...> - 2001-10-26 15:04:53
|
Ok, using the filecacheclass from http://phpclasses.upperdesign.com/browse.html?file=1049 and http://phpclasses.upperdesign.com/browse.html?file=1048 (for docs, I think you need a login to get at the site). I edited db_mysql.inc and added some calls to this class. *It is working* using the query and next_record functions but with one cavaet. If a large number of rows are stored in the cache it takes ages for the cache to walk through them. This is a first try at doing this, and I wanted to do it as simply as possible: the query() function is called first. I use the functions in the cache class above to see if that function is cached. If so, I set $this->Query_ID to "cache" and a few of the other vars too. I return $this->Query_ID. Next, user calls next_record() This function checks if $this->Query_ID is set to "cache" and if so will reload the cache and pick out the correct row and return it in the $this->Record array. Otherwise, it goes to the database, grabs a row and stores it in the cache. That's the simple explanation. I serialize the array and base64_encode it before caching it and seperate each record by a "\n". When I read it back I split the cache by "\n" and eval() the correct row. Not the best way of doing it but it's the most obvious way I thought of and the quickest to see if it'd work :) Anyone object to me posting a diff against phplib7.2d db_mysql.inc to the list? Brian - I'll mail you the full file for convenience. Donncha. Brian Popp wrote: > > Sounds like an excellent idea and I'd be interested to see how much of a > performance difference it would make. I'm guessing "a lot" on some of my > more query intensive sites. If nobody else does it first (or already has), I > may try to play around with this and see what I can come up with. > > -----Original Message----- > From: Donncha O Caoimh [mailto:don...@tr...] > Sent: Friday, October 26, 2001 4:51 AM > To: php...@li... > Subject: [Phplib-users] Caching MySQL queries > > I'm not sure if this has been brought up before so I'll soldier on. I > did a quick search of google and some other sites and don't remember it > ever coming up here. > > Has anyone considered doing a caching layer for MySQL queries through > the phplib interface? Here's some ideas: > > 1. Add a new function: fetchall( $query ) to the DB_sql class. This > class will act like the Perl function of the same name and fetch the > entire result set of a query and return it in a 2d array. > 2. This function will also cache the result set of the query somewhere > and if the same query is sent to that database within a certain length > of time, return the cache instead of hitting the database. Generating an |
From: Brian P. <bp...@ct...> - 2001-10-26 14:52:48
|
Sounds like an excellent idea and I'd be interested to see how much of a performance difference it would make. I'm guessing "a lot" on some of my more query intensive sites. If nobody else does it first (or already has), I may try to play around with this and see what I can come up with. -----Original Message----- From: Donncha O Caoimh [mailto:don...@tr...] Sent: Friday, October 26, 2001 4:51 AM To: php...@li... Subject: [Phplib-users] Caching MySQL queries I'm not sure if this has been brought up before so I'll soldier on. I did a quick search of google and some other sites and don't remember it ever coming up here. Has anyone considered doing a caching layer for MySQL queries through the phplib interface? Here's some ideas: 1. Add a new function: fetchall( $query ) to the DB_sql class. This class will act like the Perl function of the same name and fetch the entire result set of a query and return it in a 2d array. 2. This function will also cache the result set of the query somewhere and if the same query is sent to that database within a certain length of time, return the cache instead of hitting the database. Generating an md5 of the query should be sufficient to match queries up. 3. None of the caching should be seen by the developer except perhaps through class variables or functions. 4. Since databases and tables aren't created often the TTL (time to live) of any particular table cache could be hard coded in a config file for very fast access. It of course could also be stored in a db which would usually only ever be read from, and modified once in a blue moon. The standard query() function could be used along with the next_record() function but if the result set isn't completely "walked" through then the cache wouldn't be complete. "Finish" markers would ensure this doesn't happen. Any one of a number of caching scripts could be used and I'm just throwing this out to the list as an idea I may work on later on.. Donncha. _______________________________________________ Phplib-users mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Donncha O C. <don...@tr...> - 2001-10-26 10:01:32
|
I'm not sure if this has been brought up before so I'll soldier on. I did a quick search of google and some other sites and don't remember it ever coming up here. Has anyone considered doing a caching layer for MySQL queries through the phplib interface? Here's some ideas: 1. Add a new function: fetchall( $query ) to the DB_sql class. This class will act like the Perl function of the same name and fetch the entire result set of a query and return it in a 2d array. 2. This function will also cache the result set of the query somewhere and if the same query is sent to that database within a certain length of time, return the cache instead of hitting the database. Generating an md5 of the query should be sufficient to match queries up. 3. None of the caching should be seen by the developer except perhaps through class variables or functions. 4. Since databases and tables aren't created often the TTL (time to live) of any particular table cache could be hard coded in a config file for very fast access. It of course could also be stored in a db which would usually only ever be read from, and modified once in a blue moon. The standard query() function could be used along with the next_record() function but if the result set isn't completely "walked" through then the cache wouldn't be complete. "Finish" markers would ensure this doesn't happen. Any one of a number of caching scripts could be used and I'm just throwing this out to the list as an idea I may work on later on.. Donncha. |
From: Donncha O C. <don...@tr...> - 2001-10-26 09:27:15
|
1. Yes, he could leave out that $db->connect() call. Creating the $db object should be enough. 2. I would suspect that accessing the Record[] array directly instead of calling the f() function is slightly faster. This is the way I've always accessed the MySQL result set. 3. By using integer indexes he may save some milliseconds. I'm only guessing since text inside "quotes" is interpreted by PHP. 4. I would also question his use of $db->free() as well. I have never had to use it, and AFAIK db_mysql.inc calls the MySQL free() function when it's needed. It's outside the main while() loop so it shouldn't be too much of a slow down. I don't think he could have done much to make this query faster, and I was happy to see Phplib do so well. The fact that adodb won wasn't a surprise, but I won't discount that it may be better in certain conditions than phplib. He should have probably did a check for num_rows() to reflect more real-life situations. His code would generate the usual "0 is not a MySQL result set" or similar error message if no data was returned. Donncha. Peter Bowyer wrote: > > Hi, > > For those of you who haven't seen it yet, http://php.weblogs.com has been > benchmarking the database classes. Not surprisingly his DBA comes out > fastest (!) with PHPLib a close second. I have been looking at the source > code of the PHPLib benchmark and wondered if it could actually be speeded up? > -- PHPLib source code - full code from http://phplens.com/lens/adodb/ -- > <?php > include_once('../../php/phplib-7.2d/php/db_mysql.inc'); > $DBNAME = 'PHPLib'; > > function &Connect() > { > $db = new DB_Sql(); > $db->connect("northwind", "localhost", "root", ""); > return $db; > } > > function QueryOnce(&$db,$debug) > { > $rs = $db->query('select > productid,productname,unitsinstock,unitprice from products'); > while ($db->next_record()) { > $id=$db->Record[0]; > $name=$db->Record[1]; > $unitsinstock=$db->Record[2]; > $unitprice=$db->Record[3]; > > if ($debug) { > print "$id, $name, $unitsinstock, $unitprice<br>"; > } > } > $db->free($rs); > } > ?> > -------------------------------------------- > As I see it, he can cut out the db->connect and just put the details in the > class file. Would the latest version of db_mysql.inc from CVS make much > difference? Also, can anyone tell me what difference in performance there > is between $id=$db->Record[0]; and $id=$db->f("productid"); ?? > > Any feedback gratefully received, and if there's any changes then I'll pass > them on to John Lim. > > Cheers! > Peter. > |
From: Peter B. <re...@f2...> - 2001-10-25 18:44:59
|
Hi, For those of you who haven't seen it yet, http://php.weblogs.com has been benchmarking the database classes. Not surprisingly his DBA comes out fastest (!) with PHPLib a close second. I have been looking at the source code of the PHPLib benchmark and wondered if it could actually be speeded up? -- PHPLib source code - full code from http://phplens.com/lens/adodb/ -- <?php include_once('../../php/phplib-7.2d/php/db_mysql.inc'); $DBNAME = 'PHPLib'; function &Connect() { $db = new DB_Sql(); $db->connect("northwind", "localhost", "root", ""); return $db; } function QueryOnce(&$db,$debug) { $rs = $db->query('select productid,productname,unitsinstock,unitprice from products'); while ($db->next_record()) { $id=$db->Record[0]; $name=$db->Record[1]; $unitsinstock=$db->Record[2]; $unitprice=$db->Record[3]; if ($debug) { print "$id, $name, $unitsinstock, $unitprice<br>"; } } $db->free($rs); } ?> -------------------------------------------- As I see it, he can cut out the db->connect and just put the details in the class file. Would the latest version of db_mysql.inc from CVS make much difference? Also, can anyone tell me what difference in performance there is between $id=$db->Record[0]; and $id=$db->f("productid"); ?? Any feedback gratefully received, and if there's any changes then I'll pass them on to John Lim. Cheers! Peter. -- Maple Design - web design, custom programming. No job too small. And ridiculously low prices! http://www.mapledesign.co.uk |
From: Layne W. <la...@if...> - 2001-10-23 15:14:13
|
> Thanks for all your help. > I figured out that I am using the same var-names in the > templates as in the > PHP-code (no problem without templates). When you submit data > the data from > the PHP-vars is submitted instead of the HTML-data. Changing > the var-names > in the template is a solution (this works), but I think it's > a dirty one. > Isn't there a workaround. Or do I have to parse back the > values from the > template? The problem is not templates, but the logic. You have two options: 1. Check for a form submit first. (My prime directive is always check for user input and verify the integrity of that input before doing anything else.) 2. Use the $HTTP_POST_VARS array in your update statement. (You check for $id, but do not use it. What is it's function? Is it necessary?) $sql = "UPDATE klant SET klant_naam = '$HTTP_POST_VARS[klant_naam]', ... Layne Weathers Ifworld Inc > -----Oorspronkelijk bericht----- > Van: php...@li... > [mailto:php...@li...]Namens Layne Weathers > Verzonden: maandag 22 oktober 2001 23:43 > Aan: php...@li... > Onderwerp: Re: [Phplib-users] phplib templates > > > > I am writing a project in PHP and I want to use templates > > (phplib) to keep > > my html separated from code. > > > > Passing values from the php-code to the template works perfect! > > Now I am trying to submit values in the form, but this is a > > problem. When I > > submit the old values in the form are submitted instead of > the changed > > values. > > > > What am I doing wrong?? > > It sounds like your browser is caching the results of the page - you > wouldn't happen to be using Internet Explorer 5 for Windows, > would you? > > This problem is addressed in PHPLib's session handling > classes. Look in > session.inc at lines 462 to 466 - either use PHPLib's > sessions or make sure > those lines get included into the beginning of each page in > your project. > > > > Any help would be appreciated. > > > > // code included in attachment. > > I would also recommend using PHPLib's nice database class and strongly > encourage you to use a non-root mysql user for your websites. > > > Layne Weathers > Ifworld Inc |
From: Floor V. <ma...@fl...> - 2001-10-23 07:41:51
|
Thanks for all your help. I figured out that I am using the same var-names in the templates as in the PHP-code (no problem without templates). When you submit data the data from the PHP-vars is submitted instead of the HTML-data. Changing the var-names in the template is a solution (this works), but I think it's a dirty one. Isn't there a workaround. Or do I have to parse back the values from the template? I also tried including session.inc but it didn't work out. Thank you very much for the advice on the database connection. As soon as I finish the application i'll start working on the security! -----Oorspronkelijk bericht----- Van: php...@li... [mailto:php...@li...]Namens Layne Weathers Verzonden: maandag 22 oktober 2001 23:43 Aan: php...@li... Onderwerp: Re: [Phplib-users] phplib templates > I am writing a project in PHP and I want to use templates > (phplib) to keep > my html separated from code. > > Passing values from the php-code to the template works perfect! > Now I am trying to submit values in the form, but this is a > problem. When I > submit the old values in the form are submitted instead of the changed > values. > > What am I doing wrong?? It sounds like your browser is caching the results of the page - you wouldn't happen to be using Internet Explorer 5 for Windows, would you? This problem is addressed in PHPLib's session handling classes. Look in session.inc at lines 462 to 466 - either use PHPLib's sessions or make sure those lines get included into the beginning of each page in your project. > Any help would be appreciated. > > // code included in attachment. I would also recommend using PHPLib's nice database class and strongly encourage you to use a non-root mysql user for your websites. Layne Weathers Ifworld Inc _______________________________________________ Phplib-users mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Layne W. <la...@if...> - 2001-10-22 21:40:15
|
> I am writing a project in PHP and I want to use templates > (phplib) to keep > my html separated from code. > > Passing values from the php-code to the template works perfect! > Now I am trying to submit values in the form, but this is a > problem. When I > submit the old values in the form are submitted instead of the changed > values. > > What am I doing wrong?? It sounds like your browser is caching the results of the page - you wouldn't happen to be using Internet Explorer 5 for Windows, would you? This problem is addressed in PHPLib's session handling classes. Look in session.inc at lines 462 to 466 - either use PHPLib's sessions or make sure those lines get included into the beginning of each page in your project. > Any help would be appreciated. > > // code included in attachment. I would also recommend using PHPLib's nice database class and strongly encourage you to use a non-root mysql user for your websites. Layne Weathers Ifworld Inc |
From: Floor V. <ph...@fl...> - 2001-10-22 21:15:45
|
Hello, I am writing a project in PHP and I want to use templates (phplib) to keep my html separated from code. Passing values from the php-code to the template works perfect! Now I am trying to submit values in the form, but this is a problem. When I submit the old values in the form are submitted instead of the changed values. What am I doing wrong?? Any help would be appreciated. // code included in attachment. |
From: Maxim D. <max...@bo...> - 2001-10-22 08:08:09
|
Hello Jens, Saturday, October 20, 2001, 3:46:44 AM, you wrote: > On Wed, Oct 17, 2001 at 11:22:07AM +0400, Maxim Derkachev wrote: >> The main reason was to determine if cookies are used before letting the >> user to browse the site. > This is not necessary any more? I suppose not. You save an unneeded redirect - the vast majority of clients still use cookies. And you always have an opportunity to pass the SID to the page, if you need to let you JS scripts no know it. >> > Yes, apparently it does not. At least not to headers. If I do a >> Strange .... it sounds to me like a PHP bug. > I'll try again (after the relaunch of our site). I mean that not appending the SID to the location headers when trans-sid is turned on sounds like a PHP bug. It could be cured only by sending a bug report to the PHP team. > I guess performance is a > lot better with session4, is it noticeable? Yes. The session4 performs at least twofold better then the Session3. The main performance gain is from the native PHP serializer/deserializer, which works much more faster then the Session3 serializer/deserializer. >> > Also, how do I find out what variables are registered in session4? The >> > session::pt[] array doesn't exist any more (IIRC). >> There's no need in this array any more. Use $sess->is_registered('var') > I can't find out that way what session variables are registered. I don't > want to know 'is X registered' but I want to 'give me a list of all > registered variables'. There's a builtin array $HTTP_SESSION_VARS. All the registered variables reside there. Use array_keys($HTTP_SESSION_VARS), or walk through it in a loop: foreach ($HTTP_SESSION_VARS as $varname => $varval) { if ($varname == 'foo') { $sess->unregister($varname); // equivalent to session_unregister($varname) } } -- Best regards, Maxim Derkachev mailto:max...@bo... System administrator & programmer, Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 www.books.ru, www.symbol.ru |
From: Paul W. <wol...@sf...> - 2001-10-19 21:48:31
|
Hi, I have not been able to get the authentication module to work with register globals off and track vars on. Has anyone been able to get this work? I've downloaded the the auth, sess, and loginform.ithml classes from cvs. The session class seems to be working but I can't get past the login form. It seems to be breaking at is_authenticated. Cheers, Paul -- ________________________________________________________________ Paul Wolstenholme SMA Webware http://www.zzube.com/ What do you know? http://make.zzube.com/ Vancouver, BC Canada |
From: Layne W. <la...@if...> - 2001-10-17 14:07:44
|
> JB> Also, how do I find out what variables are registered in session4? The > JB> session::pt[] array doesn't exist any more (IIRC). > > There's no need in this array any more. Use > $sess->is_registered('var') > instead. Moreover, $pt was a private class variable in java terms - > no one should access it to have the list of the registered variables > (except for the very Session object). > Use public methods, and you won't suffer if the implementation > changes. To find the registered variables I loop through $GLOBALS and check each variable. Layne Weathers Ifworld Inc |
From: Maxim D. <max...@bo...> - 2001-10-17 07:23:27
|
Hello Jens, Wednesday, October 17, 2001, 2:16:00 AM, you wrote: >> JB> for session4.inc or session4_custom.inc, is there a way to >> JB> - force PHP to do an initial redirect to append the "Session=xxx" string >> JB> also to the _first_ URL the user visits >> What for? JB> Because we use a couple javascript-based links that are generated depending JB> on current browser and capabilities (and other data) which are not JB> recognized by trans-sid. JB> I think this is also why phplib does it (in session::release_token()). JB> Might there be other reasons? The main reason was to determine if cookies are used before letting the user to browse the site. >> JB> - force PHP to append the "Session=xxxxxx" string also to >> JB> - form targets >> JB> - HTTP headers (like 'Location: ...' >> JB> - complete URLs on request (e.g. if I redirect to a different >> JB> subdomain) >> >> Did you try to use trans-sid (PHP4 session module feature that will do >> all the things above automatically) ? JB> Yes, apparently it does not. At least not to headers. If I do a Strange .... it sounds to me like a PHP bug. JB> header("Location: ".$sess->url($PHP_SELF)); JB> with session.inc from phplib, it appends the SID. When I do it with JB> session4, it doesn't work any more. Not true. Session4::url() returns the SID apended to the url passed, unless the client has the session cookie or $trans_id_enabled is set to true value. Session3::url() appends SID only if there's no a session cookie. Almost the same. If you do not rely on trans_sid, turn it off and use the url() method. Or extend the class with the new method that does not respect trans_sid() or/and cookie, e.g. my_hacked_url(), which would always return SID. For me, I'd prefer to use $str . $sess->name .'='. $sess->id construct in such a rare cases. JB> Also, how do I find out what variables are registered in session4? The JB> session::pt[] array doesn't exist any more (IIRC). There's no need in this array any more. Use $sess->is_registered('var') instead. Moreover, $pt was a private class variable in java terms - no one should access it to have the list of the registered variables (except for the very Session object). Use public methods, and you won't suffer if the implementation changes. JB> I'd really like to switch over to session4 but a first attempt failed JB> because my application kept 'forgetting' the session data. Look at the code. Maybe there would be some suggestions? I'd like to improve the class. -- Best regards, Maxim Derkachev mailto:max...@bo... System administrator & programmer, Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 www.books.ru, www.symbol.ru |
From: Maxim D. <max...@bo...> - 2001-10-15 08:24:29
|
Hello Jens, Friday, October 12, 2001, 8:38:29 PM, you wrote: JB> for session4.inc or session4_custom.inc, is there a way to JB> - force PHP to do an initial redirect to append the "Session=xxx" string JB> also to the _first_ URL the user visits What for? JB> - force PHP to append the "Session=xxxxxx" string also to JB> - form targets JB> - HTTP headers (like 'Location: ...' JB> - complete URLs on request (e.g. if I redirect to a different JB> subdomain) Did you try to use trans-sid (PHP4 session module feature that will do all the things above automatically) ? -- Best regards, Maxim Derkachev mailto:max...@bo... System administrator & programmer, Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 www.books.ru, www.symbol.ru |
From: Jens B. <je...@je...> - 2001-10-12 16:39:34
|
Hi, for session4.inc or session4_custom.inc, is there a way to - force PHP to do an initial redirect to append the "Session=xxx" string also to the _first_ URL the user visits - force PHP to append the "Session=xxxxxx" string also to - form targets - HTTP headers (like 'Location: ...' - complete URLs on request (e.g. if I redirect to a different subdomain) The session4.inc handling breaks my session useage, which heavily uses this procedure: a) display form in page1.php, submit to self b) check values for validity in page1.php c) if OK, save values in session, and redirect to page2.php d) same with page2.php This apparently doesn't work with session4 because the Session-IDs aren't carried over during redirection and there is no initial redirect. I'd appreciate if someone could help me here ;) Thanks! -- Jens Benecke ········ http://www.hitchhikers.de/ - Europas Mitfahrzentrale Crypto regulations will only hinder criminals who obey the law. |
From: Layne W. <la...@if...> - 2001-10-11 14:21:59
|
> I am encountering a strange problem with templates. In > essence the problem is that when a string contains a dollar > sign and a comma such as $123,456.00 the resulting output is > 456 the $123, is for some reason chopped off. An example of > the source code that this happens on is as follows. > > $controls[narrative]=nl2br(htmlentities($thedb->f(narritave))); > $t->set_block ("page","row","rows"); > $t->set_var ($controls); > $t->parse ("rows","row",true); > > Do you have any suggestions on how to fix this. The fix for this is both in the old list archives <http://marc.theaimsgroup.com/?l=phplib&r=1&w=2> and in CVS at SourceForge. The fix consists of changing $ to its html entity during set_var and changing it back in finish. Layne Weathers Ifworld Inc |
From: <nau...@ab...> - 2001-10-11 13:40:24
|
I am encountering a strange problem with templates. In essence the problem is that when a string contains a dollar sign and a comma such as $123,456.00 the resulting output is 456 the $123, is for some reason chopped off. An example of the source code that this happens on is as follows. $controls[narrative]=nl2br(htmlentities($thedb->f(narritave))); $t->set_block ("page","row","rows"); $t->set_var ($controls); $t->parse ("rows","row",true); Do you have any suggestions on how to fix this. -------------------------------------------------------------------------------- Eric Naujock CCNA, CCDA, A+, Network +, I-Net + Abacus II 5610 Monroe St. Sylvania, Ohio 43560 <http://www.abacusii.com> E-mail - nau...@ab... Phone - 419-885-0082 X 241 Fax : 419-885-2717 AOL IM: erlic |
From: Feite B. <fei...@os...> - 2001-10-10 20:36:29
|
Hi, I have a shopping cart application that is limited to approx 8 items due to limitation of functionality by the use of the active_sessions table. If I change the local.inc and prepend.inc to make use of CT_Split_Sql instead of CT_Sql I get complaints about duplicate keys in the active_sessions_split table. For a part this probably has to do with the expiration timeout of the session too, because when I logged on for the first time I didn't have the problem. How to solve this ? Or is it a bug in 7.2 that has been solved ? Thanks, -- Feite Brekeveld fei...@os... http://www.osiris-it.nl |
From: Brian P. <bp...@ct...> - 2001-10-08 15:00:04
|
Another way is to embed these calls into regular functions. The OO in = PHP leaves much to be desired because all functions are public. Because of = this, when you override any class, you risk stepping on the author's toes = later. Granted, it's not likely the author(s) would ever add an = apply_defaults() function to Template class, but I think functions are more = understandable anyway. On my site, I do something like this at the top of every page: =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= include "../globals.php"; my_page_open(); /* PHPLib wrapper function */ my_header( "BPopp Sanctuary" ); /* Loads my common headers, menus, = etc. /* .. content goes here my_footer (); my_page_close(); exit; =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= my_header () would look something like (in it's simplest form): function my_header ( $title ) { $t =3D new Template (ABSOLUTE_ROOT); /* ABSOLUTE_ROOT is the path to the site and is 'defined' in globals.php */ $t->set_file ( "main", "header.html" ); $t->set_block ( "main", "HEADER" ); $t->set_var ( "title", $title ); $t->pparse ( "out", "HEADER" ); } -----Original Message----- From: Jens Benecke [mailto:je...@je...] Sent: Sunday, October 07, 2001 8:50 AM To: php...@li... Subject: Re: [Phplib-users] (no subject) On Sat, Oct 06, 2001 at 10:49:50PM -0600, Roberto Mello wrote: > I'm starting to use phplib, mainly for its DB, Cart and Template = classes. > Great work by the way. :-) I like them as well. =20 > On the template class, is there a way to have "master" templates for = the > whole site, that would be included in all other templates? It seems = to me > that by having to specify the root in every templated page, it = wouldn't > allow that functionality out of the box. Well, there's OOP for you : simply extend the Template class. Put your default settings in the extended class definition, perhaps in the constructor. (Don't forget to call the inherited constructor.) I've = done this at www.hitchhikers.de, the navigation bar, stats and banner parts = are all automagically generated when I do $t =3D new hhsession; $t->vars[TITLE] =3D "different page title"; $t->apply_defaults(); > Has someone done that? Yes. :-) class hhtemplate extends template { var $vars =3D array( TITLE =3D> "Hitchhikers"; # ... ); # ... function hhtemplate($root=3D"tpl/", $foo=3D"remove") { $this->Template($root, $foo); # call the original constructor # ... some more settings } =20 # ... default / additional functions } --=20 Jens Benecke =B7=B7=B7=B7=B7=B7=B7=B7 http://www.hitchhikers.de/ - = Europas Mitfahrzentrale Crypto regulations will only hinder criminals who obey the law. |
From: Ben C. <php...@be...> - 2001-10-07 22:16:04
|
phpBB is roughly based on phplib. I say roughly because they have heavily modified the base classes. I have successfully done with phpBB what you are wanting to do -- add forums and integrate them with a pre-existing phplib-based app. The main integration invovled ripping out their session handling stuff (since the forum would be behind my login) and having my login and user creation classes insert the appropriate data into the phpBB tables. You should note that I wasn't using phpBB 1.4, but version 2 from CVS. On Sun, Oct 07, 2001 at 07:43:58PM +0200, Andres Baravalle wrote: > Hi, > I'm working with my phplib-based site. Now I need to quickly add a forum, > to use it for teaching support. I don't need a whole system like php-nuke, > just something like phpbb or phorum (they look very well). By the way, I > don't want a system that forges my site, but just a set of well written > classes could be enought. > > The problem is that I would like to integrate the forum in my site > structure, all object-oriented and phplib-based. Are there any forums based > on phplib? > By the way, I would like to have even a imap-mail client based on phplib. > > If there is nothing just ready and avaible in GPL, I would think about > starting to work on a phplib version of bbforum. > Any suggestion? Any controindications of these way? > Thanks in advance, > Andres > > > __________ > > http://www.baravalle.co.uk > > > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users |
From: Andres B. <and...@li...> - 2001-10-07 17:44:41
|
Hi, I'm working with my phplib-based site. Now I need to quickly add a forum, to use it for teaching support. I don't need a whole system like php-nuke, just something like phpbb or phorum (they look very well). By the way, I don't want a system that forges my site, but just a set of well written classes could be enought. The problem is that I would like to integrate the forum in my site structure, all object-oriented and phplib-based. Are there any forums based on phplib? By the way, I would like to have even a imap-mail client based on phplib. If there is nothing just ready and avaible in GPL, I would think about starting to work on a phplib version of bbforum. Any suggestion? Any controindications of these way? Thanks in advance, Andres __________ http://www.baravalle.co.uk |