Re: [PHP] two php.ini on the same server

2007-01-30 Thread Pierre Pintaric

Richard Lynch a écrit :

On Fri, January 26, 2007 6:36 am, phpdevster wrote:
  

Hi

i am trying to run two Apache server on the same machine and that is
work
fine

but the problem is how to create separate php.ini for each Apache
server .
is that possible ??



In Apache 2, there is a PHPIniDir directive, I do believe...

  


You have the directive to load your config file: suPHP_ConfigPath

good luck

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



[PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Hello there,

I'm sure this question was ask 1,000 times, but I didn't find any 
archive about this, that's why I need help...


Here is my problem:
I receive mail file from my MTA (ie QMail), that works fine. Now, I 
would to find a class or a function that parse the mail and gives 
headers informations, body of the mail (even if it is a multi-part mail) 
and file attachments.

I found nothing in PEAR library, nothing on the web, ...

I don't what want to rebuild the wheel if somebody works on it and made 
a good job...
If somebody uses a great function and want to share, I will please 
him... :-)


Thanks for your help.

Pierre

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



[PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Hello there,

I'm sure this question was ask 1,000 times, but I didn't find any 
archive about this, that's why I need help...


Here is my problem:
I receive mail file from my MTA (ie QMail), that works fine. Now, I 
would to find a class or a function that parse the mail and gives 
headers informations, body of the mail (even if it is a multi-part mail) 
and file attachments.

I found nothing in PEAR library, nothing on the web, ...

I don't what want to rebuild the wheel if somebody works on it and made 
a good job...
If somebody uses a great function and want to share, I will please 
him... :-)


Thanks for your help.

Pierre

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



Re: [PHP] time

2007-01-30 Thread Jim Lucas

Richard Kurth wrote:

[snip]
I am writing a program for managing leads and contacts. I would like to add
the ability to see what TIME it is where the contact is not there server
time. So if you looked at a list of contacts from all over the country you
would see different times compared to what time it is where the user is at.
What should I be looking at to calculate out the different time zones.
Could
somebody just point me in the write direction at this time I have no idea on
how to proceeded.
[/snip]

You would use JavaScript to capture their local 'browser' time and process
it with PHP

I am not looking for something where I am on line with these people some do
not have internet access. I would be calling them on the phone.
I need a way to get the time at there location using what info I already
have like the address zip code and phone number. It would probably have to
be compared to a database of some sort or the time zone file on a lynx
server.


You are going to need the info found at www.melissadata.com

Something like a LERG database/cross reference

Jim

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Jim Lucas

Pierre Pintaric wrote:

Hello there,

I'm sure this question was ask 1,000 times, but I didn't find any 
archive about this, that's why I need help...


Here is my problem:
I receive mail file from my MTA (ie QMail), that works fine. Now, I 
would to find a class or a function that parse the mail and gives 
headers informations, body of the mail (even if it is a multi-part mail) 
and file attachments.

I found nothing in PEAR library, nothing on the web, ...

I don't what want to rebuild the wheel if somebody works on it and made 
a good job...
If somebody uses a great function and want to share, I will please 
him... :-)


Thanks for your help.

Pierre



google.com and ask for php web mail client

This will return you many different examples of php programs that have 
the function/class that you are looking for.


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



Re: [PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Jim Lucas a écrit :

Pierre Pintaric wrote:

Hello there,

I'm sure this question was ask 1,000 times, but I didn't find any 
archive about this, that's why I need help...


Here is my problem:
I receive mail file from my MTA (ie QMail), that works fine. Now, I 
would to find a class or a function that parse the mail and gives 
headers informations, body of the mail (even if it is a multi-part 
mail) and file attachments.

I found nothing in PEAR library, nothing on the web, ...

I don't what want to rebuild the wheel if somebody works on it and 
made a good job...
If somebody uses a great function and want to share, I will please 
him... :-)


Thanks for your help.

Pierre



google.com and ask for php web mail client

This will return you many different examples of php programs that have 
the function/class that you are looking for.




Of course, I looked for that, in PEAR, you can find Mail::IMAP and 
Mail::MBox...
All this exemples connect to an IMAP server or to a MBox file, I would 
only parse an email file...


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



Re: [PHP] Can a class instance a property of another class

2007-01-30 Thread Jochem Maas
Richard Lynch wrote:
> On Sat, January 27, 2007 7:00 pm, Jochem Maas wrote:
>> objects are always by reference in php5 - in php4 you have to
>> use the 'reference' operator (the @ symbol) to make object be passed
>> by reference.
> 
> [pedantic for="archives"]
> Not the @ symbol, which suppresses errors, but the & symbol which
> forces a reference instead of a copy.
> [/pedantic]

ah yes - whoops - my bad, twas probably late and I wasn't paying attention 
anymore.

> 

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 10:18:54 +0100:
> I receive mail file from my MTA (ie QMail), that works fine. Now, I 
> would to find a class or a function that parse the mail and gives 
> headers informations, body of the mail (even if it is a multi-part mail) 
> and file attachments.
> I found nothing in PEAR library, nothing on the web, ...

That's probably because you don't know enough about the field to use the
right search terms, since PEAR *does* contain a package for parsing email
messages, and I have no problems arriving at it from the search box
on http://pear.php.net/ ...

ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Roman Neuhauser a écrit :

That's probably because you don't know enough about the field to use the
right search terms, since PEAR *does* contain a package for parsing email
messages, and I have no problems arriving at it from the search box
on http://pear.php.net/ ...

ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt
  

Great, if you found something, can you share the result with us...
On PEAR website, with the mail keyword, I only find this:

Results *1 - 8* of *8*:

  1. *File_IMC *: Create and
 parse Internet Mail Consortium-style files (like vCard and vCalendar)
  2. *Mail *: Class that provides
 multiple interfaces for sending emails
  3. *Mail_IMAP *: Provides a
 c-client backend for webmail.
  4. *Mail_IMAPv2 *: Provides
 a c-client backend for webmail.
  5. *Mail_Mbox *: Read and
 modify Unix MBOXes
  6. *Mail_Mime *: The Mail_Mime
 packages allows you to create MIME E-mail messages
  7. *Mail_mimeDecode *:
 Provides a class to decode mime messages.
  8. *Mail_Queue *: Class for
 put mails in queue and send them later in background.

File_IMC only proceed on vCard an it's no more maintained...


Another idea?

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



Re[2]: [PHP] Parsing mail file

2007-01-30 Thread Mauro Lorenzutti
Hi Pierre,

I have the same problem: I'm searching a function to parse an email
file. I found this one:

http://pear.php.net/package/Net_IMAP/

I think that you can extract the code you need from the function
getParsedHeaders.

Regards,
 Mauro Lorenzutti


e-mail:  [EMAIL PROTECTED]

-
WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN
 Tel +39-0427-926.389  --  Fax +39-0427-927.653
   [EMAIL PROTECTED]  --  www.webformat.com
-

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Dotan Cohen

On 30/01/07, Pierre Pintaric <[EMAIL PROTECTED]> wrote:

If somebody uses a great function and want to share, I will please
him... :-)



Er, could you please define "I will please him"?

I think that you've scared off a few potential helpers

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/220/gin_blossoms.html
http://rorot.com

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 12:17:01 +0100:
> Roman Neuhauser a écrit :
> >That's probably because you don't know enough about the field to use the
> >right search terms, since PEAR *does* contain a package for parsing email
> >messages, and I have no problems arriving at it from the search box
> >on http://pear.php.net/ ...
> >
> >ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt
>  
> Great, if you found something, can you share the result with us...
> On PEAR website, with the mail keyword, I only find this:

You didn't bother looking at the RFC I gave you...

> Results *1 - 8* of *8*:

The results include your desired package.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



RE: [PHP] time

2007-01-30 Thread Bob Dusek
If you have the timezone offset stored for each contact, you can compare
that to the timezone offset of the server and do the math on a timestamp
value.  
 
// return value format:  hhmm
// -0500 for US/EST, -5 hours relative to GMT
$timeZoneOfServer = date("O");

> -Original Message-
> From: Richard Kurth [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 30, 2007 12:12 AM
> To: php-general@lists.php.net
> Subject: RE: [PHP] time
> 
> [snip]
> I am writing a program for managing leads and contacts. I 
> would like to add
> the ability to see what TIME it is where the contact is not 
> there server
> time. So if you looked at a list of contacts from all over 
> the country you
> would see different times compared to what time it is where 
> the user is at.
> What should I be looking at to calculate out the different time zones.
> Could
> somebody just point me in the write direction at this time I 
> have no idea on
> how to proceeded.
> [/snip]
> 
> You would use JavaScript to capture their local 'browser' 
> time and process
> it with PHP
> 
> I am not looking for something where I am on line with these 
> people some do
> not have internet access. I would be calling them on the phone.
> I need a way to get the time at there location using what 
> info I already
> have like the address zip code and phone number. It would 
> probably have to
> be compared to a database of some sort or the time zone file on a lynx
> server.
> 
> -- 
> 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] convert date to reversed date

2007-01-30 Thread Reinhart Viane
Is this a good way to convert 01/02/2007 to 20070201

 

$value='01/02/2007';

list($day, $month, $year) = split('[/.-]', $value);

$filename=$year.''.$month.''.$day;

 

It does work but i would like to verify if there are no better, more logical
ways to do this.

Thanks in advance



Re: [PHP] convert date to reversed date

2007-01-30 Thread Fredrik Thunberg

Reinhart Viane skrev:

Is this a good way to convert 01/02/2007 to 20070201

 


$value='01/02/2007';

list($day, $month, $year) = split('[/.-]', $value);

$filename=$year.''.$month.''.$day;

 


It does work but i would like to verify if there are no better, more logical
ways to do this.

Thanks in advance


  

date("Ymd", strotodate( $value ));

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



Re: [PHP] convert date to reversed date

2007-01-30 Thread Fredrik Thunberg



date("Ymd", strotodate( $value ));



Of course I mean:

date( "Ydm", strtodate( $value ));

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



RE: [PHP] convert date to reversed date

2007-01-30 Thread Reinhart Viane
I suppose you mean strtotime

-Oorspronkelijk bericht-
Van: Fredrik Thunberg [mailto:[EMAIL PROTECTED] 
Verzonden: dinsdag 30 januari 2007 16:36
CC: php-general@lists.php.net
Onderwerp: Re: [PHP] convert date to reversed date


> date("Ymd", strotodate( $value ));
>

Of course I mean:

date( "Ydm", strtodate( $value ));

-- 
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] convert date to reversed date

2007-01-30 Thread Arpad Ray

$filename = implode(array_reverse(explode('/', $value)));

Arpad

Reinhart Viane wrote:

Is this a good way to convert 01/02/2007 to 20070201

 


$value='01/02/2007';

list($day, $month, $year) = split('[/.-]', $value);

$filename=$year.''.$month.''.$day;

 


It does work but i would like to verify if there are no better, more logical
ways to do this.

Thanks in advance


  


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



[PHP] return bounced email to specific email address

2007-01-30 Thread afan
hi,
is it possible to specify email address in mail() function where bounced
email could return?

I checked http://us2.php.net/manual/en/function.mail.php but didn't find
anything.

thanks.

-afan

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Jim Lucas

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-01-30 12:17:01 +0100:

Roman Neuhauser a écrit :

That's probably because you don't know enough about the field to use the
right search terms, since PEAR *does* contain a package for parsing email
messages, and I have no problems arriving at it from the search box
on http://pear.php.net/ ...

ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt
 
Great, if you found something, can you share the result with us...

On PEAR website, with the mail keyword, I only find this:


You didn't bother looking at the RFC I gave you...


Results *1 - 8* of *8*:


The results include your desired package.

he wants a cut/paste answer to his problem.  He doesn't want to build 
something and learn how it all works.  He just wants it to work out of 
the box.


--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] convert date to reversed date

2007-01-30 Thread Jim Lucas

Arpad Ray wrote:

$filename = implode(array_reverse(explode('/', $value)));

I think you ment

$filename = implode('', array_reverse(explode('/', $value)));



Arpad

Reinhart Viane wrote:

Is this a good way to convert 01/02/2007 to 20070201

 


$value='01/02/2007';

list($day, $month, $year) = split('[/.-]', $value);

$filename=$year.''.$month.''.$day;

 

It does work but i would like to verify if there are no better, more 
logical

ways to do this.

Thanks in advance


  





--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] return bounced email to specific email address

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 16:44:38 +0100:
> is it possible to specify email address in mail() function where bounced
> email could return?
 
Yes, see ftp://ftp.rfc-editor.org/in-notes/rfc2821.txt

> I checked http://us2.php.net/manual/en/function.mail.php but didn't find
> anything.

That's ok, PHP manual shouldn't duplicate specifications for all kinds
of network protocols or whatnot.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] convert date to reversed date

2007-01-30 Thread Jim Lucas

Jim Lucas wrote:

Arpad Ray wrote:

$filename = implode(array_reverse(explode('/', $value)));


I should have checked before I wrote.  It does work, but through me off, 
didn't realize that the first arg was optional.  Sorry




I think you ment

$filename = implode('', array_reverse(explode('/', $value)));



Arpad

Reinhart Viane wrote:

Is this a good way to convert 01/02/2007 to 20070201

 


$value='01/02/2007';

list($day, $month, $year) = split('[/.-]', $value);

$filename=$year.''.$month.''.$day;

 

It does work but i would like to verify if there are no better, more 
logical

ways to do this.

Thanks in advance


  








--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



RE: [PHP] time

2007-01-30 Thread Jay Blanchard
[snip]

I am writing a program for managing leads and contacts. I would like to
add
the ability to see what TIME it is where the contact is not there server
time. So if you looked at a list of contacts from all over the country
you
would see different times compared to what time it is where the user is
at.
What should I be looking at to calculate out the different time zones.
Could
somebody just point me in the write direction at this time I have no
idea on
how to proceeded.


>You would use JavaScript to capture their local 'browser' time and
process
it with PHP

I am not looking for something where I am on line with these people some
do
not have internet access. I would be calling them on the phone.
I need a way to get the time at there location using what info I already
have like the address zip code and phone number. It would probably have
to
be compared to a database of some sort or the time zone file on a lynx
server.
[/snip]

Aha, that was not what your original post asked. Search for time-zone
databases on Google. 

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



RE: [PHP] time

2007-01-30 Thread Edward Kay

> [snip]
>
> I am writing a program for managing leads and contacts. I would like to
> add
> the ability to see what TIME it is where the contact is not there server
> time.
>
> [/snip]
>

I have implemented this feature in our home-grown CRM system. I used the
list of timezones on Wikipedia as a starting point and store the UTC offset
for each contact (selected from a drop down). When displaying their info, I
use this offset to calculate their local time from my server time.

BTW, you'll need to use a float since there are some non-integer timezone
differences.

Edward

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Myron Turner a écrit :

Jim Lucas wrote:
he wants a cut/paste answer to his problem.  He doesn't want to build 
something and learn how it all works.  He just wants it to work out 
of the box.


Why would someone want to read an RFC if he didn't have to?  Maybe we 
should all start by writing our own GUI's.  Nothing like having to 
learn how to map video memory in C and assembler, as we had to do 
before Windows.
I am so sorry, I'm so inferior to you great developper. I only wanted to 
use libraries, but I can see that you never use them, you code your onw 
low levels functions. You propably have lot of time to spend to do this 
and your work is so perfect that you don't need help from anybody.
It's really good for you, but it's not my case. I think (and it's my own 
opinion) lot of people work better than me and if they spend time to 
make libraries and they share them, it's certainly to be used by others 
developpers.


Now, if you don't have any useful response - not sarcastic, not "see the 
documentation" (of course people read documentation before asking help) 
- to my question, please don't send unnecessary mails. Thanks


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



RE: [PHP] Parsing mail file

2007-01-30 Thread Jay Blanchard
[snip]
of course people read documentation before asking help
[/snip]

ROFLMMFAO! Sorry, that just made my day! 

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



[PHP] Can't get PHP extension to Load

2007-01-30 Thread Aaron Smith
I have a Microsoft 2003 server running IIS 6.0 and PHP
5.1.2.  We have an application (Moodle) that uses a database connection
to our MSSQL 2000 server.  For whatever reason, it doesn't work properly
with the built in php_mssql.dll so we have to use a replacement of
either FreeTDS or ODBTP.  ODBTP is working on the production machine,
but is slow as molasses.  I configured a test server (Everything the
same, OS, IIS, PHP) and set it up to use FreeTDS.  It worked a lot
faster so I attempted to move the production machine over to FreeTDS.
It loads a PHP extension called php_dblib.dll that replaces (the same
way ODBTP does) the php_mssql.dll.  The problem is that on the
production machine, even though it is the same version of everything, it
refuses to load the php_dblib.dll.  The only error it says is that the
"specified module could not be found".  The DLL file is definitely in
extensions directory, and the path that the error message presents has
been triple checked to exist.  The version of the DLL file is the same
between the two servers and I even went so far as to copy the production
server's entire C:\php directory over to the test server and it STILL
worked.  The only other component is a freetds.conf file that lives at
the root directory of "C:\".  I checked the permissions of said file and
they match on both servers.  

 

Anyone have an ideas on this?

 



Aaron Smith[EMAIL PROTECTED]

System Administrator   (269) 337-7496

Kalamazoo College

 

 



Re: [PHP] Parsing mail file

2007-01-30 Thread David Giragosian

On 1/30/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:


[snip]
of course people read documentation before asking help
[/snip]

ROFLMMFAO! Sorry, that just made my day!



Wow. I learned a new acronym.

What a great day!

David


Re: [PHP] Parsing mail file

2007-01-30 Thread Myron Turner

Jim Lucas wrote:
he wants a cut/paste answer to his problem.  He doesn't want to build 
something and learn how it all works.  He just wants it to work out of 
the box.


Why would someone want to read an RFC if he didn't have to?  Maybe we 
should all start by writing our own GUI's.  Nothing like having to learn 
how to map video memory in C and assembler, as we had to do before Windows.


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



Re: [PHP] Parsing mail file

2007-01-30 Thread Jim Lucas

Pierre Pintaric wrote:

Myron Turner a écrit :

Jim Lucas wrote:
he wants a cut/paste answer to his problem.  He doesn't want to build 
something and learn how it all works.  He just wants it to work out 
of the box.


Why would someone want to read an RFC if he didn't have to?  Maybe we 
should all start by writing our own GUI's.  Nothing like having to 
learn how to map video memory in C and assembler, as we had to do 
before Windows.
I am so sorry, I'm so inferior to you great developper. I only wanted to 
use libraries, but I can see that you never use them, you code your onw 
low levels functions. You propably have lot of time to spend to do this 
and your work is so perfect that you don't need help from anybody.
It's really good for you, but it's not my case. I think (and it's my own 
opinion) lot of people work better than me and if they spend time to 
make libraries and they share them, it's certainly to be used by others 
developpers.


Now, if you don't have any useful response - not sarcastic, not "see the 
documentation" (of course people read documentation before asking help) 
- to my question, please don't send unnecessary mails. Thanks



well, first off, I would use the analogy:

Let me teach you to fish.
This way I don't have to catch the fish for you.

You say that you have looked but could not find anything on how to do 
this.  Well, I would start by looking at the various programs that 
already exist that currently do this and figure out how they are doing 
it first.  Then if you don't understand what is going on, or can't find 
the answer, then drop us a question or two.


But don't just ask us to hand you the answer.  We are all here to teach 
each other to become better programmers.  We should not be cut/paste 
junkies.


--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



RE: [PHP] Parsing mail file

2007-01-30 Thread Tim


> -Message d'origine-
> De : Dotan Cohen [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 30 janvier 2007 12:48
> À : Pierre Pintaric
> Cc : php-general@lists.php.net
> Objet : Re: [PHP] Parsing mail file
> 
> On 30/01/07, Pierre Pintaric <[EMAIL PROTECTED]> wrote:
> > If somebody uses a great function and want to share, I will please
> > him... :-)
> >
> 
> Er, could you please define "I will please him"?
> 
> I think that you've scared off a few potential helpers
He's french, i think he means he 'would be gratefull' hehe

Cheers,
Tim

Sorry i hit reply instead of reply to all Dotan.


> Dotan Cohen
> 
> http://lyricslist.com/lyrics/artist_albums/220/gin_blossoms.html
> http://rorot.com
> 
> --
> 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] Can't get PHP extension to Load

2007-01-30 Thread Aaron Smith
It seems to me that if external libraries were required, they'd be in
the PHP directory.  But when I took the php directory from the
production (non-working) server, and put it in place on the test server,
it loaded the extension just fine.  I'm going to, however, see if there
are any differences between the components that are installed in IIS on
the two machines.


Aaron Smith[EMAIL PROTECTED]
System Administrator   (269) 337-7496
Kalamazoo College
 

-Original Message-
From: Sergiu Voicu [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 30, 2007 12:54 PM
To: Aaron Smith
Subject: Re: [PHP] Can't get PHP extension to Load

Hello Aaron

Check to see if this module doesn't require other external libraries, 
that you don't have on the production machine. Also try to use a 
debugger to see what calls are made by the apache server when starting.

Sergiu


Aaron Smith wrote:
> I have a Microsoft 2003 server running IIS 6.0 and PHP
> 5.1.2.  We have an application (Moodle) that uses a database
connection
> to our MSSQL 2000 server.  For whatever reason, it doesn't work
properly
> with the built in php_mssql.dll so we have to use a replacement of
> either FreeTDS or ODBTP.  ODBTP is working on the production machine,
> but is slow as molasses.  I configured a test server (Everything the
> same, OS, IIS, PHP) and set it up to use FreeTDS.  It worked a lot
> faster so I attempted to move the production machine over to FreeTDS.
> It loads a PHP extension called php_dblib.dll that replaces (the same
> way ODBTP does) the php_mssql.dll.  The problem is that on the
> production machine, even though it is the same version of everything,
it
> refuses to load the php_dblib.dll.  The only error it says is that the
> "specified module could not be found".  The DLL file is definitely in
> extensions directory, and the path that the error message presents has
> been triple checked to exist.  The version of the DLL file is the same
> between the two servers and I even went so far as to copy the
production
> server's entire C:\php directory over to the test server and it STILL
> worked.  The only other component is a freetds.conf file that lives at
> the root directory of "C:\".  I checked the permissions of said file
and
> they match on both servers.  
> 
>  
> 
> Anyone have an ideas on this?
> 
>  
> 
> 
> 
> Aaron Smith[EMAIL PROTECTED]
> 
> System Administrator   (269) 337-7496
> 
> Kalamazoo College
> 
>  
> 
>  
> 
> 

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



[PHP] TR: Manipulating "categories" in a php database

2007-01-30 Thread Tim
Hello all,

 

This is more of a conceptional question rather then a technical one.

I am developping an online catalog, the catalog is a standard
categorie/subcat/subsubcat system using the following logic in my database:

 

cat_id   cat_name

10DVD

1010 DVD/Action

1020 DVD/Adventure

20CD

2010 CD/Reggae

2020 CD/Electro

 

Up to now I enter the category id's manually from an administration console.

I would like to be able to have my console automagically generate a cat_id
when my users add categories (so they don't have to bother with that aspect
of adding a category) and I would also like to be able to move a category up
or down in the way it displays on the page, as of now I am sorting by cat_id


 

I have been for a while trying to develop a logical scheme to be able to
generate the id's and change their cat_id to reflect a "new" position in how
it displays (displaying DVD/Action after DVD/Adventure for example I would
need to change the cat_id from 1010 to something above 1020 say 1021). This
is fine as I can test the previous elements cat_id and add or subtract 1 but
I get stuck when I have a cat_id say 1010 that I would want to put between
1011 and 1012. I'm having trouble developing the algorithm that would allow
this.. 

 

Would appreciate any "ideas" that may help me conclude this function in my
module.

 

Regards,

Tim Earl



[PHP] nested, referenced foreach & implicit current array pointer issues

2007-01-30 Thread speedy
Hello PHP crew,

As a followup to:

http://bugs.php.net/bug.php?id=22879

I've stumbled upon this problem in a way:

function f()
{
   global $arr;

   foreach($arr as $k=>$v) {
   $v->do_something();
   }
}

After digging through the docs I found that $arr is in fact a reference to 
original $arr, and (in a pretty complex/confusing doc. page about foreach) came 
to a conclusion that the above construct is practically unusable with the 
global keyword as do_something() can potentially affect $arr hidden & implicit 
(*yuck*) current element pointer and thus quite _non-obviously_ side-effect 
parent foreach() (ie. side-effect hidden in the depths of its fn calls).

It would be (perhaps) better if PHP would treat global as making globaly 
defined $arr accessible from the local fn. namespace instead of assigning a 
local name to be a reference?

Also if the price of implicit current element pointer is copying of 
non-referenced array on foreach() to gain humanly-expected behaviour,
and its great potential of writing non-obvious/bad code, I must wonder if there 
are any good use cases (except the trivial ones) where  current pointer is 
actually fruitful?

-- 
Best regards,
 speedy  mailto:[EMAIL PROTECTED]

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



[PHP] Manipulating "categories" in a mysql database

2007-01-30 Thread Tim
Hello all,

 

This is more of a conceptional question rather then a technical one.

I am developping an online catalog, the catalog is a standard
categorie/subcat/subsubcat system using the following logic in my database:

 

cat_id   cat_name

10DVD

1010 DVD/Action

1020 DVD/Adventure

20CD

2010 CD/Reggae

2020 CD/Electro

 

Up to now I enter the category id's manually from an administration console.

I would like to be able to have my console automagically generate a cat_id
when my users add categories (so they don't have to bother with that aspect
of adding a category) and I would also like to be able to move a category up
or down in the way it displays on the page, as of now I am sorting by cat_id


 

I have been for a while trying to develop a logical scheme to be able to
generate the id's and change their cat_id to reflect a "new" position in how
it displays (displaying DVD/Action after DVD/Adventure for example I would
need to change the cat_id from 1010 to something above 1020 say 1021). This
is fine as I can test the previous elements cat_id and add or subtract 1 but
I get stuck when I have a cat_id say 1010 that I would want to put between
1011 and 1012. I'm having trouble developing the algorithm that would allow
this.. 

 

Would appreciate any "ideas" that may help me conclude this function in my
module.

 

Regards,

Tim Earl

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



Re: [PHP] TR: Manipulating "categories" in a php database

2007-01-30 Thread Robert Cummings
On Tue, 2007-01-30 at 19:29 +0100, Tim wrote:
> Hello all,
>
> This is more of a conceptional question rather then a technical one.
> 
> I am developping an online catalog, the catalog is a standard
> categorie/subcat/subsubcat system using the following logic in my database:
>
> cat_id   cat_name
>
> 10DVD
> 1010 DVD/Action
> 1020 DVD/Adventure
> 20CD
> 2010 CD/Reggae
> 2020 CD/Electro
>
> Up to now I enter the category id's manually from an administration console.
> 
> I would like to be able to have my console automagically generate a cat_id
> when my users add categories (so they don't have to bother with that aspect
> of adding a category)

Either make the cat_id auto increment and let MySQL generate it for you,
or lock the table, get the last ID, create the new row with ID = LastID
= 1, and then unlock the table.

>  and I would also like to be able to move a category up
> or down in the way it displays on the page, as of now I am sorting by cat_id

Order the data in a linked list. Move the link in question up and down
as necessary.

> I have been for a while trying to develop a logical scheme to be able to
> generate the id's and change their cat_id to reflect a "new" position in how
> it displays (displaying DVD/Action after DVD/Adventure for example I would
> need to change the cat_id from 1010 to something above 1020 say 1021). This
> is fine as I can test the previous elements cat_id and add or subtract 1 but
> I get stuck when I have a cat_id say 1010 that I would want to put between
> 1011 and 1012. I'm having trouble developing the algorithm that would allow
> this.. 

Use a new field called display_order or display_rank. When moving items
around via linked list regenerate the display_order based on the
position within the list. Save these values to the database. When
selecting categories from the database order based on this field, and
then any other field you want (in case of no ordering). For instance I
usually order by display_order, title. And only set ordering information
for specific fields I want positioned at the front or end of the list.
This is slightly more complicated though since you need to preserve no
ordering for naturally ordered items and when moving order items around
they should be able to skip past or before all naturally ordered items.

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] TR: Manipulating "categories" in a php database

2007-01-30 Thread Tim
Ok great stuff, thank you, that has enlightened me on the method I need to
develop :)

Oh and about the double msg, sorry fighting with outlook here, not my usual
client ;)

Regards,

Tim

-Message d'origine-
De : Robert Cummings [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 30 janvier 2007 19:40
À : Tim
Cc : php-general@lists.php.net
Objet : Re: [PHP] TR: Manipulating "categories" in a php database

On Tue, 2007-01-30 at 19:29 +0100, Tim wrote:
> Hello all,
>
> This is more of a conceptional question rather then a technical one.
> 
> I am developping an online catalog, the catalog is a standard
> categorie/subcat/subsubcat system using the following logic in my
database:
>
> cat_id   cat_name
>
> 10DVD
> 1010 DVD/Action
> 1020 DVD/Adventure
> 20CD
> 2010 CD/Reggae
> 2020 CD/Electro
>
> Up to now I enter the category id's manually from an administration
console.
> 
> I would like to be able to have my console automagically generate a cat_id
> when my users add categories (so they don't have to bother with that
aspect
> of adding a category)

Either make the cat_id auto increment and let MySQL generate it for you,
or lock the table, get the last ID, create the new row with ID = LastID
= 1, and then unlock the table.

>  and I would also like to be able to move a category up
> or down in the way it displays on the page, as of now I am sorting by
cat_id

Order the data in a linked list. Move the link in question up and down
as necessary.

> I have been for a while trying to develop a logical scheme to be able to
> generate the id's and change their cat_id to reflect a "new" position in
how
> it displays (displaying DVD/Action after DVD/Adventure for example I would
> need to change the cat_id from 1010 to something above 1020 say 1021).
This
> is fine as I can test the previous elements cat_id and add or subtract 1
but
> I get stuck when I have a cat_id say 1010 that I would want to put between
> 1011 and 1012. I'm having trouble developing the algorithm that would
allow
> this.. 

Use a new field called display_order or display_rank. When moving items
around via linked list regenerate the display_order based on the
position within the list. Save these values to the database. When
selecting categories from the database order based on this field, and
then any other field you want (in case of no ordering). For instance I
usually order by display_order, title. And only set ordering information
for specific fields I want positioned at the front or end of the list.
This is slightly more complicated though since you need to preserve no
ordering for naturally ordered items and when moving order items around
they should be able to skip past or before all naturally ordered items.

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

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



Re: [PHP] TR: Manipulating "categories" in a php database

2007-01-30 Thread Jim Lucas

Tim wrote:

Hello all,

 


This is more of a conceptional question rather then a technical one.

I am developping an online catalog, the catalog is a standard
categorie/subcat/subsubcat system using the following logic in my database:

What type of DB?



 


cat_id   cat_name

10DVD

1010 DVD/Action

1020 DVD/Adventure

20CD

2010 CD/Reggae

2020 CD/Electro

 


Up to now I enter the category id's manually from an administration console.

ouch...


I would like to be able to have my console automagically generate a cat_id

in mysql use auto_increment on the column and set it to PRIMARY KEY

This will create a unique index for each row that is inserted to the 
table.



when my users add categories (so they don't have to bother with that aspect
of adding a category) and I would also like to be able to move a category up
or down in the way it displays on the page, as of now I am sorting by cat_id
create a master_cat_id column and set that to the parent category for a 
given category, and then if the master_cat_id is not set, then you know 
that it is a top level/parent of a category.





 


I have been for a while trying to develop a logical scheme to be able to
generate the id's and change their cat_id to reflect a "new" position in how
it displays (displaying DVD/Action after DVD/Adventure for example I would
need to change the cat_id from 1010 to something above 1020 say 1021). This
is fine as I can test the previous elements cat_id and add or subtract 1 but
I get stuck when I have a cat_id say 1010 that I would want to put between
1011 and 1012. I'm having trouble developing the algorithm that would allow
this.. 
How are you wanting the categories to be displayed?  in a specific order 
or alphabetically?


If you are wanting a specific order, you will have to create a new 
column for display order, then build a sorting feature into your app 
that would allow you to increase or decrease the display order


 


Would appreciate any "ideas" that may help me conclude this function in my
module.

 


Regards,

Tim Earl





--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] nested, referenced foreach & implicit current array pointer issues

2007-01-30 Thread Martin Alterisio

2007/1/30, speedy <[EMAIL PROTECTED]>:


Hello PHP crew,

As a followup to:

http://bugs.php.net/bug.php?id=22879



That's not a bug, just an user doing things the wrong way and blaming the
language.

I've stumbled upon this problem in a way:


function f()
{
   global $arr;

   foreach($arr as $k=>$v) {
   $v->do_something();
   }
}

After digging through the docs I found that $arr is in fact a reference to
original $arr, and (in a pretty complex/confusing doc. page about foreach)
came to a conclusion that the above construct is practically unusable with
the global keyword as do_something() can potentially affect $arr hidden &
implicit (*yuck*) current element pointer and thus quite _non-obviously_
side-effect parent foreach() (ie. side-effect hidden in the depths of its fn
calls).

It would be (perhaps) better if PHP would treat global as making globaly
defined $arr accessible from the local fn. namespace instead of assigning a
local name to be a reference?

Also if the price of implicit current element pointer is copying of
non-referenced array on foreach() to gain humanly-expected behaviour,
and its great potential of writing non-obvious/bad code, I must wonder if
there are any good use cases (except the trivial ones) where  current
pointer is actually fruitful?



I don't see your point anywhere... foreach iterates over a copy of the array
so where is the potential side-effect? Even so there will be references if
the items of the original array are references, or if they are objects in
PHP5, but that's expected behaviour. That's the way many OOP languages have
been implemented (eg: Java) without coders having the problems you mention.
Just give me one good reason to even consider your proposal.


Re: [PHP] Parsing mail file

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 10:35:34 -0600:
> Jim Lucas wrote:
> >he wants a cut/paste answer to his problem.  He doesn't want to build 
> >something and learn how it all works.  He just wants it to work out of 
> >the box.
> >
> Why would someone want to read an RFC if he didn't have to?  Maybe we 
> should all start by writing our own GUI's.  Nothing like having to learn 
> how to map video memory in C and assembler, as we had to do before Windows.

Because otherwise you cannot possibly understand how to use a ready-made
library correctly?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



RE: [PHP] What search algorithm does in_array() use?

2007-01-30 Thread Ken Dozier
Thanks to all for your input, guys.

Regarding the construction of the SQL query, I would love to try it with
SUBSELECTs; but, alas, we are using RHEL 3 which ships with MySQL 3.23.  I
don't think RH supports any 4.0 or later versions of MySQL on RHEL 3, so I'm
stuck with 3.23 for the time being.  I had tried a query like this:

SELECT d.account FROM data AS d, accesslist AS a WHERE d.account=a.account
AND a.username='username'

but it also took quite a bit of time.  Since the problem would appear for
only a few users, I may have to simply hard code a workaround for the time
being and then come back to it later.

Thanks again for all of your help.

Ken.

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 6:13 PM
To: Ken Dozier
Cc: php-general@lists.php.net
Subject: Re: [PHP] What search algorithm does in_array() use?

On Mon, January 29, 2007 11:20 am, Ken Dozier wrote:
> Does in_array() use a search algorithm (i.e., binary search), or does 
> it check sequentially each element in the array?

Since there is no guarantee that the elements are in any particular order,
it almost has to be sequential...

> I am using in_array() within a while{} loop to check query results 
> against an access-list array to produce a third array containing items 
> that successfully passed the comparison test.  Because the two 
> starting arrays in the worst-case scenario can have 8,000 items each, 
> the loop is timing out.
> Advice or alternative methods are appreciated.
>
> Code Sample:
>  function check_results($results, $access_list) { # Check for $results 
> in array $access_list and
>   # add matches to array $match.
>
>   $result = false;
>   $match = array();
>
>   while ($r = mysql_fetch_row($results))
>   { if ( in_array($r[0], $access_list) )
> { $match[] = $r; }
>   }
>
>   if ( count($match) > 0 ) { $result = $match; }
>
>   return $result;
> }
> ?>

Ideal #1:
Figure out how to write an SQL query to find what's in the DB, and don't do
any search in PHP at all.

Ideal #2:
Put the values in as keys, and use http://php.net/isset This will "hash" the
values and have an O(1) lookup, I think.
Only works if you know the uniqueness of the values to be searched, or don't
care about duplicates.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Socket problem

2007-01-30 Thread Scripter47
I'm making a simple socket server that just receive some data, and then 
send some data back again to the client.


it is a program that send data by sockets, (not port 80)

It has to a simple solution :)

plz ask for more infomation.

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 18:03:22 +0100:
> I am so sorry, I'm so inferior to you great developper.
[...]
> Now, if you don't have any useful response - not sarcastic,

:)

> I only wanted to use libraries, but I can see that you never use them,
> you code your onw low levels functions.

No, you simply need to get at least superficially acquainted with the
problem domain.
 
> not "see the documentation" (of course people read documentation
> before asking help) 

You don't even know that an email is a MIME entity, so what
documentation have you read?  You were given direct url to the
documentation you have *not* read, please return after doing so.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] XML error in browser

2007-01-30 Thread Skip Evans

Hey all,

I have getting the following error page in the 
browser when trying to redirect to an iTunes XML 
file to open the player.


===
Cannot view XML input using style sheet.
Please correct the error and then click the
Refreshbutton, or 
try again later.

--

XML document must have a top level element. Error 
processing resource '

http://www.fiql.com/~podlist/get_podlist.php?id=27'.
===

And here is the code:

header('Content-Type: text/xml; charset=UTF-8');

require_once "db_connect.php";
require_once "db_manage.php";

// SEE skip evans -- 1/29/07 -- check if superfeed 
XML file is due to be rebuilt.
// if so, rebuild the file and pass the new file 
on to iTumes.


Check_XML_file($id);

@readfile("itpc://www.fiql.com/~podlist/superfeeds/superfeed$id.xml");

===

No style sheet gets read in, and there is no echo 
or print statements outputting anything to the 
browser until the readfile() call.


Any suggestions would be greatly appreciated. By 
the way, I used the post at the bottom of this 
forum for the hint on using readfile().


http://www.pmachine.com/forums/viewthread/37591/

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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



Re: [PHP] time

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 16:52:02 -:
> BTW, you'll need to use a float since there are some non-integer timezone
> differences.

No need to lose information.  Just store the offset in minutes, problem solved.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re[2]: [PHP] nested, referenced foreach & implicit current array pointer issues

2007-01-30 Thread speedy
Hello Martin,

> Tuesday, January 30, 2007, 8:45:50 PM, you wrote:
> 
> function f()
> {
>global $arr; 
> 
>foreach($arr as $k=>$v) {
>$v->do_something();
>}
> }
> 
>  I don't see your point anywhere... foreach iterates over a copy of
>  the array so where is the potential side-effect? Even so there will
>  be references if the items of the original array are references, or
>  if they are objects in PHP5, but that's expected behaviour. That's
>  the way many OOP languages have been implemented (eg: Java) without
>  coders having the problems you mention. Just give me one good
>  reason to even consider your proposal. 


Humm, you seem to have misunderstood (& that could be one reason in itself). In 
my example foreach() iterates over the original $arr array (contrary to what 
you say) - and so may deeply nested fns in the called do_something() method, 
making global + foreach construct unuseable/"unstable" in non-trivial cases.

-- 
Best regards,
 speedymailto:[EMAIL PROTECTED]

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



Re: [PHP] Can't get PHP extension to Load

2007-01-30 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-30 12:09:44 -0500:
> It loads a PHP extension called php_dblib.dll that replaces (the same
> way ODBTP does) the php_mssql.dll.  The problem is that on the
> production machine, even though it is the same version of everything, it
> refuses to load the php_dblib.dll.  The only error it says is that the
> "specified module could not be found".  The DLL file is definitely in
> extensions directory, and the path that the error message presents has
> been triple checked to exist.

use depends.exe to see which library php_dblib.dll depends on is missing
on the production server.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] XML error in browser

2007-01-30 Thread Skip Evans

Hey all,

First, any apology. I had put in a filter to place 
all my list messages into a folder, and did not 
see Richard Lynch's reply to my earlier post about 
getting the iTunes player to open up inside PHP.


I can see from what he said that my problem below 
is probably caused by the browser thinking it is 
getting HTML or something sneaking in front of the 
XML here?


I'm not sure how to go about solving that, so if I 
am correct any suggestions building upon Richard's 
post would help.


I think I'm trying to solve the problem Richard 
alluded to with the header call that sets up XML, 
but perhaps that is coming to late?


Skip

Skip Evans wrote:

Hey all,

I have getting the following error page in the browser when trying to 
redirect to an iTunes XML file to open the player.


===
Cannot view XML input using style sheet.
Please correct the error and then click the
Refreshbutton, or try again later.
--

XML document must have a top level element. Error processing resource '
http://www.fiql.com/~podlist/get_podlist.php?id=27'.
===

And here is the code:

header('Content-Type: text/xml; charset=UTF-8');

require_once "db_connect.php";
require_once "db_manage.php";

// SEE skip evans -- 1/29/07 -- check if superfeed XML file is due to be 
rebuilt.

// if so, rebuild the file and pass the new file on to iTumes.

Check_XML_file($id);

@readfile("itpc://www.fiql.com/~podlist/superfeeds/superfeed$id.xml");

===

No style sheet gets read in, and there is no echo or print statements 
outputting anything to the browser until the readfile() call.


Any suggestions would be greatly appreciated. By the way, I used the 
post at the bottom of this forum for the hint on using readfile().


http://www.pmachine.com/forums/viewthread/37591/



--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Jim Lucas a écrit :


But don't just ask us to hand you the answer.  We are all here to 
teach each other to become better programmers.  We should not be 
cut/paste junkies.



Thanks for your help...

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



[PHP] RE: What search algorithm does in_array() use?

2007-01-30 Thread Ken Dozier
BINGO!  I just tried your array_flip() suggestion, Greg.  Awesome!  Thanks
for the tip; I wouldn't have thought of that.

Ken. 

-Original Message-
From: Gregory Beaver [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 4:54 PM
To: Ken Dozier
Cc: php-general@lists.php.net
Subject: Re: What search algorithm does in_array() use?

Ken Dozier wrote:
> Does in_array() use a search algorithm (i.e., binary search), or does 
> it check sequentially each element in the array?
> 
> I am using in_array() within a while{} loop to check query results 
> against an access-list array to produce a third array containing items 
> that successfully passed the comparison test.  Because the two 
> starting arrays in the worst-case scenario can have 8,000 items each, the
loop is timing out.
> Advice or alternative methods are appreciated.
> 
> Code Sample:
>  function check_results($results, $access_list) { # Check for $results 
> in array $access_list and
>   # add matches to array $match.
> 
>   $result = false;
>   $match = array();
> 
>   while ($r = mysql_fetch_row($results))
>   { if ( in_array($r[0], $access_list) )
> { $match[] = $r; }
>   }
> 
>   if ( count($match) > 0 ) { $result = $match; }
> 
>   return $result;
> }
> ?>

Hi Ken,

Since arrays are hash tables in PHP, it would be far faster to use an
associative array.  How?

$access_list = array_flip($access_list);

then

if (isset($access_list[$r[0]]))

However, this sounds more like a design issue with the SQL that creates
$results.  You can do the in_array natively in SQL with "WHERE otherthing IN
("thing1", "thing2",...)" which would automatically filter out the
non-matches in a far more efficient manner, perhaps increasing requests per
second by an exponential factor.  Of course, if $access_list is from
external input (user input), you will need to escape the output, make sure
you have the proper encoding, etc. so you can avoid SQL injection attacks
and other nastiness, but that is another topic.

If you are getting $access_list from another query, you could also try using
a sub-query as in "WHERE otherthing IN (SELECT ...)" but this of course
assumes you are are using MySQL >= version 4.1.

In any case, you are definitely going to want to revisit the design of your
queries before even starting with reworking your PHP.

Good luck,
Greg

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



Re: [PHP] Socket problem

2007-01-30 Thread Stut

Scripter47 wrote:
I'm making a simple socket server that just receive some data, and then 
send some data back again to the client.


Lovely.


it is a program that send data by sockets, (not port 80)


Excellent.


It has to a simple solution :)


Simple is usually the best way to go.


plz ask for more infomation.


No thanks, I'm good.

-Stut

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Pierre Pintaric

Roman Neuhauser a écrit :

Because otherwise you cannot possibly understand how to use a ready-made
library correctly?
  
All of them (those who teach how to use Google) certainly knows all 
about GD (jpeg, gif, png, ...), zip, EXT3/FAT32/NTFS system, ...

I am certainly on the wrong place, sorry...

(Thanks Roman, it's friendly)

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



Re: [PHP] Parsing mail file

2007-01-30 Thread Jon Anderson
I realize I'm probably stepping on some toes here, but I'm going to 
assume that there is (judging from the wording) a language barrier here. 
While I'm all for the "teach a man to fish" philosophy, I'm not sure 
that language isn't getting in the way of the lesson...


Pierre Pintaric wrote:
I don't what want to rebuild the wheel if somebody works on it and 
made a good job...
I believe you're looking for a MIME message parser. (I think that's the 
piece of the puzzle you were missing. People were trying to steer you in 
that direction.)


The one ready-made solution that I'm aware of that will help you is the 
PECL mailparse package: http://pecl.php.net/package/mailparse


Otherwise, #6 (and maybe #7) in your search results list should do it...

If somebody uses a great function and want to share, I will please 
him... :-)

Please don't. ;-)

jon

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



RE: [PHP] Can't get PHP extension to Load

2007-01-30 Thread Aaron Smith
Interesting.  Running that comes up with 2 missing dependencies:
MSJAVA.DLL (delay-load dependency) and MSVCR71.DLL (apparently a
required dependency).  However, running the SAME thing on the test
server results in the same errors...but it works over there.  I did a
search for those two files on both servers and they both have the
MSVCR71.dll file in the same location but neither of them have the
MSJAVA.dll file.


Aaron Smith[EMAIL PROTECTED]
System Administrator   (269) 337-7496
Kalamazoo College
 

-Original Message-
From: Roman Neuhauser [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 30, 2007 4:00 PM
To: Aaron Smith
Cc: php-general@lists.php.net
Subject: Re: [PHP] Can't get PHP extension to Load

# [EMAIL PROTECTED] / 2007-01-30 12:09:44 -0500:
> It loads a PHP extension called php_dblib.dll that replaces (the same
> way ODBTP does) the php_mssql.dll.  The problem is that on the
> production machine, even though it is the same version of everything,
it
> refuses to load the php_dblib.dll.  The only error it says is that the
> "specified module could not be found".  The DLL file is definitely in
> extensions directory, and the path that the error message presents has
> been triple checked to exist.

use depends.exe to see which library php_dblib.dll depends on is missing
on the production server.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Fwd: [PHP] Fwd: Entries no longer appear in search

2007-01-30 Thread Kevin Jordan

Damn, wish replyto was set, I keep doing that.

-- Forwarded message --
From: Kevin Jordan <[EMAIL PROTECTED]>
Date: Jan 30, 2007 4:07 PM
Subject: Re: [PHP] Fwd: Entries no longer appear in search
To: Chris <[EMAIL PROTECTED]>


Sorry, wasn't sure it went through the first time.

On 1/29/07, Chris <[EMAIL PROTECTED]> wrote:

No need to keep posting the same question over and over again.

If anyone has suggestions, they will reply.

Kevin Jordan wrote:
> -- Forwarded message --
> From: Kevin Jordan <[EMAIL PROTECTED]>
> Date: Jan 28, 2007 6:21 PM
> Subject: Fwd: Entries no longer appear in search
> To: php-general@lists.php.net, [EMAIL PROTECTED]
>
>
> This was originally sent to the OpenLDAP list, but it was rejected
> because I mentioned PHP and phpLDAPadmin and said I should send it to
> the appropriate lists there.
>
> -- Forwarded message --
> From: Kevin Jordan <[EMAIL PROTECTED]>
> Date: Jan 27, 2007 4:24 PM
> Subject: Entries no longer appear in search
> To: openldap-software@openldap.org
>
>
> I'm having the random problem of an OpenLDAPperson entry just no
> longer showing up in the search results, causing havoc on my logins.
> I used phpLDAPadmin to administer LDAP and I also use PHP wrappers
> (they store all the information and then use the ldap functions to
> modify the entry) to change information on my pages.  A simple move
> and then move back seems to work to fix it, so they aren't completely
> gone, but they just don't show up in the search.  Has anyone else
> experienced this problem?
>
> --
> Kevin Jordan
>
>
> --
> Kevin Jordan
>
>


--
Postgresql & php tutorials
http://www.designmagick.com/




--
Kevin Jordan


--
Kevin Jordan

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



RE: [PHP] Can't get PHP extension to Load

2007-01-30 Thread Aaron Smith
AHA!  I have discovered the culprit, but am uncertain WHY it is the
culprit.  The production server as Microsoft.NET Framework 2.0 installed
on it and the test server does not.  I installed the 2.0 framework on
the test server and BAM, the extension refused to load.  I'll see if
uninstalling it causes it to work again as I have a feeling that .NET
2.0 is not needed on the production machine.  If so, though, is there a
way around this?


Aaron Smith[EMAIL PROTECTED]
System Administrator   (269) 337-7496
Kalamazoo College
 
-Original Message-
From: Aaron Smith 
Sent: Tuesday, January 30, 2007 4:58 PM
To: php-general@lists.php.net
Subject: RE: [PHP] Can't get PHP extension to Load

Interesting.  Running that comes up with 2 missing dependencies:
MSJAVA.DLL (delay-load dependency) and MSVCR71.DLL (apparently a
required dependency).  However, running the SAME thing on the test
server results in the same errors...but it works over there.  I did a
search for those two files on both servers and they both have the
MSVCR71.dll file in the same location but neither of them have the
MSJAVA.dll file.


Aaron Smith[EMAIL PROTECTED]
System Administrator   (269) 337-7496
Kalamazoo College
 

-Original Message-
From: Roman Neuhauser [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 30, 2007 4:00 PM
To: Aaron Smith
Cc: php-general@lists.php.net
Subject: Re: [PHP] Can't get PHP extension to Load

# [EMAIL PROTECTED] / 2007-01-30 12:09:44 -0500:
> It loads a PHP extension called php_dblib.dll that replaces (the same
> way ODBTP does) the php_mssql.dll.  The problem is that on the
> production machine, even though it is the same version of everything,
it
> refuses to load the php_dblib.dll.  The only error it says is that the
> "specified module could not be found".  The DLL file is definitely in
> extensions directory, and the path that the error message presents has
> been triple checked to exist.

use depends.exe to see which library php_dblib.dll depends on is missing
on the production server.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
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] Help wtih a query?

2007-01-30 Thread Skip Evans

Hey all,

I have the following query:

   $sql="SELECT count(*) AS 
count,votes.storyID,stories.title,stories.storyID 
as sID,stories.approved, 
stories.story,stories.userID, fname, lname
   FROM `bsp_story_votes` as votes, 
bsp_story_stories AS stories, users AS usr
   WHERE 
votes.storyID=stories.storyID AND 
stories.userID=usr.id AND stories.contestID=$contestID

   GROUP BY votes.storyID
   ORDER BY stories.approved,count 
DESC, sID ASC LIMIT $b_recno,$recs";


How would this need to be changed so that it would 
return rows for the members of the 
bsp_story_stories table that do not have records 
in the bsp_story_votes table?


Is that what the left/right joins do???

Thanks!
Skip

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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



Re: [PHP] Help wtih a query?

2007-01-30 Thread Jon Anderson

Wrong list. Putting "$sql=..." in there doesn't make it a PHP question. ;-)

Skip Evans wrote:

Is that what the left/right joins do???
Yea. LEFT JOIN will give you NULL entries in the left joined table, so 
you'd just have to say WHERE ISNULL(.that table>). Of course, you'll need to do the right JOINs in there for 
that to work.


Personally, I think that implicit joins are sloppy, so I would suggest 
using JOIN with ON or USING...but I suppose that's a preference thing, 
and some (all?) might disagree with me.


jon

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



Re: [PHP] Select record by ID

2007-01-30 Thread nitrox .
Thanks to all who have replied. As you probably have noticed im a total 
novice to php who is trying to achieve big things.


Richard, ive included your suggested code and now my php script is working 
properly. But I dont want to be a php copy/paste newb who has no clue of how 
things are working. If its not too much would you (or anybody) give a brief 
explanation of what this code is doing? Or are there any tutorials online 
that I can read that will educate me on this? Thanks again to all for your 
replies. Ive saved them all for future reference.


atleast this part: $user_id = mysql_real_escape_string((int) 
$_GET['user_id']);


I understand the rest.

";
echo $myrow['user_name'];
echo "";
}
?>

_
Invite your Hotmail contacts to join your friends list with Windows Live 
Spaces 
http://clk.atdmt.com/MSN/go/msnnkwsp007001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us


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



Re: [PHP] Help wtih a query?

2007-01-30 Thread Brad Bonkoski

Skip Evans wrote:

Hey all,

I have the following query:

   $sql="SELECT count(*) AS 
count,votes.storyID,stories.title,stories.storyID as 
sID,stories.approved, stories.story,stories.userID, fname, lname
   FROM `bsp_story_votes` as votes, bsp_story_stories AS 
stories, users AS usr
   WHERE votes.storyID=stories.storyID AND 
stories.userID=usr.id AND stories.contestID=$contestID

   GROUP BY votes.storyID
   ORDER BY stories.approved,count DESC, sID ASC LIMIT 
$b_recno,$recs";


How would this need to be changed so that it would return rows for the 
members of the bsp_story_stories table that do not have records in the 
bsp_story_votes table?


Is that what the left/right joins do???


Look up 'left outer join'
I believe that is what you are looking for.
-B

Thanks!
Skip



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



Re: [PHP] Select record by ID

2007-01-30 Thread Paul Novitski

At 1/30/2007 02:14 PM, nitrox . wrote:
If its not too much would you (or anybody) give a brief explanation 
of what this code is doing? Or are there any tutorials online that I 
can read that will educate me on this? Thanks again to all for your 
replies. Ive saved them all for future reference.


atleast this part: $user_id = mysql_real_escape_string((int) 
$_GET['user_id']);



The querystring parameter user_id is interpreted as an integer and 
then escaped as needed to be safe in a querystring:


"mysql_real_escape_string -- Escapes special characters in a string 
for use in a SQL statement"

http://php.net/mysql_real_escape_string

(int) casts the subsequent value as an integer.  "Type casting in PHP 
works much as it does in C: the name of the desired type is written 
in parentheses before the variable which is to be cast."

http://php.net/manual/en/language.types.type-juggling.php#language.types.typecasting

see also:
Converting to integer
http://php.net/manual/en/language.types.integer.php#language.types.integer.casting

HTTP GET variables: $_GET. "An associative array of variables passed 
to the current script via the HTTP GET method."

http://php.net/manual/en/reserved.variables.php#reserved.variables.get

I recommend that you make the online PHP manual your resource of 
first resort.  It's got a built-in search engine: just enter 
php.net/searchterm into your browser address bar.


Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Help wtih a query?

2007-01-30 Thread Philip Thompson

On Jan 30, 2007, at 4:33 PM, Skip Evans wrote:


Hey all,

I have the following query:

   $sql="SELECT count(*) AS  
count,votes.storyID,stories.title,stories.storyID as  
sID,stories.approved, stories.story,stories.userID, fname, lname
   FROM `bsp_story_votes` as votes, bsp_story_stories  
AS stories, users AS usr
   WHERE votes.storyID=stories.storyID AND  
stories.userID=usr.id AND stories.contestID=$contestID

   GROUP BY votes.storyID
   ORDER BY stories.approved,count DESC, sID ASC LIMIT  
$b_recno,$recs";


How would this need to be changed so that it would return rows for  
the members of the bsp_story_stories table that do not have records  
in the bsp_story_votes table?


Is that what the left/right joins do???

Thanks!
Skip



This may be closer to what you're wanting...


SELECT count(stories.*) AS count, votes.storyID, stories.title,  
stories.storyID AS sID, stories.approved, stories.story,  
stories.userID, fname, lname


FROM bsp_story_votes AS votes LEFT JOIN (bsp_story_stories AS stories  
ON votes.storyID = stories.storyID) INNER JOIN users AS usr ON  
stories.userID = usr.id


WHERE stories.contestID=$contestID

GROUP BY votes.storyID

ORDER BY stories.approved, count DESC, sID ASC LIMIT $b_recno, $recs


If that doesn't work, you may try changing the LEFT to RIGHT. I  
probably screwed it up, but that's closer to how JOINs work. I'm not  
sure if the GROUP BY will work with this query either??? I thought  
you had to use HAVING with a GROUP BY? Refer to the M*SQL manual.


Now that think about it... I don't know if you can have a 'count()'  
in with that query. If it doesn't work, you may try pulling count()  
out and just using m*sql_num_rows() afterwards to get the count. Hope  
that helps!


~Philip

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



Re: [PHP] return bounced email to specific email address

2007-01-30 Thread Chris

[EMAIL PROTECTED] wrote:

hi,
is it possible to specify email address in mail() function where bounced
email could return?

I checked http://us2.php.net/manual/en/function.mail.php but didn't find
anything.


That's the right place. It's the 5th parameter you want to change.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Select record by ID

2007-01-30 Thread Craige Leeder

atleast this part: $user_id = mysql_real_escape_string((int)
$_GET['user_id']);


I'm not sure who put this in there, but you don't need to use
mysql_real_escape_string() on that value if you're type casting it. If
you are forcing it to be an integer, there is nothing to escape.
Integers are perfectly fine to be put into a query as they are.

- Craige

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



[PHP] Re: Suggestions of GPL plugin-system?

2007-01-30 Thread Globalissa Info
Hello All (cc Ivo),
We have numerous modules in various software titles and these are included by
a simple conditional statement. If they exist, then include them.


Example:





... another example:



   
// your code here
   



This works well for modules because if they don't exist then they aren't used.
You can use a constant for the installation absolute url when testing for
existence of the file. Also if you always put modules in your /modules folder
then you'll know where to look for them in any software title.  There's other
examples and other code in our free unencrypted phpYellow Lite Edition
downloadable at http://www.globalissa.com/downloads.php . You might also
notice that the @ character can be used to suppress issues with the
conditional call - test that first, and use it sparingly.


Sincerely,
Rob.
http://phpyellow.com

___
Ivo wrote:
Hi guys,

I've been developing a GPL PHP/MySQL app for some time now and I would
like to extend it with a module/plugin system. The idea would be that
people could add a directory in a plugin path that would contain a
bunch of PHP files extending the functionality of my application. This
directory would then be read out, some config file parsed and whatnot,
after which the module can be turned on by my application.

Now, I could try and figure this out by myself, but that would be
reinventing the wheel since I'm betting there is some good GPL modular
software around (such as Joomla, PHP-Nuke, PHPbb, etc, etc.) that you have
been working with as a coder. Could any of you suggest a certain GPL
application that has a great module setup that I could take a look at?

Thanks a lot for your time!

Ivo 

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



[PHP] ereg() problem

2007-01-30 Thread jekillen

Hello php list;

I am having trouble with ereg().
The following is the problem code
$x = ereg("", $get_route, 
$m);

testing $route I get:
$route = $m[1];
print $route.'';
jk/in' rec='a_378e6dc4.xml' /> (out put of print)
jk is all I am looking for but
is it greed that is missing the
forward slash and the single quote?
It seems like every time I do this I have to monkey around
with it until I get what I want. I have even changed the
formatting of files just so a regular expression would
work without this sort of trial and error.
Is there a way I can turn off greed in php's regex?
I am using php v5.1.2 with Apache 1.3.34
Thanks in advance.
JK

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



RE: [PHP] What search algorithm does in_array() use?

2007-01-30 Thread Ligaya A. Turmelle
Don't use a theta join - use a left, right or inner preferably with ANSI
syntax and make sure you indexes are set up correctly - this shouldn't
take very long to execute at all.

SELECT d.account 
FROM data d
  INNER JOIN accesslist a 
USING account  (or ON d.account=a.account)
WHERE a.username='username'

Respectfully,
Ligaya Turmelle
Systems Analyst
Guamcell Communications
Phone: (671)689-2377 
-Original Message-
From: Ken Dozier [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 31, 2007 6:31 AM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net; 'Gregory Beaver'
Subject: RE: [PHP] What search algorithm does in_array() use?

Thanks to all for your input, guys.

Regarding the construction of the SQL query, I would love to try it with
SUBSELECTs; but, alas, we are using RHEL 3 which ships with MySQL 3.23.
I don't think RH supports any 4.0 or later versions of MySQL on RHEL 3,
so I'm stuck with 3.23 for the time being.  I had tried a query like
this:

SELECT d.account FROM data AS d, accesslist AS a WHERE
d.account=a.account AND a.username='username'

but it also took quite a bit of time.  Since the problem would appear
for only a few users, I may have to simply hard code a workaround for
the time being and then come back to it later.

Thanks again for all of your help.

Ken.

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Monday, January 29, 2007 6:13 PM
To: Ken Dozier
Cc: php-general@lists.php.net
Subject: Re: [PHP] What search algorithm does in_array() use?

On Mon, January 29, 2007 11:20 am, Ken Dozier wrote:
> Does in_array() use a search algorithm (i.e., binary search), or does 
> it check sequentially each element in the array?

Since there is no guarantee that the elements are in any particular
order, it almost has to be sequential...

> I am using in_array() within a while{} loop to check query results 
> against an access-list array to produce a third array containing items

> that successfully passed the comparison test.  Because the two 
> starting arrays in the worst-case scenario can have 8,000 items each, 
> the loop is timing out.
> Advice or alternative methods are appreciated.
>
> Code Sample:
>  function check_results($results, $access_list) { # Check for $results 
> in array $access_list and
>   # add matches to array $match.
>
>   $result = false;
>   $match = array();
>
>   while ($r = mysql_fetch_row($results))
>   { if ( in_array($r[0], $access_list) )
> { $match[] = $r; }
>   }
>
>   if ( count($match) > 0 ) { $result = $match; }
>
>   return $result;
> }
> ?>

Ideal #1:
Figure out how to write an SQL query to find what's in the DB, and don't
do any search in PHP at all.

Ideal #2:
Put the values in as keys, and use http://php.net/isset This will "hash"
the values and have an O(1) lookup, I think.
Only works if you know the uniqueness of the values to be searched, or
don't care about duplicates.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--
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] regarding ereg() problem

2007-01-30 Thread jekillen

Hi again;
(Blush)
I just did noticed that I
did not mask out the
two dots:
$x = ereg("", $get_route, 
$m);

I am trying again..
I still get the same result
jk/in' rec='a_378e6dc4.xml' />
JK

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



RE: [PHP] Need tool to graphically show all includes/requires -- first version Announcement

2007-01-30 Thread Daevid Vincent
Impossible! HAH!

So here's a first stab at this.
http://daevid.com/examples/include_tree.zip

It's not very pretty (yet), but should illustrate where I'm going with it.
Next step is to make it a nice tree view in a .html page or something. I'm
not quite sure what or how I want to do that just yet, but it's quite useful
as it is. Simply redirect the output to a file.

It handles sane define('ROOTPATH', '/myroot/') format substitutions. It does
not handle the other goofy function/variable example given below. I don't
think that's very real-world.

# ./it.php --print_tree --parse_tree --debug

index.php
/includes/
   global.inc.php

Processing: /myroot/tools/include_tree/example/index.php
Processing: /myroot/tools/include_tree/example/includes/global.inc.php
Array
(
[branding.inc.php] => item Object
(
[path] => /
[file] => branding.inc.php
[realpath] => .
[includedByArray] => Array
(
[0] => /includes/global.inc.php
)

[requiresArray] => Array
(
)

)

[db.inc.php] => item Object
(
[path] => /myroot/includes
[file] => db.inc.php
[realpath] => ROOTPATH."/includes
[includedByArray] => Array
(
[0] => /index.php
[1] => /includes/global.inc.php
)

[requiresArray] => Array
(
)

)

[global.inc.php] => item Object
(
[path] => /includes
[file] => global.inc.php
[realpath] => /myroot/tools/include_tree/example/includes
[includedByArray] => Array
(
[0] => /index.php
)

[requiresArray] => Array
(
[0] => /locale_default.inc.php
[1] => /branding.inc.php
[2] => /myroot/includes/db.inc.php
[3] => /log.php
[4] => /myroot/includes/universal.inc.php
[5] => /classes/persistent_variables.php
)

)
...

DÆVID  

> -Original Message-
> From: Roman Neuhauser [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, January 20, 2007 4:46 AM
> To: Daevid Vincent
> Cc: 'PHP General'
> Subject: Re: [PHP] Need tool to graphically show all includes/requires
> 
> # [EMAIL PROTECTED] / 2007-01-19 16:52:49 -0800:
> > We have a fairly complex product that is all PHP based GUI.
> > 
> > We're in need of some kind of "graphical tool" (web, stand 
> alone, windows,
> > linux, osx whatever) that will take a directory tree, 
> recursively traverse
> > all the files, look for 'includes' and 'requires' (and the 
> _once versions
> > too) and then map them out so we can see what files are 
> calling what and
> > where.
> 
> That's impossible to tell exactly without running the software you're
> studying. What would you map this to?
> 
> function include_($file) { include $file; }
> 
> Or this?
> 
> define('FOO_INLCUDE_DIR', '/some/path');
> include FOO_INLCUDE_DIR . '/file.php';
> 
> The recursive part is easy:
> 
> find $topsrcdir -name \*.php -print0 | xargs -0n1 
> processing-script-for-one-file


"Some people, when confronted with a problem, think 'I know, I'll use XML.'"
Now they have two problems. 

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



Re: [PHP] regarding ereg() problem

2007-01-30 Thread Jim Lucas

jekillen wrote:

Hi again;
(Blush)
I just did noticed that I
did not mask out the
two dots:
$x = ereg("", $get_route, 
$m);

I am trying again..
I still get the same result
jk/in' rec='a_378e6dc4.xml' />
JK



Tell a little more about what you are trying to do?

Example input and expected results ???

Jim

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