phplib-users Mailing List for PHPLIB (Page 64)
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: Layne W. <la...@if...> - 2002-05-06 23:09:29
|
> I generally force the username to lowercase before doing the > check, and > this code should do that (it's not rocket science to implement it). > I'll probably make that change. > > I won't allow case-sensitive matching. I've done it before, and > inevitably someone ends up typing in a couple of caps in their email > address, then they can't understand why it won't work next time when > they don't. Same with passwords, sad to say. Whoa! People use mixed case passwords for added security. You're lowering the security of your users' data by forcing lowercase passwords? For email addresses, MySQL searches case-insensitively, so why should we care how they enter it? > > In addition to checking email addresses against a simple > format, I check > > against all known TLDs. I also find it useful to warn users > if I cannot find > > an MX record for their domain. This prevents numerous > "us...@ho..." > > attempts. > > That's not a bad idea. Have any code which you'd like to share? I started with Validator 1.2 from thewebmasters.net and changed is_email() to use this new function: function has_mx($host) { exec("nslookup -type=mx $host", $return); if(is_array($return)) $return = join("\n", $return); if(is_integer(strpos($return, "mail exchanger"))) return true; return false; } Layne Weathers Ifworld Inc. |
|
From: Michael C. <mdc...@mi...> - 2002-05-06 23:08:13
|
On Mon, May 06, 2002 at 05:38:40PM -0500, Layne Weathers wrote: > > I've been promising this for a year, but it's undergone plenty of > > refinement to make it worthwhile. > > > > You can download my new phpauth code at: > > http://www.phpauth.com/ > > > > This is a replacement for the authentication functionality of phplib. > > It only works with php4, and relies on php4's sessioning. It > > works with > > register_globals turned off, and requires that magic_quotes also be > > turned off. It's nearly a drop-in replacement for phplib. > > > Really? > - You use a copy of PHPLib's db_mysql.inc from 1999 - what else is out of > date? Nothing major has changed that I know of in the db class. It works fine. > - You want me to use inline PHP and HTML. Why would I revert to ineligantly > located, hard-to-update markup when I have discovered the one true religion > of templates? I don't want you to do anything. I don't care what you do. As for me, I use standard HTML 4, with stylesheets, which works great for what I do. If it doesn't work for you, I don't care. > - You ask me to learn a new API and change my handling of auth, perms and > cart. I don't ask you to learn anything. I present a piece of code that you might find useful. If you don't, then move on. > > > I am using this code on 5 production sites currently, so it > > should work > > fine. > > > I use PHPLib on dozens of sites across half a dozen production servers; > thousands of other sites use PHPLib as well. There is a difference between > code that works and a library that can be used by thousands of developers to > fit their distinct needs. I do not think that PHPLib is perfect, but it has > fit the needs of many developers. phplib started somewhere, certainly not on thousands of sites. The phpauth code is far more flexible than phplib's equivalent pieces in many ways, and will easily fit the needs of any php developer who doesn't use templates. The template code would probably work with little or no effort, anyway. > > If you're looking at an easy upgrade path from phplib for > > php4, this is > > it. > > > > A few of the features that separate it from phplib: > > > > 1. uses php4 sessioning > > This appeared in PHPLib's development branch in 2000 and was moved into the > production branch a few months ago. > > > 2. register_globals off (more secure) > > This has been fixed in PHPLib. > > > 3. form variables are passed through login/registration forms > > This is an easy modification and has been described on the PHPLib list a few > times. Due to the fact that form variables aren't well named in phplib, some changes are necessary to make it work globally. > > 4. auth class doesn't exist unless they are authenticated > > I'm not sure that I understand this. If the code to authenticate a user > doesn't exist, how can they be authenticated? Do you mean instead that there > is no auth object in memory? That's a screwup on my part. Should read "auth object doesn't exist...." > I have not thoroughly inspected your code, but what I have seen indicates > that you have dismissed many of the design decisions followed in the PHPLib > classes. Why? I've dismissed very little. The biggest problem that I had with phplib's auth class was that the existence of an auth object didn't mean the user was authenticated. Indeed, even the "is_authenticated" function didn't work properly, as it would return "form" if the user was in the process of logging in. Checking for authentication meant going through the convoluted steps of checking for an auth object, seeing if is_authenticated returned anything, and if so making sure it wasn't "form". Now, it's a simple check for the existence of an auth object in the $_SESSION global. Additionally, the separate perm object didn't make sense to me. Nor did the inclusion of various files (headers, etc.) which sometimes resulted in confusion of scope (header might be included in global scope, or from within the auth object if logging in or registering). And I made this have the functionality to place a permanent cookie for authentication. The original reason that I wrote this new code was simply because I needed to authenticate using a flat file of usernames and passwords. That and the fact that I was using php4 and needed new sessioning. > Over the past few years, I have found the experience of the > PHPLib community to be quite valuable. I continue to discover flexibility in > PHPLib that I did not expect and find new ways to use the codebase. > > It seems that your biggest problem with PHPLib is that the development of > new features has not met your expectations. It hasn't met mine either (as a > developer, that means that I haven't met my own expectations). However, by > working on and with PHPLib, I am able to leverage countless hours of quality > programming to shorten my production time and improve my bottom line. > > There are many factors that affect our decisions to work on any given > project. If you are sure that working on the phpauth code is where your > priorities are, then I wish you luck with it. If not, please consider > contributing to PHPLib. The fact that I bought phpauth.com should be your first clue that this is where my priorities are. If you read my docs, you'll see that I was and remain quite impressed with phplib. There are a few fundamental problems that I have with it, and I have attempted to solve them with my new code. These problems involve the fundamental architecture of the auth class that they present, working on it doesn't make sense. If you don't like it, that's fine with me. As for the rest of us, I hope that others find it useful. If not, no biggy as I will continue to use it for my stuff (with at least one other person that I know of using it, too). Michael -- Michael Darrin Chaney mdc...@mi... http://www.michaelchaney.com/ |
|
From: Layne W. <la...@if...> - 2002-05-06 22:33:14
|
> I've been promising this for a year, but it's undergone plenty of > refinement to make it worthwhile. > > You can download my new phpauth code at: > http://www.phpauth.com/ > > This is a replacement for the authentication functionality of phplib. > It only works with php4, and relies on php4's sessioning. It > works with > register_globals turned off, and requires that magic_quotes also be > turned off. It's nearly a drop-in replacement for phplib. Really? - You use a copy of PHPLib's db_mysql.inc from 1999 - what else is out of date? - You want me to use inline PHP and HTML. Why would I revert to ineligantly located, hard-to-update markup when I have discovered the one true religion of templates? - You ask me to learn a new API and change my handling of auth, perms and cart. > I am using this code on 5 production sites currently, so it > should work > fine. I use PHPLib on dozens of sites across half a dozen production servers; thousands of other sites use PHPLib as well. There is a difference between code that works and a library that can be used by thousands of developers to fit their distinct needs. I do not think that PHPLib is perfect, but it has fit the needs of many developers. > If you're looking at an easy upgrade path from phplib for > php4, this is > it. > > A few of the features that separate it from phplib: > > 1. uses php4 sessioning This appeared in PHPLib's development branch in 2000 and was moved into the production branch a few months ago. > 2. register_globals off (more secure) This has been fixed in PHPLib. > 3. form variables are passed through login/registration forms This is an easy modification and has been described on the PHPLib list a few times. > 4. auth class doesn't exist unless they are authenticated I'm not sure that I understand this. If the code to authenticate a user doesn't exist, how can they be authenticated? Do you mean instead that there is no auth object in memory? I have not thoroughly inspected your code, but what I have seen indicates that you have dismissed many of the design decisions followed in the PHPLib classes. Why? Over the past few years, I have found the experience of the PHPLib community to be quite valuable. I continue to discover flexibility in PHPLib that I did not expect and find new ways to use the codebase. It seems that your biggest problem with PHPLib is that the development of new features has not met your expectations. It hasn't met mine either (as a developer, that means that I haven't met my own expectations). However, by working on and with PHPLib, I am able to leverage countless hours of quality programming to shorten my production time and improve my bottom line. There are many factors that affect our decisions to work on any given project. If you are sure that working on the phpauth code is where your priorities are, then I wish you luck with it. If not, please consider contributing to PHPLib. Layne Weathers Ifworld Inc. |
|
From: Michael C. <mdc...@mi...> - 2002-05-06 21:14:37
|
On Mon, May 06, 2002 at 04:08:38PM -0500, Layne Weathers wrote:
> > > I try to register in your site, but get response that my
> > email is invalid.
> > > Althought my email is valid for years (not this but other).
> >
> > The email address is checked against a simple regular expression.
> > preg_match('/^([a-z0-9\-_\.\&]+)@([a-z0-9\-]+\.)+[a-z]+$/',$email);
> > I assume you're mixing case (email addresses and domain names are case
> > insensitive).
>
> If email addresses are case insensitive, why do you force your (lower) case
> preference? Using uppercase letters is quite valid and often makes email
> addresses more human-readable.
I generally force the username to lowercase before doing the check, and
this code should do that (it's not rocket science to implement it).
I'll probably make that change.
I won't allow case-sensitive matching. I've done it before, and
inevitably someone ends up typing in a couple of caps in their email
address, then they can't understand why it won't work next time when
they don't. Same with passwords, sad to say.
> In addition to checking email addresses against a simple format, I check
> against all known TLDs. I also find it useful to warn users if I cannot find
> an MX record for their domain. This prevents numerous "us...@ho..."
> attempts.
That's not a bad idea. Have any code which you'd like to share?
Michael
--
Michael Darrin Chaney
mdc...@mi...
http://www.michaelchaney.com/
|
|
From: Layne W. <la...@if...> - 2002-05-06 21:03:14
|
> > I try to register in your site, but get response that my
> email is invalid.
> > Althought my email is valid for years (not this but other).
>
> The email address is checked against a simple regular expression.
> preg_match('/^([a-z0-9\-_\.\&]+)@([a-z0-9\-]+\.)+[a-z]+$/',$email);
> I assume you're mixing case (email addresses and domain names are case
> insensitive).
If email addresses are case insensitive, why do you force your (lower) case
preference? Using uppercase letters is quite valid and often makes email
addresses more human-readable.
In addition to checking email addresses against a simple format, I check
against all known TLDs. I also find it useful to warn users if I cannot find
an MX record for their domain. This prevents numerous "us...@ho..."
attempts.
Layne Weathers
Ifworld Inc.
|
|
From: Michael C. <mdc...@mi...> - 2002-05-06 20:50:56
|
On Mon, May 06, 2002 at 10:11:59PM +0200, Saulius wrote: > Hello, > > > You can download my new phpauth code at: > > http://www.phpauth.com/ > > Hm. It looks like, your site isn't working a bit. I can't download it. I fixed it. Missed an "s" in "downloads". > I try to register in your site, but get response that my email is invalid. > Althought my email is valid for years (not this but other). The email address is checked against a simple regular expression. preg_match('/^([a-z0-9\-_\.\&]+)@([a-z0-9\-]+\.)+[a-z]+$/',$email); I assume you're mixing case (email addresses and domain names are case insensitive). > And why must I register for downloading? I have no idea why you would think that you must. That's a sample site so that you can see it work. Michael -- Michael Darrin Chaney mdc...@mi... http://www.michaelchaney.com/ |
|
From: Saulius <sa...@ye...> - 2002-05-06 20:12:08
|
Hello, > You can download my new phpauth code at: > http://www.phpauth.com/ Hm. It looks like, your site isn't working a bit. I can't download it. I try to register in your site, but get response that my email is invalid. Althought my email is valid for years (not this but other). And why must I register for downloading? Bye, Saulius |
|
From: nathan r. h. <na...@ds...> - 2002-05-06 19:39:56
|
That's becaue you weren't auth()'ed and it was hiding. ;-) -n ------ nathan hruby na...@ds... ------ On Mon, 6 May 2002, Chris Johnson wrote: > Sounds fantastic! > > I just tried to download it, though, and got 404-not found errors. > > ..chris > > ----- Original Message ----- > From: "Michael Chaney" <mdc...@mi...> > > I've been promising this for a year, but it's undergone plenty of > refinement to make it worthwhile. > > You can download my new phpauth code at: > http://www.phpauth.com/ > > This is a replacement for the authentication functionality of phplib. > It only works with php4, and relies on php4's sessioning. It works with > register_globals turned off, and requires that magic_quotes also be > turned off. It's nearly a drop-in replacement for phplib. > > I am using this code on 5 production sites currently, so it should work > fine. > > If you're looking at an easy upgrade path from phplib for php4, this is > it. > > A few of the features that separate it from phplib: > > 1. uses php4 sessioning > 2. register_globals off (more secure) > 3. form variables are passed through login/registration forms > 4. auth class doesn't exist unless they are authenticated > > See the docs directory and sample site (http://sample.phpauth.com/) for > more details. > > Michael > -- > > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > |
|
From: Chris J. <ch...@ch...> - 2002-05-06 17:27:37
|
Sounds fantastic! I just tried to download it, though, and got 404-not found errors. ..chris ----- Original Message ----- From: "Michael Chaney" <mdc...@mi...> I've been promising this for a year, but it's undergone plenty of refinement to make it worthwhile. You can download my new phpauth code at: http://www.phpauth.com/ This is a replacement for the authentication functionality of phplib. It only works with php4, and relies on php4's sessioning. It works with register_globals turned off, and requires that magic_quotes also be turned off. It's nearly a drop-in replacement for phplib. I am using this code on 5 production sites currently, so it should work fine. If you're looking at an easy upgrade path from phplib for php4, this is it. A few of the features that separate it from phplib: 1. uses php4 sessioning 2. register_globals off (more secure) 3. form variables are passed through login/registration forms 4. auth class doesn't exist unless they are authenticated See the docs directory and sample site (http://sample.phpauth.com/) for more details. Michael -- |
|
From: Michael C. <mdc...@mi...> - 2002-05-06 16:59:14
|
I've been promising this for a year, but it's undergone plenty of refinement to make it worthwhile. You can download my new phpauth code at: http://www.phpauth.com/ This is a replacement for the authentication functionality of phplib. It only works with php4, and relies on php4's sessioning. It works with register_globals turned off, and requires that magic_quotes also be turned off. It's nearly a drop-in replacement for phplib. I am using this code on 5 production sites currently, so it should work fine. If you're looking at an easy upgrade path from phplib for php4, this is it. A few of the features that separate it from phplib: 1. uses php4 sessioning 2. register_globals off (more secure) 3. form variables are passed through login/registration forms 4. auth class doesn't exist unless they are authenticated See the docs directory and sample site (http://sample.phpauth.com/) for more details. Michael -- Michael Darrin Chaney mdc...@mi... http://www.michaelchaney.com/ |
|
From: Layne W. <la...@if...> - 2002-05-06 16:02:38
|
> Hello, I have a little problem here that I cannot solve > alone. Maybe you > can help me. I use on my pages phplib's auth, sess, user and > perm. After > logging in everything works as expected. I use in auth class > this: var > $lifetime = 525600; But anytime I close my broswer and open the pages > again, the url switches to ...php?session=XXXXXXXXXXXX, > although I use > cookies for sessions. After logging in the url is normal > again [running > cookies] and everything is OK now [Until next day anyway]. Unless you are setting the *session* lifetime, session will use *session* cookies in memory - not written to the filesystem. When you close your browser, you destroy the session cookies and your only link to the session that the auth is tied to is gone. It sounds to me like you want to manually create a hard cookie for the user and write a preauth function based on that. See the list archives for more discussion of preauth(). Layne Weathers Ifworld Inc. |
|
From: Ernest B. <oe...@oe...> - 2002-05-06 08:22:37
|
Hello, I have a little problem here that I cannot solve alone. Maybe you can help me. I use on my pages phplib's auth, sess, user and perm. After logging in everything works as expected. I use in auth class this: var $lifetime = 525600; But anytime I close my broswer and open the pages again, the url switches to ...php?session=XXXXXXXXXXXX, although I use cookies for sessions. After logging in the url is normal again [running cookies] and everything is OK now [Until next day anyway]. PS: I have tryed these browsers: Mozilla, Lynx, Conqueror, Internet Explorer 5.5SP2. I all other sites the cookie are working fine. PS2: EXPIRE_AUTH 06. May. 2003, 10:28:27 EXPIRE_SESS 01. Jan. 1970, 01:00:00 EXPIRE_USER 01. Jan. 1970, 01:00:00 -- Ernest Beinrohr, OERNii eAdmin @ AxonPro.sk, http://www.AxonPro.sk +421-2-62410360, +421-905-241903 HomePage: http://www.oernii.sk |
|
From: Richard A. <rh...@ju...> - 2002-05-04 03:05:11
|
At 1:15 PM -0300 3/5/02, Leandro Nery wrote: >MySQL Error: 2013 (Lost connection to MySQL server during query) Try running a verification/repair on all the databases. See the manual, section 4.4.6. This should do the trick (assuming all your tables are MyISAM format): myisamchk --silent --force --fast --update-state -O key_buffer=64M -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M /path/to/database/dir/*/*.MYI Just plug in the correct path. Oh, and shut down the database first! ...R. |
|
From: Chris J. <ch...@ch...> - 2002-05-03 18:20:33
|
This does not appear to be a PHPLIB / DB class problem. It's far more
likely to be a network, MySQL server host machine or MySQL problem.
I run PHPLIB and MySQL in a production environment (and have for 3 years)
and never see this error unless I do something like unplug the Ethernet
connection.
..chris
----- Original Message -----
From: "Leandro Nery" <lea...@ho...>
I am using Db_Sql class of Phplib-7.4-pre1 with MySQL 3.23.34a for an
application in php and "very often" when I am executing a query like this:
$db->query("SELECT id,subject FROM A.table ORDER BY mdate DESC LIMIT 10");
Then I get this error:
MySQL Error: 2013 (Lost connection to MySQL server during query)
The table has about 4000 rows and field sizes not so big too.
I don't have the exactly idea if this is a problem with the DB class or
MySql. I had used this DB for other applications without phplib classes
before and I never had this problem, maybe just coincidence, I HOPE SO, ..
Someone here have any idea of what it can be. I am almost praying :)
... [snip] ...
|
|
From: Leandro N. <lea...@ho...> - 2002-05-03 16:15:40
|
Hello all,
I am using Db_Sql class of Phplib-7.4-pre1 with MySQL 3.23.34a for an
application in php and "very often" when I am executing a query like this:
$db->query("SELECT id,subject FROM A.table ORDER BY mdate DESC LIMIT 10");
Then I get this error:
MySQL Error: 2013 (Lost connection to MySQL server during query)
The table has about 4000 rows and field sizes not so big too.
I don't have the exactly idea if this is a problem with the DB class or
MySql. I had used this DB for other applications without phplib classes
before and I never had this problem, maybe just coincidence, I HOPE SO, ..
Someone here have any idea of what it can be. I am almost praying :)
This error persist until I go via phpMyAdmin 2.2.5 and refresh a few times
the database where the error occurs by clicking in the database name
(sometimes one refresh-click is not enough), then the application returns to
work for an inconstant time until the same error happen again, sometimes not
in the same query with other tables too.
I already looked phplib, mysql manuals, change variables, buffers sizes,
table types, etc and nothing yet. ;((
Thanks a lot for any possible help,
Leandro Nery
Astalavista Group Team
_________________________________________________________________
O MSN Photos é o modo mais fácil de compartilhar e imprimir suas fotos:
http://photos.msn.com/support/worldwide.aspx
|
|
From: <so...@gm...> - 2002-05-03 13:24:06
|
is it possible to use one tpl file to select days in one box
and select months in one box?
------------------------------------
<td>{create_user_form->selectDay} {create_user_form->selectMonth}</td>
------------------------------------
<!-- start select -->
<select name="{select->name}" style="width:60px;" width="60">
<!-- BEGIN select -->
<option value="{select->value}"{select->selected}>{select->html}</option>
<!-- END select -->
</select>
<!-- end select -->
------------------------------------
$tpl->set_file ("create_user_form->selectDay", "tpl/select.tpl.html" );
// Tag
$tpl->set_block("create_user_form->selectDay", "select",
"selectDay_handle" );
for ($i=0; $i < count($ListDay); $i++) {
$selected = "";
if ($selectDay == $i) {
$selected = " selected";
}
$tpl->set_var("select->value", $i);
$tpl->set_var("select->selected", $selected);
$tpl->set_var("select->html", $ListDay[$i]);
$tpl->parse("selectDay_handle", "select", true);
}
$tpl-> set_var ( array (
"select->name" => "selectDay"
));
$tpl->set_file ("create_user_form->selectMonth", "tpl/select.tpl.html" );
// Monat
$tpl->set_block("create_user_form->selectMonth", "select",
"selectMonth_handle" );
for ($i=0; $i < count($ListMonth); $i++) {
$selected = "";
if ($selectMonth == $i) {
$selected = " selected";
}
$tpl->set_var("select->value", $i);
$tpl->set_var("select->selected", $selected);
$tpl->set_var("select->html", $ListMonth[$i]);
$tpl->parse("selectMonth_handle", "select", true);
}
$tpl-> set_var ( array (
"select->name" => "selectMonth"
));
|
|
From: Mike G. <mi...@op...> - 2002-05-02 17:28:25
|
Joe, you Rock!
I had looked at that for hours.. I could have looked at it for a few
more hours and it still wouldn't have worked..
Changint the section to:
<!-- BEGIN section_row -->
<em>{SUB_SECTION_TITLE}<br>{SUB_SECTION_BLERB}</em>
<!-- END section_row -->
Did the charm..
Layne, I think that the set file was running (especially as it is all
working now)
Mike
On Thu, 2002-05-02 at 12:50, Joe Stewart wrote:
> Hi Mike,
>
> I haven't looked very closely, but some versions of template.inc require
> the <!-- END section_row --> to be on a new line.
>
> On Thu, May 02, 2002 at 12:35:00PM -0400, Mike Gifford wrote:
> > Hello,
> >
> > I've seen this problem before with phplib templates.. And I've fixed
> > this problem before (on different code).. However for the life of me
> > right now I can't see what the heck is wrong with how I've structured
> > the template for this function and why I'm getting this error (is there
> > any way that this error could be more descriptive in future releases?)..
> >
> > The problem seems to be with a block I am trying to insert into an
> > existing template. I can print a section name, but wan to list all of
> > the sub-sections.
> >
> > So the template (be_section.tpl) is defined like this:
> > <!-- START OF TEMPLATED DISPLAY SECTION -->
> > <h2>{SECTION_TITLE}</h2>
> > {SECTION_BLERB}
> >
> > {MODIFY} {NEW_ARTICLE}
> >
> > <!-- BEGIN section_row
> > --><em>{SUB_SECTION_TITLE}<br>{SUB_SECTION_BLERB}</em><!-- END
> > section_row -->
> >
--
Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca
Open Source Web Applications for Social Change
New Site Launched: http://www.patmartin.org/
War is a poor chisel to carve out tomorrows. ML King, Jr.
|
|
From: Layne W. <la...@if...> - 2002-05-02 17:16:59
|
I'm assuming that you set the file (and possibly the block "printSection") in another function that is sure to run before getSection(). Sometimes the obvious things escape my notice. Layne Weathers Ifworld Inc. |
|
From: Mike G. <mi...@op...> - 2002-05-02 16:35:08
|
Hello,
I've seen this problem before with phplib templates.. And I've fixed
this problem before (on different code).. However for the life of me
right now I can't see what the heck is wrong with how I've structured
the template for this function and why I'm getting this error (is there
any way that this error could be more descriptive in future releases?)..
The problem seems to be with a block I am trying to insert into an
existing template. I can print a section name, but wan to list all of
the sub-sections.
So the template (be_section.tpl) is defined like this:
<!-- START OF TEMPLATED DISPLAY SECTION -->
<h2>{SECTION_TITLE}</h2>
{SECTION_BLERB}
{MODIFY} {NEW_ARTICLE}
<!-- BEGIN section_row
--><em>{SUB_SECTION_TITLE}<br>{SUB_SECTION_BLERB}</em><!-- END
section_row -->
<BR><hr align="left" width="50%" noshade>
<!-- END OF TEMPLATED DISPLAY SECTION -->
The function that I am using to call this template looks like the
following:
function getSection($ary) {
global $_PSL, $_BE;
// Template
$template = "printSection";
// Section Blocks
$this->template->set_block($template,"section_row","section_rows");
/*
* Call to _base layer for getting the Section stuff out the DB
*/
if(empty($ary['section'])) $ary['section'] = '0';
$section_ary = $this->extractSection($ary['section']);
# debug("Section::extractSections.section_ary", $section_ary);
if ($this->perm->have_perm("story,root")) {
$newArticle = "<a href=\"" . $_PSL['adminurl'] .
"/articleAdmin.php3?submit=newSection\">New Article</a>";
$modify = "<a href=\"" . $_PSL['adminurl'] .
"/articleAdmin.php3?submit=editSection§ionID=" .
$section_ary['sectionID'] . "\">Edit Section</a>";
$modify .= " <a href=\"" . $_PSL['adminurl'] .
"/articleAdmin.php3?submit=deleteSection§ionID=" .
$section_ary['sectionID'] . "\">Delete Section</a> ";
}
$this->template->set_var(array(
'SECTION_ID' => $section_ary['sectionID'],
'SECTION_URLNAME' => $section_ary['URLname'],
'SECTION_TITLE' => $section_ary['title'],
'SECTION_BLERB' => $section_ary['blerb'],
'MODIFY' => $modify,
'SNEW_ARTICLE' => $newArticle
));
$subSection_ary = $this->extractSubSection($section_ary['sectionID']);
if (is_array($subSection_ary)) {
for ($i = '0' ; $i < count($subSection_ary) ; $i++) {
# debug("Section::extractSubSections.subSection_ary",
$subSection_ary[$i]);
if ($this->perm->have_perm("story,root")) {
$modify = "<a href=\"" . $_PSL['adminurl'] .
"/articleAdmin.php3?submit=edit&articleID=" .
$articles_ary[$i]['articleID'] . "\">edit</a>";
$modify .= " <a href=\"" . $_PSL['adminurl'] .
"/articleAdmin.php3?submit=delete&articleID=" .
$articles_ary[$i]['articleID'] . "\">delete</a> ";
}
$this->template->set_var(array(
'SUB_SECTION_TITLE' => $subSection_ary[$i]['title'],
'SUB_SECTION_BLERB' => $subSection_ary[$i]['blerb'],
'SUB_MODIFY' => $modify
));
$this->template->parse("section_rows","section_row",true);
}
}
$this->template->parse('OUT', $template);
$thesection = $this->template->get('OUT');
return $thesection;
}
The debugging info outputs the appropriate arrays, so that's working..
Also, if there are three subsections in a section I get three copies of
this error:
Template Error: loadfile: section_row is not a valid handle.
Template Error: subst: unable to load section_row.
I get the results of the results from the main template variables just
fine, and I do get the last result from the array in the block I'm
having trouble with outputed..
I've just got to get rid of the errors and output all of the variables
in the block..
So what the heck am I doing wrong? Oh yea, forgot to mention that
printSection is defined above that?
$template_ary = array(
"printArticle" => "be_article.tpl",
"printSection" => "be_section.tpl",
"newarticle" => "articleNew.tpl",
"indexarticle" => "articleIndex.tpl"
);
Nathan, some of this code might look vaguely familiar to you as it's
based on phpSlash..
Also, I get this in digest mode, so if anyone does have any suggestions
on why I'm getting this annoying error, please cc mi...@op...
Mike
--
Mike Gifford, OpenConcept Consulting, http://www.openconcept.ca
Open Source Web Applications for Social Change
New Site Launched: http://www.patmartin.org/
War is a poor chisel to carve out tomorrows. ML King, Jr.
|
|
From: Mike G. <Mik...@sa...> - 2002-04-30 23:39:30
|
Along the same lines, and (I think) with more long-term flexibility and maintainability, would be to put the local.inc [and other virtual-domain-specific files] in a separate directory (php_virtualdomainname) for each virtual domain, any extensions to the PHPLib classes which are common to all virtual domains in a common directory (php_common), and the PHPLib classes in their own directory (php_lib). Then specify the include path for each virtual domain within the virtual host tags in the httpd.conf file: php_value include_path ".:/path/to/httpd/php_virtualdomainname:/path/to/httpd/php_common:/path/to/httpd/php_lib" Cheers! Mike Green David Glenn wrote: > Clarifications: > > - I am hosting many virtual domains (xxx-1-n.mydomain.com). > - Data -must- be separated by different database instances (business > requirement. Some databases may actually have to be physically separated > on different servers). Long-term maintenance will be grin-and-bear-it > time. > - I wanted as little phplib code changes as possible. > - The 'permanent key' that I called for would be some key indicator of > which dataset/database to load from. > > Great suggestions, but I think I'll use Matthew's: > > Use multiple local.inc files, uniquely named by pre-pending the virtual > host name ($HTTP_HOST) to local.inc. I changed my prepend.inc to: > > require($_PHPLIB["libdir"] . "$HTTP_HOST-local.inc"); > > and created multiple xxx-local.inc files, which should do the trick (the > only differences will actually be the database names at this point). > > Thanks. > > David Glenn > da...@so... > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: bandwidth@sourceforge.net_______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users -- _______________________________________________________________________ Michael D Green SaeSolved:: Custom-Built Web Applications -- http://www.saesolved.com 1552 Beachview Drive, Virginia Beach, VA 23464-7225, USA; 757.467.1552 http://www.everypeople.net http://www.sitewidgets.com _______________________________________________________________________ |
|
From: David G. <dav...@em...> - 2002-04-30 23:02:56
|
Clarifications: - I am hosting many virtual domains (xxx-1-n.mydomain.com). - Data -must- be separated by different database instances (business requirement. Some databases may actually have to be physically separated on different servers). Long-term maintenance will be grin-and-bear-it time. - I wanted as little phplib code changes as possible. - The 'permanent key' that I called for would be some key indicator of which dataset/database to load from. Great suggestions, but I think I'll use Matthew's: Use multiple local.inc files, uniquely named by pre-pending the virtual host name ($HTTP_HOST) to local.inc. I changed my prepend.inc to: require($_PHPLIB["libdir"] . "$HTTP_HOST-local.inc"); and created multiple xxx-local.inc files, which should do the trick (the only differences will actually be the database names at this point). Thanks. David Glenn da...@so... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 |
|
From: Richard A. <rh...@ju...> - 2002-04-30 21:46:33
|
At 2:32 PM -0500 30/4/02, David Glenn wrote: >I have a problem I haven't cracked yet. I have a centralized site (one >complete set of php pages) that will be used by many client groups, each >of which need to access their own database (each database with its own >phplib auth table set as well as application data). So it would seem if >I could call page_open with a pertinent key value and then set the >sess/auth/perm values dynamically on each page I would be on my way. > >I can call an initializer page with a name/value of the key value, and >then it would be great if that was stuck in a session for each page to I'm not sure I fully understand your problem, but could you use session's $auto_init = "setup.inc" feature to import this key/value into the new session? If that's no good, please describe this "pertinent key value" for me :) ...R. |
|
From: Matthew L. <lei...@ma...> - 2002-04-30 21:31:31
|
Dear David,
Probably two users calling the same of pages and expecting to get two
different web sites are using different URLs, right? Are you virtually
hosting multiple domains? I'm guessing whatever it is, there's some way
to tell these two apart. So you use that to determine the auth object:
$page_features=array("foo.com"=>array("sess"=>"foo_sess","auth"=>"foo_auth"...),
"bar.com"=>array("sess"=>"bar_sess","auth"=>"bar_auth"...),
"baz.com"=>array("sess"=>"baz_sess",...);
$page = $page_features($HTTP_HOST);
page_open($page);
You probably have to be more careful in divining the object names, but the
general strategy is that. Once you start the session, $auth, $perm, etc.
are registered in it so they remember their type.
This means that you will have load every client's session, auth, perm
objects no matter which client's site is being served. Here is another
idea: Give each site owner their own local.inc, with the same sess,
auth, perm objects defined by the same name. So everybody has a session
object "my_session", an auth object "my_auth", whatever. Then you use the
URL or HTTP_HOST to determine which local4.inc to load.
require "$HTTP_HOST-local.inc";
// only now are my_sess etc. declared classes
page_open("sess"=>"my_sess","auth"=>"my_auth",...)
Actually, this is probably better, since all your content is in a DB_SQL
object and which one depends on the client, too. So just make sure
local.inc declares classes of the same name for each client and you're
good. The only thing that really has to be different is the database
object.
HTH,
Matt
HTH,
Matt
> Message: 1
> From: "David Glenn" <dav...@em...>
> To: <php...@li...>
> Date: Tue, 30 Apr 2002 14:32:52 -0500
> Subject: [Phplib-users] phplib: dynamic page_open values
>
> I have a problem I haven't cracked yet. I have a centralized site (one
> complete set of php pages) that will be used by many client groups, each
> of which need to access their own database (each database with its own
> phplib auth table set as well as application data). So it would seem if
> I could call page_open with a pertinent key value and then set the
> sess/auth/perm values dynamically on each page I would be on my way.
>
> I can call an initializer page with a name/value of the key value, and
> then it would be great if that was stuck in a session for each page to
> use (via an header.inc or somesuch). However, with phplib, I can't get
> to the session values unless I already know the pertinent page_open sess
> value. Mr. Chicken please meet Mr. Egg.
>
> Ideas, prior solutions, something I'm missing? Thanks.
>
> David Glenn
> da...@so...
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
>
>
>
> --__--__--
>
> _______________________________________________
> Phplib-users mailing list
> Php...@li...
> https://lists.sourceforge.net/lists/listinfo/phplib-users
>
>
> End of Phplib-users Digest
>
--
----------------------------------------------------------------
Matthew Leingang http://www.math.rutgers.edu/
Rutgers University lei...@ma...
Department of Mathematics /usr/games/fortune says:
The University of California Statistics Department; where mean is normal,
and deviation standard.
|
|
From: Brian P. <bp...@ct...> - 2002-04-30 21:27:31
|
I'm not sure I understand exactly what you're doing, but one thing I would recommend is that you don't split the data into separate databases. Instead, you might consider creating another table that tracks the different groups. groups ---------- id name Then you just have to associate each user and each set of data with the corresponding group by adding a field to those tables called 'group_id' for example. When a user logs in, you look at their group_id, and store that in the $auth variable (or somewhere). Then, whenever you present data, you just filter it based on that group_id. I'm doing this on a number of sites and it is working beautifully. It offers the convenience of an unlimited number of groups, a centralized user database, and if you ever need to merge data or summarize data, it will be MUCH easier than trying to query across multiple databases. This requires a tad more work on the setup initially, but it's much flexible. With the way you described, you would have to copy your database structure for each client.. and if a database change is required, each database would have to be updated. That hurts just thinking about it.. especially if this project grows in scope beyond what you initially expected. Hope this helps. If this doesn't make sense, or you need more assistance, please don't hesitate to ask. bpopp - http://www.bpopp.net -----Original Message----- From: David Glenn [mailto:dav...@em...] Sent: Tuesday, April 30, 2002 2:33 PM To: php...@li... Subject: [Phplib-users] phplib: dynamic page_open values I have a problem I haven't cracked yet. I have a centralized site (one complete set of php pages) that will be used by many client groups, each of which need to access their own database (each database with its own phplib auth table set as well as application data). So it would seem if I could call page_open with a pertinent key value and then set the sess/auth/perm values dynamically on each page I would be on my way. I can call an initializer page with a name/value of the key value, and then it would be great if that was stuck in a session for each page to use (via an header.inc or somesuch). However, with phplib, I can't get to the session values unless I already know the pertinent page_open sess value. Mr. Chicken please meet Mr. Egg. Ideas, prior solutions, something I'm missing? Thanks. David Glenn da...@so... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 _______________________________________________ Phplib-users mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phplib-users |
|
From: David G. <dav...@em...> - 2002-04-30 19:33:21
|
I have a problem I haven't cracked yet. I have a centralized site (one complete set of php pages) that will be used by many client groups, each of which need to access their own database (each database with its own phplib auth table set as well as application data). So it would seem if I could call page_open with a pertinent key value and then set the sess/auth/perm values dynamically on each page I would be on my way. I can call an initializer page with a name/value of the key value, and then it would be great if that was stuck in a session for each page to use (via an header.inc or somesuch). However, with phplib, I can't get to the session values unless I already know the pertinent page_open sess value. Mr. Chicken please meet Mr. Egg. Ideas, prior solutions, something I'm missing? Thanks. David Glenn da...@so... --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 |