Re: [PHP] ImageColorTransparent Problem

2004-08-09 Thread Lester Caine
Kevin wrote:
Yes, I have tried making the image with imagecreate() function and it was
transparent. Using imagecreate() function I was only able to make 256 colors
but the image was transparent. I want real colors so I used
imagecreatetruecolor() and now the same is not transparent.
THAT is a bug in IE as far as I have established. PSP kept insisting on 
switching to palette mode when I select transparent, and on asking 
elsewhere I was told IE can't handle anything more.
Since I can't create the picture - I haven't had a chance to check in 
Mozilla/Firefox :)

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Access CLIENTNAME

2004-08-09 Thread Lester Caine
At the risk of getting my head bitten off I ask this again, as I am not 
getting any help anywhere.

I'm running a PHP system that relies on knowing the location of the 
terminal to handle a lot of '911' (999) type things. I know that 
REMOTE_ADDR can not be relied on, but with fixed IP addresses on a local 
network it works fine. However I now have a customer who has a Terminal 
Server thin client network, and REMOTE_ADDR only reports the server 
address. In order to restore the facilities I need to gain access to the 
CLIENTNAME environmental variable from the browser and return it to PHP.

I've already got the simple bodge - they type it on on login - which is 
simply a joke when coming to use the system. I have a TS logon batch 
file which copies the CLIENTNAME variable to a file from which it could 
be accessed. BUT I have yet to find any way to pass the information.

Can anybody kick me in the right direction, or do I have to stick with a 
drop down list in the logon box and expect everybody to know where they 
are?

Surely VOIP is going to run into this problem soon isn't it? (Not that I 
can see how TS can actually handle the microphone and camera anyway ;) )

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Access CLIENTNAME

2004-08-09 Thread icpcnn

- Original Message - 
From: "Lester Caine" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 09, 2004 3:16 PM
Subject: [PHP] Access CLIENTNAME


> At the risk of getting my head bitten off I ask this again, as I am not 
> getting any help anywhere.
> 
> I'm running a PHP system that relies on knowing the location of the 
> terminal to handle a lot of '911' (999) type things. I know that 
> REMOTE_ADDR can not be relied on, but with fixed IP addresses on a local 
> network it works fine. However I now have a customer who has a Terminal 
> Server thin client network, and REMOTE_ADDR only reports the server 
> address. In order to restore the facilities I need to gain access to the 
> CLIENTNAME environmental variable from the browser and return it to PHP.
> 
> I've already got the simple bodge - they type it on on login - which is 
> simply a joke when coming to use the system. I have a TS logon batch 
> file which copies the CLIENTNAME variable to a file from which it could 
> be accessed. BUT I have yet to find any way to pass the information.
> 
> Can anybody kick me in the right direction, or do I have to stick with a 
> drop down list in the logon box and expect everybody to know where they 
> are?
> 
> Surely VOIP is going to run into this problem soon isn't it? (Not that I 
> can see how TS can actually handle the microphone and camera anyway ;) )
> 
> -- 
> Lester Caine
> -
> L.S.Caine Electronic Services
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

[PHP] Incorrect trans-sid placement in PHP Version 4.3.6

2004-08-09 Thread Torsten Scheck
Hi,
I just stumbled over a problem after I had updated PHP, and I thought I
should share my experience:
I use PHP Version 4.3.6 with '--enable-trans-sid' and deactivated cookies:
session.use_cookies Off
session.use_trans_sid On
And when I use PHP's session feature together with an empty XML tag, PHP
places the Session-ID in the wrong place, if there is no blank space
behind the attribute:

=>

NOT WORKING

=>

WORKING
(BTW: The blank space is optional according to XHTML specs.)
I hope this message helps you to avoid the kind of trouble I had.
See attached test case for further testing and bug fixing.
The php version I use is too old for the bug system. If you encounter
the same bug in a higher version, please report it. Thanks.
Torsten


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] safe_mode restriction

2004-08-09 Thread Jason Wong
On Sunday 08 August 2004 17:30, Kevin wrote:

> > please show us the output of 'ls -al' of the directories in question.
>
> Yes, I have seen the permission and its rwx-rwx-rwx i.e 777.

The full output showing the owner.group would have been nice. Anyway:

> Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is
> 10029 is not allowed to access
> /home/httpd/vhosts/***../httpdocs/w4/full1/1 owned by uid 48 in
> /home/httpd/***../httpdocs/w4/dir.php on line 23

is pretty explicit your uid (10029) is not allowed access to the directories 
created by the webserver's uid (48).

The usual workaround is to use the ftp functions to create your directories.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Don't worry.  Life's too long.
-- Vincent Sardi, Jr.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Flush()....go to bottom of page (might be 0T)

2004-08-09 Thread Ford, Mike [LSS]
On 07 August 2004 23:24, PHP Gen wrote:

> This is what i am using:
> 
> for($i=0; $i<1000;$i++)
> {
> echo "something";
> echo str_repeat(" ", 256);   flush();   ob_flush();
> sleep(1);
> }

Regardless of solving your scrolling problem, these flush calls are the
wrong way round -- ob_flush() flushes to the layer which is flushed by
flush(), so you should be doing

ob_flush(); flush();

to get an immediate flush of the thing just echoed.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Local version works - production breaks

2004-08-09 Thread Ford, Mike [LSS]
On 08 August 2004 14:20, Josh Acecool M wrote:

> Try adding
> if (!function_exists("function_name")) {
> function function_name ($blah) {
> // Function Code
> }
> }
> for each function.

As I understand it, that will *not* work in PHP 5 as it still parses the entire file, 
barfing on the duplicate function definition, before even attempting to evaluate the 
if() at the top of the file.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] annoying autoreplies

2004-08-09 Thread Ford, Mike [LSS]
On 08 August 2004 03:25, Robby Russell wrote:

> To all those who have auto-replys set for their email, please
> turn them
> off. ;-)

If you're referring to SpamCease, it seems that these are, on the whole, not
genuine auto-replies but are themselves from a spam email address harvester
masquerading as a spam-blocker and using faked From: addresses.  Ignore them
or set up a rule to junk them.

(Although there does seem to be a genuine SpamCease challenge-response
spam-blocker, all of the emails I've seen here are clearly fakes and not the
genuine thing.)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: GD/PHP question

2004-08-09 Thread Kevin
This might be helpful to you.

http://in2.php.net/manual/en/function.imagecopymerge.php

Kevin.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] I CANT POST

2004-08-09 Thread Alfonso Baqueiro
Is there a manual of how tu use a mailing list for the newcomers?
Is not so obvious as could be.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] locate PID & Kill

2004-08-09 Thread Curlys
it doesn't work , when it is running , errors r bellow

sh: line 1: kill: r: invalid signal specification

plz help

- Original Message - 
From: "Matthew Runo" <[EMAIL PROTECTED]>
To: "Curlys" <[EMAIL PROTECTED]>
Cc: "PHP" <[EMAIL PROTECTED]>
Sent: Monday, August 09, 2004 12:38 PM
Subject: Re: [PHP] locate PID & Kill


> You could do something like this..
> 
> $cmd = "kill -r HUP /var/run/abc.pl.pid";
> exec($cmd);
> 
> That should kill it and then restart it. You'll need to change 
> /var/run/abc.pl.pid to fit into your system, but the idea of that line 
> is to allow the script to get the proper PID, even if it's not what you 
> expect.
> 
> I'm not sure if you'd be able to restart it with a given PID.
> 
> Matthew Runo
> http://www.quabbo.com
> Quabbo Internet Services
> The only host with the Zend Performance Suite!
> 
> On Aug 8, 2004, at 11:25 PM, Curlys wrote:
> 
> > pe -ef
> >
> > * 19282 pts/300:00:00 abc.pl
> >
> > my perl script is abc.pl.  It's PID is 19282
> >
> > Can somebody help me to do the php scripting to
> >
> > 1.Locate  that PID
> > 2.kill the script
> > 3.start that script with the same PID .
> >
> > plz help , i'm highly appreciate ur help
> >
> > thank u
> > curlys
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: I CANT POST

2004-08-09 Thread Alfonso Baqueiro
Alfonso Baqueiro wrote:
> Is there a manual of how tu use a mailing list for the newcomers?
> Is not so obvious as could be.
I supose the steps required to post are:
1. Request registering via the http://www.php.net/mailing-lists.php
2. Reply the message recibed acording to its instructions.
	(This step is required for php servers acept your messages, ensuring 
you are a real person.)

3. Another message of welcome is recibed.
4. To post send a normal mail to the list ej. 
mailto:[EMAIL PROTECTED]
	Tip: In the mozilla mail and news client, when you try to reply a 
message or to send, it try to send only to php.general, omiting 
@lists.php.net, so probably the message is not sended.

5. See how magically your post appear in the mailing list.
CODE 1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: I CANT POST

2004-08-09 Thread Alfonso Baqueiro
Correction, Mozilla reply works fine, with php.general only.
Alfonso Baqueiro wrote:
Alfonso Baqueiro wrote:
 > Is there a manual of how tu use a mailing list for the newcomers?
 > Is not so obvious as could be.
I supose the steps required to post are:
1. Request registering via the http://www.php.net/mailing-lists.php
2. Reply the message recibed acording to its instructions.
(This step is required for php servers acept your messages, ensuring 
you are a real person.)

3. Another message of welcome is recibed.
4. To post send a normal mail to the list ej. 
mailto:[EMAIL PROTECTED]
Tip: In the mozilla mail and news client, when you try to reply a 
message or to send, it try to send only to php.general, omiting 
@lists.php.net, so probably the message is not sended.

5. See how magically your post appear in the mailing list.
CODE 1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Getting data from table as a tree

2004-08-09 Thread pt2002
Hi Brian
I was almost, almost, almost there :) but I was missing a bit of the logic.

Thank you very much. You solve my present and future problems.

Greetings
pt2002


"Brian Kell" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
> Well, first off, a little bit of formatting (line numbers added for
> clarity):
>
>   1 $tpl->assign("tree",
>   2 array(
>   3 "element" => array(
>   4 array(
>   5 "name" => "test1",
>   6 "element" => array(
>   7 array(
>   8 "name" => "test1.1"
>   9 ),
> 10 array(
> 11 "name" => "test1.2",
> 12 "element" => array(
> 13 array(
> 14 "name" => "test1.2.1"
> 15 ),
> 16 array(
> 17 "name"  => "test1.2.2"
> 18 )
> 19 )
> 20 )
> 21 )
> 22 )
> 23 )
> 24 )
> 25 );
>
> It appears that each node is represented as an array. This array contains
> a "name" and, if the node has any children, another array called "element"
> that contains the child nodes. In addition, the root node is an element of
> some "superroot", which is the array starting on line 2. (So if you want
> to have multiple trees, you can; just define multiple nodes with a pid of
> 0.)
>
> I think the following functions should do approximately what you want. I'm
> assuming MySQL here, since that's what I'm used to. If you're not using
> MySQL, you should be able to adapt this to your database easily enough.
>
> function build_tree() {
>  $subtree = build_subtree(0);
>  if ($subtree !== NULL)
>  return array("element => $subtree);
>  else
>  return NULL;
> }
>
> function build_subtree($pid) {
>  $result = mysql_query("SELECT id, name FROM tbl WHERE pid='$pid'");
>  if (!$result)
>  die("Can't query for pid $pid: ".mysql_error());
>  if (mysql_num_rows($result)) {
>  $subtree = array();
>  while ($row = mysql_fetch_assoc($result)) {
>  $node = array();
>  $node['name'] = $row['name'];
>  $element = build_subtree($row['id']);
>  if ($element !== NULL)
>  $node['element'] = $element;
>  array_push($subtree, $node);
>  }
>  return $subtree;
>  } else
>  return NULL;
> }
>
> Be careful with this, because I didn't actually test this at all. Run it
> on a few test cases and make sure it gives you what you want.
>
> Brian

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] locate PID & Kill

2004-08-09 Thread Jason Wong
On Monday 09 August 2004 19:00, Curlys wrote:

> it doesn't work , when it is running , errors r bellow
>
> sh: line 1: kill: r: invalid signal specification

Well specify a VALID signal then. This is not a PHP problem.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A rolling disk gathers no MOS.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP]

2004-08-09 Thread hino masako
@lists.php.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] GENERAL DIGEST MAILLIST ALLOWS POST

2004-08-09 Thread Alfonso Baqueiro
If you are viewing this, means that been suscribed only to the 
general-digest, you are able to post.

This is very useful for mozilla clients, cause you have mozilla to see 
the message list for new messages without the inconvenience of recieving 
a lot of mail daily.

:)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] base64_decode an image, works on blank page, not on page where text is..

2004-08-09 Thread Josh Acecool M
If I try to base64_decode an image which was encoded with base64_encode on a
blank page, it works, if I try on a page with stuff already on it, it just
shows me the source code to the image...

Example: Run this code as a blank page, no spaces before or after the 


PS: phpBB2 somehow got it to work, not sure how though :-/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XSLT select syntax

2004-08-09 Thread Pasha Zubkov
Hi,
In php5.0.0 I can use next select syntax:

but in php5.1.0-dev I see this warning

Warning: XSLTProcessor::transformToDoc() [function.transformToDoc]: Invalid type in
/mnt/data/www/html/web/Includes/Theme.php on line 117
Warning: XSLTProcessor::transformToDoc() [function.transformToDoc]: runtime error: file
/mnt/data/www/html/linux.grodno.by/web/Themes/FreeWay/Templates/Modules/module.xsl 
line 22 element
variable in /mnt/data/www/html/web/Includes/Theme.php on line 117
Warning: XSLTProcessor::transformToDoc() [function.transformToDoc]: Evaluating global 
variable being
computed ... failed in /mnt/data/www/html/web/Includes/Theme.php on line 117

Menu::createXML() static method, returns XML document... in php5.0 all work fine,
but in 5.1.0-dev dasn't. How i can do this in php5.1... or it's a bug?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread Curt Zirzow
* Thus wrote Gambler ZG:
> >what do you mean by that?
> 
> Nothing. The statement was based on the erroneous assumption that 
> anonimous functions allow to go into HTML mode with '?>'. But this will 
> not stop me, for there is eval()! The general idea is simple - to use 
> some file's code multiple times without re-reading the file and 
> re-parsing its content. So...
> 
> $file = "some/script.php";
> $handle = fopen($file, "r");
> $script = fread($handle, filesize($file));
> $script = 'function use_cached_code(){
> ?>'.$script.' }';
> eval($script);

Here is a better way to create a dynamaic function:

  $use_cache_code = create_function('', $script);
  $use_cache_code();


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] no select()-function?

2004-08-09 Thread Marten Lehmann
Hello,
I'm missing the select-function in PHP. It's a low-level function call 
to the same-called C-function and also available in Perl. I need this 
for nonblocking socket calls. Which function within PHP do I have to use 
instead?

Regards
Marten Lehmann
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] complex array and smarty

2004-08-09 Thread John W. Holmes
From: "adwinwijaya" <[EMAIL PROTECTED]>
> Assume I have array that looks like :
>
> Array(
> 'type'->'Fiction',
> 'notes'->'Fiction books from a-z',
> 'list'-> Array(
>  'list'->  [0]->array(
>   'title'->'xzy',
>   'id'->'1')
>[1]->array(
>   'title'->'abcd',
>   'id'->'2')
>)
> )
>
> Now, I want to display it using smarty os it looks like
>
> ---
> Books Result:
> 
> 1. Type: Fiction
>Notes: bla bla bla bla
>--
>ID |   Title
>--
>1  | xzy
>2  | abcd
>--
> 2. Type: Non-Fiction
>Notes: bla bla bla bla
>--
>ID |   Title
>--
>3  | ABCDEFEGH
>4  | LALALALLA
>--
> can I do like that with smarty ? and how to do that ?
> I knew to use array, but for this array, I dont know how to do that

You need to come up with a better way to format that array based on how you
want to display it. You can then use {foreach}

http://smarty.php.net/manual/en/language.function.foreach.php

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Working with a new design client

2004-08-09 Thread charles kline
Hi all,
I have a new client (a design company). They have never developed a 
dynamic website at all and do all their HTML editing using Dreamweaver.

When I build sites, I am used to using a class for pages. Many of the 
pages in this site are totally static except for a few elements (Bread 
Crumb, Nav Bar, etc.). So I am not sure if this method is the best way 
to go...

My big concern is that I am going to totally screw them up if they want 
to edit some details on a page, they are going to have to go in and 
mess with the HTML that gets passed to the drawPage() function. Maybe 
there is a better way to handle this?

I have never used Smarty, which I understand might be a big help in 
these situations. One concern of mine is that I have a tight budget on 
this project and don't want to spend a lot of time learning a new 
system unless I have to.

Thanks for any advice,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] no select()-function?

2004-08-09 Thread Robby Russell
On Mon, 2004-08-09 at 07:35, Marten Lehmann wrote:
> Hello,
> 
> I'm missing the select-function in PHP. It's a low-level function call 
> to the same-called C-function and also available in Perl. I need this 
> for nonblocking socket calls. Which function within PHP do I have to use 
> instead?
> 
> Regards
> Marten Lehmann

Try this?

http://us4.php.net/manual/en/function.socket-select.php

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working with a new design client

2004-08-09 Thread John W. Holmes
From: "charles kline" <[EMAIL PROTECTED]>

> I have never used Smarty, which I understand might be a big help in
> these situations. One concern of mine is that I have a tight budget on
> this project and don't want to spend a lot of time learning a new
> system unless I have to.

Smarty is one solution, but the concept you need to employ is separating
your display (mainly HTML) from your business logic (the PHP classes). Make
them separate files and then they only edit the templates and don't touch
your PHP code. You can make them plain HTML pages and just include() them,
read them and eval() them, or use any templating solution. It's going to be
the best way to do this.

Probably telling you what you already know, but it sounded like you just
needed to be told it! ;)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working with a new design client

2004-08-09 Thread Robby Russell
On Mon, 2004-08-09 at 07:58, charles kline wrote:
> Hi all,
> 
> I have a new client (a design company). They have never developed a 
> dynamic website at all and do all their HTML editing using Dreamweaver.
> 

Are opposed to using something different for their general HTML editing?

You might be able to convinced them that if they used something like
http://kupu.oscom.org/ that they could be anywhere and modify their
site...then you just store the data in a db..and if you use something
like Smarty, their site will be pretty flexible.

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] LDAP Group query examples?

2004-08-09 Thread Sam Evans
Hello..

I am wondering if someone could point me in the general direction of
some examples which show how to query an LDAP group for user
membership?

Thanks,
Sam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Session problems under heavy load???

2004-08-09 Thread BOOT
Thanks for the replies. For those who mentioned load balancing I am using my
own server so that is not an issue. Loads should typically not hit what they
did while the raid array was rebuilding, however this does seem a little
alarming from a security standpoint! How do security conscious sites deal
with the potential threat of site compromise by overloading a server? In my
case the session variables I am using must be set in order to access certain
pages etc. so in the case where they are lost, access is denied, however I
am sure there are some parts of code where I have not accounted for the
possibility that a variable does not exist!







"Boot" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> My server was under a heavy load (rebuilding software raid 1 array) and my
> PHP+MySQL site seemed to be all "messed up." From what I can makeout
session
> variables were being lost. I would expect simply degraded performance but
> not the loss of variables. Is this normal? LOL the array is still
rebuilding
> right now and the alternative problem means something happened to my code
> (yes I have backups :))
>
> Thanks for any comments!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: [Q] How to setup Dreamweaver so that PHP scripts are executed?

2004-08-09 Thread Jonathan Haddad
And if you want to be really extreme, you can edit httpd.conf to use 
virtual hosting and recognize each of the sites you have as individual 
web servers.

Then, edit your hosts file to match the domains.. say I am working on my 
own web site, oldirtyhaddad.com (shameless plug).  I have set up my 
hosts file to recognize oldirtyhaddad and it gets served up locally.  I 
have one of these for each of the 20 sites that I maintain.  I also have 
this set up for phpMyAdmin.  (accessed by typing dbadmin).

Jon
Chris Martin wrote:
Michael T. Peterson wrote:
Hi,
I know this must be really obvious to many of you, but I have been 
unable to
configure DW (using [preferences] or [site->edit]) so that it will 
execute a
php script from a  tag.  When the submit 
button is
clicked the php file is displayed, rather than executed.

Here's the HTML code of the submit button form:

 
  Select interval
  2 days
  4 days
  8 days
  31 days
  
 

When the [Update Database] button is clicked, the file specified by the
action parameter is displayed, rather than executed.
My dev machine is a Windows XP system with Apache, PHP, and MySQL 
installed.
I have confirmed that my Apache-PHP configuration is correctly 
configured.
For example,  PHP correctly executes the script when I pass
"update_river_measurements.php" to IExplore.exe from the command 
line. Also,
when I upload these local files to my ISP, the PHP also executes 
correctly.

Any suggestions as to how to get DW to execute these files would be
appreciated.
Cheers,
Michael
P.S. Cross-posted to the DreamWeaver news group
I'm not sure that dreamweaver will execute them.
If you've got Apache/PHP setup, just go to 
http://localhost/your_script.php in your browser to test them out, no 
need to use the command line to pass to a browser.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] MAIL function sends as anonymouse@mydomain.com instead of what I specify in php.ini?

2004-08-09 Thread BOOT
I am sure that this is a problem with my MTA configuration not PHP itself,
but any help would be appreciated.

PHP is set to use sendmail (although I understand that my server may be
using qmail and not really sendmail?)

It seems that whatever SMPT settings I place in php.ini ignores. (SMTP
servername, FROM) and all e-mail is sent from [EMAIL PROTECTED]

Thanks for any help!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MAIL function sends as anonymouse@mydomain.com instead of what I specify in php.ini?

2004-08-09 Thread Robby Russell
On Mon, 2004-08-09 at 08:56, BOOT wrote:
> I am sure that this is a problem with my MTA configuration not PHP itself,
> but any help would be appreciated.
> 
> PHP is set to use sendmail (although I understand that my server may be
> using qmail and not really sendmail?)
> 
> It seems that whatever SMPT settings I place in php.ini ignores. (SMTP
> servername, FROM) and all e-mail is sent from [EMAIL PROTECTED]
> 
> Thanks for any help!

What does your mail() command look like?

-Robby
-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Incorrect trans-sid placement in PHP Version 4.3.6

2004-08-09 Thread Justin Patrin
On Mon, 09 Aug 2004 10:02:23 +0200, Torsten Scheck
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I just stumbled over a problem after I had updated PHP, and I thought I
> should share my experience:
> 
> I use PHP Version 4.3.6 with '--enable-trans-sid' and deactivated cookies:
> session.use_cookies Off
> session.use_trans_sid On
> 
> And when I use PHP's session feature together with an empty XML tag, PHP
> places the Session-ID in the wrong place, if there is no blank space
> behind the attribute:
> 
> 
> =>
> 
> NOT WORKING
> 
> 
> =>
> 
> WORKING
> 
> (BTW: The blank space is optional according to XHTML specs.)
> 
> I hope this message helps you to avoid the kind of trouble I had.
> 
> See attached test case for further testing and bug fixing.
> 
> The php version I use is too old for the bug system. If you encounter
> the same bug in a higher version, please report it. Thanks.
> 
> Torsten
> 

Why did you update to an older version of PHP?

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SQL Join query

2004-08-09 Thread Jonathan Haddad
The only problem there is when you group the LEFT JOIN pictures that 
have a count of 0 return a count of 1.  Unfortunately there's no single 
query that I figured out when I did this same project that would give 
accurate results.

John Holmes wrote:
Mattias Jönsson wrote:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics, 
pic_comments WHERE pics.category = 1 AND pics.id = 
pic_comments.pic_id GROUP BY pic_comments.pic_id;
[snip]
The problem is that i only get the the pictures that have comments, i 
want even the pictures where there arent no comments and the field 
num_comments should be 0.

Need a LEFT JOIN
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics LEFT 
JOIN pic_comments on pics.id = pic_comments.pic_id WHERE pics.category 
= 1 GROUP BY pic_comments.pic_id

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] WYSIWyG

2004-08-09 Thread Matthew Sims
> Matthew Sims wrote:
>
>>And how does this relate to PHP??
>>
>>
>>
> Matthew,
> you are now sure to be flamed by all those who believe off topic
> maililngs by those who do not read the newby guide should be allowed and
> encouraged.
>
>
>
>
> --
> Raditha Dissanayake.

Well dammit all. I was hoping to avoid any sun burns this week.

-- 
--Matthew Sims
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] base64_decode an image, works on blank page, not on page where text is..

2004-08-09 Thread Justin Patrin
On Mon, 9 Aug 2004 14:23:22 -0700, Josh Acecool M
<[EMAIL PROTECTED]> wrote:
> If I try to base64_decode an image which was encoded with base64_encode on a
> blank page, it works, if I try on a page with stuff already on it, it just
> shows me the source code to the image...
> 
> Example: Run this code as a blank page, no spaces before or after the  then run it again with a space or a character..
> 
> Any ideas how to fix it?
> Thanks.
> 
>  if (!function_exists("ac_call_base64_image")) {
> function ac_call_base64_image ($Image) {
> //require ("./ACWB/ACWB_Base64_Images.php");
> //$Image = $ACWB_B64I[$Image];
> return base64_decode($Image);
> }
> }
> // RedX Image...
> $ACWB_B64I['ACWB'] =
> "R0lGODlhHAAeAKIAAP8AAP///8DAwICAgP///wAAACH5BAEAAAUALAAcAB4AAAO
> COLrc7mGUSau9NuL  Np+5g9YXhSHbmuaXF81zsEMx0HQgELFmybeO6S89HA2Z2lSHxl
> jsKaQDALDozipAUZZRabV6fNW43yAtvi15KDCoNcK1q7ERJhHv
> krSWanNSPnWV+dgUxAoaHiIZpdxcEjo+QkHwqK3iUX5eVmZqbk  50efqFECQA7";
> echo ac_call_base64_image ($ACWB_B64I['ACWB']);
> ?>
> 
> PS: phpBB2 somehow got it to work, not sure how though :-/
> 

You can't display an image inline. At least, not quite like that. You
*can* use a special img tag with mozilla to display inline, but this
isn't very well supported. Use an img tag to link to another script
and have that script base64_decode the image and display it (with the
correct headers).

> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Access CLIENTNAME

2004-08-09 Thread Scot L. Harris
On Mon, 2004-08-09 at 03:16, Lester Caine wrote:
> At the risk of getting my head bitten off I ask this again, as I am not 
> getting any help anywhere.
> 
> I'm running a PHP system that relies on knowing the location of the 
> terminal to handle a lot of '911' (999) type things. I know that 
> REMOTE_ADDR can not be relied on, but with fixed IP addresses on a local 
> network it works fine. However I now have a customer who has a Terminal 
> Server thin client network, and REMOTE_ADDR only reports the server 
> address. In order to restore the facilities I need to gain access to the 
> CLIENTNAME environmental variable from the browser and return it to PHP.
> 
> I've already got the simple bodge - they type it on on login - which is 
> simply a joke when coming to use the system. I have a TS logon batch 
> file which copies the CLIENTNAME variable to a file from which it could 
> be accessed. BUT I have yet to find any way to pass the information.
> 
> Can anybody kick me in the right direction, or do I have to stick with a 
> drop down list in the logon box and expect everybody to know where they 
> are?
> 
> Surely VOIP is going to run into this problem soon isn't it? (Not that I 
> can see how TS can actually handle the microphone and camera anyway ;) )
> 
> -- 
> Lester Caine
> -
> L.S.Caine Electronic Services

This won't work?

function get_ip() {
   if (isSet($_SERVER)) {
   if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
   $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
   } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
   $realip = $_SERVER["HTTP_CLIENT_IP"];
   } else {
   $realip = $_SERVER["REMOTE_ADDR"];
   }
   } else {
   if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
   $realip = getenv( 'HTTP_X_FORWARDED_FOR' );
   } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
   $realip = getenv( 'HTTP_CLIENT_IP' );
   } else {
   $realip = getenv( 'REMOTE_ADDR' );
   }
   }
   return $realip;
}

-- 
Scot L. Harris <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] MAIL function sends as anonymouse@mydomain.com instead of what I specify in php.ini?

2004-08-09 Thread Jason Wong
On Monday 09 August 2004 23:56, BOOT wrote:

> I am sure that this is a problem with my MTA configuration not PHP itself,
> but any help would be appreciated.
>
> PHP is set to use sendmail (although I understand that my server may be
> using qmail and not really sendmail?)

Makes no practical difference, works just fine.

> It seems that whatever SMPT settings I place in php.ini ignores. (SMTP
> servername, FROM) and all e-mail is sent from [EMAIL PROTECTED]

You obviously didn't RTFM, those particular settings are for Windows systems 
and are not applicable to un*x systems which you seem to be using (since you 
mention qmail). See examples in manual on how to set the FROM header in un*x 
systems.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Alea iacta est.
[The die is cast]
-- Gaius Julius Caesar
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SQL Join query

2004-08-09 Thread Curt Zirzow
* Thus wrote Jonathan Haddad:
> The only problem there is when you group the LEFT JOIN pictures that 
> have a count of 0 return a count of 1.  Unfortunately there's no single 
> query that I figured out when I did this same project that would give 
> accurate results.

SELECT
  pics.*, 
  pic_comments.*, 
  count(*) + if(pic_comments.pic_id = NULL, -1, 0)


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread Justin Patrin
On Mon, 09 Aug 2004 02:11:14 -0400, Gambler ZG <[EMAIL PROTECTED]> wrote:
> > what do you mean by that?
> 
> Nothing. The statement was based on the erroneous assumption that
> anonimous functions allow to go into HTML mode with '?>'. But this will
> not stop me, for there is eval()! The general idea is simple - to use
> some file's code multiple times without re-reading the file and
> re-parsing its content. So...
> 
> $file = "some/script.php";
> $handle = fopen($file, "r");
> $script = fread($handle, filesize($file));
> $script = 'function use_cached_code(){
> ?>'.$script.' }';
> eval($script);
> use_cached_code();

Ick! eval() is evil!

What you want here is a function. Make a function which does what you
need and call it.

function doSomething($val) {
  //This is "re-used" code
  echo '$val = '.$val; 
}

> 
> Ta-dam! Well, I did not actually tested this code, and it's 2:06 AM
> here, so I may be wrong, but theoretically it should work.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Access CLIENTNAME

2004-08-09 Thread Lester Caine
Scot L. Harris wrote:
I'm running a PHP system that relies on knowing the location of the 
terminal to handle a lot of '911' (999) type things. I know that 
REMOTE_ADDR can not be relied on, but with fixed IP addresses on a local 
network it works fine. However I now have a customer who has a Terminal 
Server thin client network, and REMOTE_ADDR only reports the server 
address. In order to restore the facilities I need to gain access to the 
CLIENTNAME environmental variable from the browser and return it to PHP.

This won't work?
function get_ip() {
   if (isSet($_SERVER)) {
   if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
   $realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
   } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
   $realip = $_SERVER["HTTP_CLIENT_IP"];
   } else {
   $realip = $_SERVER["REMOTE_ADDR"];
   }
   } else {
   if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
   $realip = getenv( 'HTTP_X_FORWARDED_FOR' );
   } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
   $realip = getenv( 'HTTP_CLIENT_IP' );
   } else {
   $realip = getenv( 'REMOTE_ADDR' );
   }
   }
   return $realip;
}
No - neither HTTP_X_FORWARDED_FOR or HTTP_CLIENT_IP are returned for any 
browser running on Terminal Server. Just REMOTE_ADDR which is the 
address of the server not the client. Would be nice if HTTP_CLIENT_IP 
COULD be returned, and it would make sense.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] "count" index prevents ldap_add() after ldap_search() directly

2004-08-09 Thread Chris Shenton
I'm doing a bunch of LDAP work with PHP-4.3.6 and keep running up
against this annoyance.   If I do an ldap_search() and get the first
entry, I can't then tweak some of the attribute/values and then
directly use ldap_add() to put a new version into the directory.  The
reason is that the ldap_get_entries() function returns any array or
sub-array with a gratuitous "count" index. 

For example, the following code (error checking removed for clarity):

  $results = ldap_search($ldapConn, $baseDN, "uid=cshenton");
  $entries = ldap_get_entries($ldapConn, $results);
  $entry = $entries[0];
  echo "entry=" . print_r($entry, true) . "";

Prints the following (with some tedious attribute/value pairs removed):

  entry=

  Array
  (
  [cn] => Array
  (
  [count] => 1
  [0] => Chris Shenton-2
  )

  [0] => cn
  [sn] => Array
  (
  [count] => 1
  [0] => Shenton
  )

  [1] => sn
  [objectclass] => Array
  (
  [count] => 2
  [0] => inetOrgPerson
  [1] => qmailUser
  )
  ...
  [count] => 14
  [dn] => cn=Chris Shenton-2,ou=Headquarters,o=National Aeronautics and Space 
Administration,c=us
  )


My code then fiddles with the old DN to create a new entry, then tries
to add it to LDAP:

  if (! ldap_add($ldapConn, $newDN, $entry)) {
die("ldap_add failed, errno=". ldap_errno($ldapConn) . ": " 
. ldap_error($ldapConn));
  }


It fails (but oddly, ldap_error() reports Success).  The problem is
the 'count' and attribute-named indices (e.g., 'sn') in addition to
the numeric indices:

  Warning: ldap_add(): Value array must have consecutive indices 0, 1, ... in 
  /home/cshenton/public_html/newhorseadmin/ldap_search_add_test.php on line 45
  ldap_add failed, errno=0: Success


Am I missing something or is it not possible to simply take a search
result, then add it back?  Seems I have to strip out all these
gratuitous 'count' and non-numeric indices each time, which isn't
intuitive, obvious, or the most direct way of doing things.

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread John W. Holmes
From: "Justin Patrin" <[EMAIL PROTECTED]>
> > eval($script);
> > use_cached_code();
>
> Ick! eval() is evil!

You have benchmarks to back that up or experience?

I did a benchmark between using include(), eval(), smarty, pattemplate, and
a few others and include() and eval() are always the fastest.

Really depends upon what kind of features you need and what you consider
"evil". ;)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Need Some Direction

2004-08-09 Thread Aaron Todd
When you say "outside of the webroot" do you mean.  Can you give me an
example.  The root of my web is in /var/www/html/.  Thats where you are
taken when you punch in my domain.  Currently I have a directory called
/test/ which is protected by .htaccess but it is inder the
webroot.../var/www/html/test/  So far under this config I cant get it to
work, but I'm not sure if I'm still under the webroot in my config.  Do I
need to move my test directory to lets say /var/www/ or even /var/?

Thanks again,

Aaron

"Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Aaron Todd" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I hate to sound ignorant, but how do I get a file out of a .htaccess
> > protected directory without logging in again?  You cant use the normal
> > syntax of http://username:[EMAIL PROTECTED] anymore.  Microsoft "fixed"
that
> > "bug".
> >
> > Thanks,
> >
> > Aaron
>
> Hi Aaron,
>
> because you are accessing a file via PHP from your *local* file system it
> doesn't matter if the directory is protected or outside of the webroot.
PHP
> has access to the file (if read privilege is set). The protection is just
to
> deny public access.
>
> Take a look here:
> http://pear.php.net/manual/en/package.http.http-download.intro.php
>
> Hope this helps, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Need Some Direction

2004-08-09 Thread Jason Davidson
if you have /var/www/html/ defined as documentroot, as you mentioend
then outside is anything outside the directory html/  so /var/www/php/ 
could hold all your php files, and be outside the docroot.

JAson
"Aaron Todd" <[EMAIL PROTECTED]> wrote: 
> 
> When you say "outside of the webroot" do you mean.  Can you give me an
> example.  The root of my web is in /var/www/html/.  Thats where you are
> taken when you punch in my domain.  Currently I have a directory called
> /test/ which is protected by .htaccess but it is inder the
> webroot.../var/www/html/test/  So far under this config I cant get it to
> work, but I'm not sure if I'm still under the webroot in my config.  Do I
> need to move my test directory to lets say /var/www/ or even /var/?
> 
> Thanks again,
> 
> Aaron
> 
> "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > "Aaron Todd" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I hate to sound ignorant, but how do I get a file out of a .htaccess
> > > protected directory without logging in again?  You cant use the normal
> > > syntax of http://username:[EMAIL PROTECTED] anymore.  Microsoft "fixed"
> that
> > > "bug".
> > >
> > > Thanks,
> > >
> > > Aaron
> >
> > Hi Aaron,
> >
> > because you are accessing a file via PHP from your *local* file system it
> > doesn't matter if the directory is protected or outside of the webroot.
> PHP
> > has access to the file (if read privilege is set). The protection is just
> to
> > deny public access.
> >
> > Take a look here:
> > http://pear.php.net/manual/en/package.http.http-download.intro.php
> >
> > Hope this helps, Torsten
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Need Some Direction

2004-08-09 Thread Jason Wong
On Tuesday 10 August 2004 03:29, Aaron Todd wrote:
> When you say "outside of the webroot" do you mean.  Can you give me an
> example.  The root of my web is in /var/www/html/.  Thats where you are
> taken when you punch in my domain.  Currently I have a directory called
> /test/ which is protected by .htaccess but it is inder the
> webroot.../var/www/html/test/  So far under this config I cant get it to
> work, but I'm not sure if I'm still under the webroot in my config.  Do I
> need to move my test directory to lets say /var/www/ or even /var/?

Anywhere that's not inside /var/www/html will do, and as long as the webserver 
has access to it.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
May's Law:
The quality of correlation is inversly proportional to the density
of control.  (The fewer the data points, the smoother the curves.)
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread Curt Zirzow
* Thus wrote John W. Holmes:
> From: "Justin Patrin" <[EMAIL PROTECTED]>
> > > eval($script);
> > > use_cached_code();
> >
> > Ick! eval() is evil!
> 
> You have benchmarks to back that up or experience?
> 
> I did a benchmark between using include(), eval(), smarty, pattemplate, and
> a few others and include() and eval() are always the fastest.

you should add the create_function, aproach i used, in that
benchmark; I've never tested it but i think it'll probably beat
both in a tight looping situation :)

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Working with a new design client

2004-08-09 Thread Scott Hyndman
I would kill myself if I ever had to use a web-based app to design a
site. Gross!

(sorry I sent it to just you, I still haven't got used to this thing)

-Original Message-
From: Robby Russell [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 09, 2004 11:15 AM
To: charles kline
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Working with a new design client

On Mon, 2004-08-09 at 07:58, charles kline wrote:
> Hi all,
> 
> I have a new client (a design company). They have never developed a 
> dynamic website at all and do all their HTML editing using
Dreamweaver.
> 

Are opposed to using something different for their general HTML editing?

You might be able to convinced them that if they used something like
http://kupu.oscom.org/ that they could be anywhere and modify their
site...then you just store the data in a db..and if you use something
like Smarty, their site will be pretty flexible.

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Working with a new design client

2004-08-09 Thread Robby Russell
heh, think you missed the point. It's not for designing the site, it's
for your clients who don't know HTML markup and can edit their pages. 

-Robby


On Mon, 2004-08-09 at 13:16, Scott Hyndman wrote:
> I would kill myself if I ever had to use a web-based app to design a
> site. Gross!
> 
> (sorry I sent it to just you, I still haven't got used to this thing)
> 
> -Original Message-
> From: Robby Russell [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 09, 2004 11:15 AM
> To: charles kline
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Working with a new design client
> 
> On Mon, 2004-08-09 at 07:58, charles kline wrote:
> > Hi all,
> > 
> > I have a new client (a design company). They have never developed a 
> > dynamic website at all and do all their HTML editing using
> Dreamweaver.
> > 
> 
> Are opposed to using something different for their general HTML editing?
> 
> You might be able to convinced them that if they used something like
> http://kupu.oscom.org/ that they could be anywhere and modify their
> site...then you just store the data in a db..and if you use something
> like Smarty, their site will be pretty flexible.
> 
> -Robby
> 
> 
> -- 
> /***
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON  | www.planetargon.com
> * Portland, OR  | [EMAIL PROTECTED]
> * 503.351.4730  | blog.planetargon.com
> * PHP/PostgreSQL Hosting & Development
> /
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 4 equivalent for convert_uuencode

2004-08-09 Thread Vidyut Luther
Hello,
 I'm looking at the PHP manual which has http://us3.php.net/convert_uuencode
convert_uuencode as a function, but it's only a PHP 5 function. Is
there a PHP 4 equivalent for this function ?.

Really appreciate any help on this.

-- 
Vidyut Luther

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread Justin Patrin
On Mon, 9 Aug 2004 15:14:57 -0400, John W. Holmes
<[EMAIL PROTECTED]> wrote:
> From: "Justin Patrin" <[EMAIL PROTECTED]>
> > > eval($script);
> > > use_cached_code();
> >
> > Ick! eval() is evil!
> 
> You have benchmarks to back that up or experience?
> 

Well, I didn't mean speed-wise necessarily, although it means more
parsing. Much better to use a *function* which is parsed once than
include()ing or eval()ing the same code over and over to (possibly) be
re-parsed. It just makes more sense code structure-wise as well.

> I did a benchmark between using include(), eval(), smarty, pattemplate, and
> a few others and include() and eval() are always the fastest.
> 
> Really depends upon what kind of features you need and what you consider
> "evil". ;)

By evil I mean that it's used for the wrong purposes much of the time.
People aren't aware of the capabilities of the language or are simply
ignorant of good coding style and use eval because it's easy. Heck, I
used eval before I knew how to use $$ and arrays effectively. Here's a
quote that really says it well:

If eval() is the answer, you're almost certainly asking the wrong question.
-- Rasmus Lerdorf, BDFL of PHP

> 
> ---John Holmes...
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP/MySQL based webmail?

2004-08-09 Thread Alex Shi
Hi All,

Can any one recommend a strong/stable PHP/MySQL based web 
mail system? It must support large mail transfer, some times may be 
more than 10 MB for a single message.

Alex

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP/MySQL based webmail?

2004-08-09 Thread Robby Russell
On Mon, 2004-08-09 at 14:28, Alex Shi wrote:
> Hi All,
> 
> Can any one recommend a strong/stable PHP/MySQL based web 
> mail system? It must support large mail transfer, some times may be 
> more than 10 MB for a single message.
> 
> Alex

The message size limit is controlled by your mailer. (postfix, sendmail,
qmail, etc).

Squirrelmail is a nice php-based interface.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP/MySQL based webmail?

2004-08-09 Thread Matthew Sims
> On Mon, 2004-08-09 at 14:28, Alex Shi wrote:
>> Hi All,
>>
>> Can any one recommend a strong/stable PHP/MySQL based web
>> mail system? It must support large mail transfer, some times may be
>> more than 10 MB for a single message.
>>
>> Alex
>
> The message size limit is controlled by your mailer. (postfix, sendmail,
> qmail, etc).
>
> Squirrelmail is a nice php-based interface.
>
> -Robby

I second that. Squirrelmail is solid. And the plugin features is great.

-- 
--Matthew Sims
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP/MySQL based webmail?

2004-08-09 Thread Hardik Doshi
I strongly recommend Horde web mail. We are currently
using it in our institute and it scales better.

Thanks,
Hardik
 
--- Matthew Sims <[EMAIL PROTECTED]> wrote:

> > On Mon, 2004-08-09 at 14:28, Alex Shi wrote:
> >> Hi All,
> >>
> >> Can any one recommend a strong/stable PHP/MySQL
> based web
> >> mail system? It must support large mail transfer,
> some times may be
> >> more than 10 MB for a single message.
> >>
> >> Alex
> >
> > The message size limit is controlled by your
> mailer. (postfix, sendmail,
> > qmail, etc).
> >
> > Squirrelmail is a nice php-based interface.
> >
> > -Robby
> 
> I second that. Squirrelmail is solid. And the plugin
> features is great.
> 
> -- 
> --Matthew Sims
> --
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 




__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to configure sessions

2004-08-09 Thread Naty
Hi !!!
I'm new with php, I just install php and apache, I test with info.php and
all
it's working.
Now I'm trying to install a thirds party webapp that seams to have problems
with sessions, I received a warning error like

"Warning: Cannot modify header information - headers already sent by (output
started at C:\Program Files\Apache
Group\Apache2\htdocs\webappphp\index.php:3) in C:\Program Files\Apache
Group\Apache2\htdocs\webappphp\functions.php on line 26

Warning: Unknown:
open(/C:/php/sessions/\sess_452f0a7e4f766da1ecc65a4eca8d9cb8, O_RDWR)
failed: Invalid argument (22) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that
the current setting of session.save_path is correct (N;/C:/php/sessions/) in
Unknown on line 0"

In the php.ini I have
  session.save_path = "N;/C:/php/sessions/"

Maybe somebody can help me!
Regards

Naty

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to configure sessions

2004-08-09 Thread Naty
Hi !!!
I'm new in php, I just install php and apache, i test with info.php and all
it's working.
Now I'm trying to install a thirds party webapp and seams to have problems
with sessions, I receive a warning error like

"Warning: Cannot modify header information - headers already sent by (output
started at C:\Program Files\Apache
Group\Apache2\htdocs\webappphp\index.php:3) in C:\Program Files\Apache
Group\Apache2\htdocs\webappphp\functions.php on line 26

Warning: Unknown:
open(/C:/php/sessions/\sess_452f0a7e4f766da1ecc65a4eca8d9cb8, O_RDWR)
failed: Invalid argument (22) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that
the current setting of session.save_path is correct (N;/C:/php/sessions/) in
Unknown on line 0"

In the php.ini I have
  session.save_path = "N;/C:/php/sessions/"

Maybe somebody can help me!
Regards

Naty

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to configure sessions

2004-08-09 Thread Justin Patrin
Please don't send the same message twice.

Response below.

On Mon, 9 Aug 2004 20:32:12 -0300, Naty <[EMAIL PROTECTED]> wrote:
> Hi !!!
> I'm new with php, I just install php and apache, I test with info.php and
> all
> it's working.
> Now I'm trying to install a thirds party webapp that seams to have problems
> with sessions, I received a warning error like
> 
> "Warning: Cannot modify header information - headers already sent by (output
> started at C:\Program Files\Apache
> Group\Apache2\htdocs\webappphp\index.php:3) in C:\Program Files\Apache
> Group\Apache2\htdocs\webappphp\functions.php on line 26
> 
> Warning: Unknown:
> open(/C:/php/sessions/\sess_452f0a7e4f766da1ecc65a4eca8d9cb8, O_RDWR)
> failed: Invalid argument (22) in Unknown on line 0
> 
> Warning: Unknown: Failed to write session data (files). Please verify that
> the current setting of session.save_path is correct (N;/C:/php/sessions/) in
> Unknown on line 0"
> 
> In the php.ini I have
>   session.save_path = "N;/C:/php/sessions/"

Why do you have this in your save_path? this is definately not right. Try:
session.save_path = "C:/php/sessions/"

Make sure that the user that PHP is running as has full access to that
directory and restart Apache. Then try again.

> 
> Maybe somebody can help me!
> Regards
> 
> Naty
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:411806e5291851697419290!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread Gambler ZG
> Much better to use a *function* which is parsed once
> then include()ing or eval()ing the same code over and over to 
(possibly) be
> re-parsed.

//I read file once:
$handle = fopen($fileName, "r");
$script = 'function use_cached_code(){
?>';
$script. = fread($handle, filesize($fileName));
$script. = '
//parse it once:
eval($script);
//and use the code as much as I want:
use_cached_code();
> It just makes more sense code structure-wise as well.
Not in my case, believe me. Otherwise I would not ask about caching.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How PHP handles multiple inclusions of the same file?

2004-08-09 Thread Justin Patrin
On Mon, 09 Aug 2004 20:04:50 -0400, Gambler ZG <[EMAIL PROTECTED]> wrote:
>  > Much better to use a *function* which is parsed once
>  > then include()ing or eval()ing the same code over and over to
> (possibly) be
>  > re-parsed.
> 
> //I read file once:
> $handle = fopen($fileName, "r");
> $script = 'function use_cached_code(){
> ?>';
> $script. = fread($handle, filesize($fileName));
> $script. = ' }';
> 
> //parse it once:
> eval($script);
> 
> //and use the code as much as I want:
> use_cached_code();
> 
>  > It just makes more sense code structure-wise as well.
> 
> Not in my case, believe me. Otherwise I would not ask about caching.

*Maybe* if you *must* use this around *someone else's* code that you
are *not allowed* to change would you use this, but I simply don't
understand why you would do such a thing. You could add the function
name and the bottom part to the file and just include() it. End of
problem.

If this is a "template" that someone else is editing, I would suggest
using a templating system already out there to do the caching and such
for you. This is really a nasty hack. If you want to use PHP-style
syntax, Savant is your friend.

> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SQL Join query

2004-08-09 Thread Mattias Thorslund
(Sorry about all the quoting but I thought it makes sense for clarity - 
Mattias)

Curt Zirzow wrote:
* Thus wrote Lenar Lhmus:
 

Mattias Thorslund wrote:
   

Though, (regardless of SQL database platform) in a case like this, it
MAY be both more straightforward and efficient to use two separate
queries for the pictures and comments, given the one-to-many cardinality
between them.  The above statement causes redundant data to be returned
- it duplicates the pics record for each new comment.  If there are many
large columns in the pics table and many comments to each record there's
a lot of redundant data in a query like that.
 

No, I think you are wrong. There was GROUP BY pics.id so it won't return
duplicate data. And probable overhead is eliminated too I think - DBserver
will optimize and will join data from pic_comments only once for each
unique pics.id.
   

The results will be something like:
id submitter count pic_id comment
1  joe4  1comment1
1  joe4  1comment2
1  joe4  1comment3
1  joe4  1comment4
2  john   0  2NULL
3  jim5  3comment6
3  jim5  3comment7
3  jim5  3comment8
3  jim5  3comment9
3  jim5  3comment10
Exactly. 

To make it REALLY obvious, I'll point out what parts of the data set 
that are redundant by replacing them with stars, using Curt's example above:

id  submitter   count pic_id  comment
1   joe 4 1   comment1
*   *   * *   comment2
*   *   * *   comment3
*   *   * *   comment4
2   john0 2   NULL
3   jim 5 3   comment6
*   *   * *   comment7
*   *   * *   comment8
*   *   * *   comment9
*   *   * *   comment10
The actual table structure from the original poster (an ex-namesake of 
mine*) would result in seven columns with redundant data, i.e. where 
data is needlessly repeated for every picture that has two or more 
comments..  It wouldn't be hard to find worse real-world examples.

pics table:
| id | submitter | time | date | category |
pic_comments table:
| pic_id | comment |
- Mattias Thorslund
(*) My last name used to be Jönsson, too.  Americans just can't 
pronounce it right.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re[2]: [PHP] complex array and smarty

2004-08-09 Thread adwinwijaya
Hello John,
Tuesday, August 10, 2004, 12:35:30 AM, you wrote:

JWH> From: "adwinwijaya" <[EMAIL PROTECTED]>
>> Assume I have array that looks like :
>>
>> Array(
>> 'type'->'Fiction',
>> 'notes'->'Fiction books from a-z',
>> 'list'-> Array(
>>  'list'->  [0]->array(
>>   'title'->'xzy',
>>   'id'->'1')
>>[1]->array(
>>   'title'->'abcd',
>>   'id'->'2')
>>)
>> )
>>
>> Now, I want to display it using smarty os it looks like
>>
>> ---
>> Books Result:
>> 
>> 1. Type: Fiction
>>Notes: bla bla bla bla
>>--
>>ID |   Title
>>--
>>1  | xzy
>>2  | abcd
>>--
>> 2. Type: Non-Fiction
>>Notes: bla bla bla bla
>>--
>>ID |   Title
>>--
>>3  | ABCDEFEGH
>>4  | LALALALLA
>>--
>> can I do like that with smarty ? and how to do that ?
>> I knew to use array, but for this array, I dont know how to do that

JWH> You need to come up with a better way to format that array based on how you
JWH> want to display it. You can then use {foreach}

JWH> http://smarty.php.net/manual/en/language.function.foreach.php
JWH> ---John Holmes...

yeah, I know it already,
I also tried it using section but I dont know how to translate this
code in php into smarty.

$item)
{
  if($key != 'List')
echo $key.' = '.$item ;
  else
  foreach($Books['List'] as $key2=>$item2)
   echo $key2.' = '.$item2 ;
}
?>

I tried like this :

{foreach name=main key=key item=books from=$Books}
{if $books.type != ''}


{$books.type} - {$books.wd_type}


No
Name
Action

{foreach name=inner key=key2 item=listbook from=$books.List}

 {$listbook.id}-  {$listbook.name} 

{/foreach}

{/if}
{/foreach}


-- 
Best regards,
adwin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP5 - OOP Question

2004-08-09 Thread Hardik Doshi
Hello Group,

I would like to know which one is the most appropriate
way to implement the following scenario.

For example, I want to display a products catalogue of
100 products. I do have a base class of product which
contains all the basic property of the product
(Product title, product description, product price
etc)and constructor basically pulls the information
about the product from the DB based on the product
identifier (Primary key). 

Now i have two ways to display catalogue.

1. I can write only one query to pull all 100 products
information and store product information to each
product object (With out passing product id to the
constructor) into the collection and later i iterate
that collection to display product catalogue.
(Advantage: less communication with database server
and disadvantage: memory consumption is higher)

2. I can initiate an individual product object by
passing product id into the constructor and
constructor will pull an individual product
information from the DB and at the same time i can
display it (Disadvantage: Lots of communication with
database server and Advantage: memory consumption is
less) If you think about inheritance then eventually
this approach will have lots of database calls.

Please guide me as i am stuck up which way to go.

Let me know if you need more information.

Thanks,
Hardik



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP5+OpenSSL extension not using args nor proper cnf extensions

2004-08-09 Thread User1001
The "openssl_csr_sign" function forces the use of certificate request
specifications in the 'openssl.cnf' (configuration) file, and completely
ignores the extension sections passed in the "configargs" array.

The (CA) signing functions allow for configuration extensions that are not
defined nor used in generating the certificate request, but
"openssl_csr_sign" does not provide for this, forcing the use of the
request extensions, 

if (req.request_extensions_section) {
X509V3_CTX ctx;

X509V3_set_ctx(&ctx, cert, new_cert, csr, NULL, 0);
X509V3_set_conf_lhash(&ctx, req.req_config);
if (!X509V3_EXT_add_conf(req.req_config, &ctx, 
req.request_extensions_section, new_cert)) {
goto cleanup;
}
}

just before signing the certificate request.


Setting the "configargs" array that the "openssl_csr_sign" function
supposedly provides for the PHP programmer to OVERRIDE definitions in the
OpenSSL configuration file don't appear to be picked up or used:


(debug output from modified openssl.c showing "req_extensions" from "req"
section of configuration file)

req.section_name: req
req.config_filename: /usr/local/ssl/openssl.cnf2
req.digest_name: (null)
req.extensions_section: (null)
req.request_extensions_section: v3_req


(PHP program fragment with "openssl_csr_sign" call)

  $configargs = array("req_extensions" => "ssl_only_IT_server_cert",
"x509_extensions" => "ssl_only_IT_server_cert");
  $usercert = openssl_csr_sign($csr, $cacert, $caprivkey, 365, $configargs);


Using the OpenSSL CA.sh script, modified with desired extension sections,
works just fine in signing a certificate and adding the specific
extensions, which are NOT present in the certificate request.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP5 - OOP Question

2004-08-09 Thread Robert Cummings
On Mon, 2004-08-09 at 22:29, Hardik Doshi wrote:
> Hello Group,
> 
> I would like to know which one is the most appropriate
> way to implement the following scenario.
> 
> For example, I want to display a products catalogue of
> 100 products. I do have a base class of product which
> contains all the basic property of the product
> (Product title, product description, product price
> etc)and constructor basically pulls the information
> about the product from the DB based on the product
> identifier (Primary key). 
> 
> Now i have two ways to display catalogue.
> 
> 1. I can write only one query to pull all 100 products
> information and store product information to each
> product object (With out passing product id to the
> constructor) into the collection and later i iterate
> that collection to display product catalogue.
> (Advantage: less communication with database server
> and disadvantage: memory consumption is higher)
> 
> 2. I can initiate an individual product object by
> passing product id into the constructor and
> constructor will pull an individual product
> information from the DB and at the same time i can
> display it (Disadvantage: Lots of communication with
> database server and Advantage: memory consumption is
> less) If you think about inheritance then eventually
> this approach will have lots of database calls.
> 
> Please guide me as i am stuck up which way to go.
> 
> Let me know if you need more information.

If you expect the products database to grow much, then solution 2 is
your best bet to accommodate much larger numbers. If you expect that you
will only ever have a couple of hundred then solution 1 will most likely
work nicely. Either way, converting from one style to the other is
merely a matter of iterating over retrieved database rows versus
iterating over an array of pre-retrieved items. It should take you less
time than it took you write your post :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP5 - OOP Question

2004-08-09 Thread Robby Russell
On Mon, 2004-08-09 at 19:29, Hardik Doshi wrote:
> Hello Group,
> 
> I would like to know which one is the most appropriate
> way to implement the following scenario.
> 
> For example, I want to display a products catalogue of
> 100 products. I do have a base class of product which
> contains all the basic property of the product
> (Product title, product description, product price
> etc)and constructor basically pulls the information
> about the product from the DB based on the product
> identifier (Primary key). 
> 
> Now i have two ways to display catalogue.
> 
> 1. I can write only one query to pull all 100 products
> information and store product information to each
> product object (With out passing product id to the
> constructor) into the collection and later i iterate
> that collection to display product catalogue.
> (Advantage: less communication with database server
> and disadvantage: memory consumption is higher)
> 

You can do both. You can create an object for products and have it
designed to give you details for a specific product, and then you can
have a function that will return products based on a filter...
(sometimes your users want to search for products)..so the same query
can be used but append a filter to it.


> 2. I can initiate an individual product object by
> passing product id into the constructor and
> constructor will pull an individual product
> information from the DB and at the same time i can
> display it (Disadvantage: Lots of communication with
> database server and Advantage: memory consumption is
> less) If you think about inheritance then eventually
> this approach will have lots of database calls.
> 
> Please guide me as i am stuck up which way to go.
> 
> Let me know if you need more information.
> 
> Thanks,
> Hardik
> 
> 
>   
> __
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP5 - OOP Question

2004-08-09 Thread Curt Zirzow
* Thus wrote Hardik Doshi:
> Hello Group,
> 
> I would like to know which one is the most appropriate
> way to implement the following scenario.
> 
> For example, I want to display a products catalogue of
> 100 products. I do have a base class of product which
> contains all the basic property of the product
> (Product title, product description, product price
> etc)and constructor basically pulls the information
> about the product from the DB based on the product
> identifier (Primary key). 
> 
> Now i have two ways to display catalogue.
> 
> 1. I can write only one query to pull all 100 products
> information and store product information to each
> product object (With out passing product id to the
> constructor) into the collection and later i iterate
> that collection to display product catalogue.
> (Advantage: less communication with database server
> and disadvantage: memory consumption is higher)
> 
> 2. I can initiate an individual product object by
> passing product id into the constructor and
> constructor will pull an individual product
> information from the DB and at the same time i can
> display it (Disadvantage: Lots of communication with
> database server and Advantage: memory consumption is
> less) If you think about inheritance then eventually
> this approach will have lots of database calls.
> 
> Please guide me as i am stuck up which way to go.

With these two options I can see why it is a tough choice. There is
another option you can take. Store the result handle of the query
from #1 into an object, and retrieve a row from the database on
demand.

abstract class DbIterator implements Iterator {

  /* for me only */
  private $current = 0;
  private $data= false;
  private $handle = null;

  /* Force extending object to define this function */
  abstract protected function &getData($handle, $function);

  public function __construct($handle) {
$this->handle = $handle;
  }

  /* Iterator Interface: */
  public function rewind() {
$this->current = 0;
db_seek($this->result, $this->current);
  }
  public function current() {
return $this->data;
  }
  public function key() {
return $this->current;
  }
  public function next() {
$this->data = $this->getData($handle, 'db_fetch_assoc');
if($this->data) {
  $this->current++;
}
return $this->data;
  }
  public function valid() {
return (this->data !== false);
  }
}


class dbProductClass extends DbIterator {
  public $id;
  public $name;
  
  public function __construct($handle) {
/* let the parent decide what to do with $handle */
parent::__construct($handle)
  }

  /* and define this required function */
  protected function &getData($handle, $func) {
$row = $func($handle);
if ($row == false ) {
  return $row;
}
$this->$id = $row['id']

if (empty($row['name']) {
  $this->name = 'Default Name';
} else {
  $this->name = $row['name'];
}
// do any special stuff here..

return &$this; 
  }

  public function tableName {
return 'People';
  }

  /* this is a no no */
  public function __set($name, $value) {
throw Execption("Attempt to write to readonly property");
  }



}

// then..
$result = db_query($sql);
$product_rows = new dbProductClass($result);

// then some more..
foreach($product_rows as $row ) {
  echo $row->field_name1;
  echo $row->field_name2;
}

This will keep communication down to a minimum and memory down to a
minimum usage as well. I hope this wasn't to much, and it is
completely untested.



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Incorrect trans-sid placement in PHP Version 4.3.6

2004-08-09 Thread Torsten Scheck
Justin Patrin wrote:
> On Mon, 09 Aug 2004 10:02:23 +0200, Torsten Scheck
> <[EMAIL PROTECTED]> wrote:
>
>>Hi,
>>
>>I just stumbled over a problem after I had updated PHP, and I
>>thought I should share my experience:
>>
>>I use PHP Version 4.3.6 with '--enable-trans-sid' and
>>deactivated cookies:
[...]
>>And when I use PHP's session feature together with an empty
>>XML tag, PHP places the Session-ID in the wrong place, if there
>>is no blank space behind the attribute:
[...]
>
> Why did you update to an older version of PHP?
Hi Justin,
the server was updated to "Fedora Core release 2 (Tettnang)" which is 
pretty new compared to the RedHat9 before. ;-)

I don't have root access on the production servers, so I can't enforce a 
certain PHP version. And as there is an easy workaround, you don't have 
to change to a newer PHP version, if you encounter this bug, anyway.

With my post I just wanted to assist those who update their distribution 
and are welcomed by their PHP-applications with a non-working 
PHP-session. :-)

Torsten
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] 5.0.0 NT and Mail()

2004-08-09 Thread Michael Purdy
Folks

Has anyone running php 5.0.0 on NT ran into the MAIL() error

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header 
missing 

I have tried numerous syntax changes to sendmail_from in the PHP.INI as well as 
setting headers without
success.

Mike