|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Thu Jan 23 2003 - 01:35:25 CST
php-general Digest 23 Jan 2003 07:35:25 -0000 Issue 1839
Topics (messages 132664 through 132758):
Re: A Licensing Question
132664 by: John Wells
132670 by: Chris Shiflett
132673 by: John Wells
132676 by: Peter Hutnick
Re: backslash t
132665 by: Chris Shiflett
132666 by: Chris Hayes
132669 by: bbonkosk.tampabay.rr.com
132722 by: 1LT John W. Holmes
Email Problems
132667 by: Gary
Re: changing a key in an array
132668 by: Brent Baisley
Re: last time, I promise...is this possible???
132671 by: Edward Peloke
Re: Quick Question about Template Parsers
132672 by: Brent Baisley
$object->function($parameter)->function();
132674 by: Chris McCluskey
132684 by: Greg Beaver
Custom Error pages in IIS
132675 by: 1LT John W. Holmes
132686 by: Didier McGillis
132717 by: 1LT John W. Holmes
Returning a value from a recursive function
132677 by: Andy Crain
132687 by: Brian T. Allen
132706 by: Andy Crain
Browser language problem
132678 by: John M
Possible values for get_browser()->css
132679 by: Liam.Gibbs.dfait-maeci.gc.ca
Re: HELP HELP on a file parser
132680 by: 1LT John W. Holmes
132681 by: Didier McGillis
132682 by: 1LT John W. Holmes
132683 by: 1LT John W. Holmes
Is there a way to undo the md5() encryption??
132685 by: Scott Fletcher
132688 by: Brad Pauly
132689 by: Rick Emery
132691 by: Scott Fletcher
132698 by: Scott Fletcher
132702 by: Peter Hutnick
132754 by: rush
Re: Simple E-mail Question
132690 by: Aquarion
132692 by: Aquarion
132693 by: Aquarion
132694 by: 1LT John W. Holmes
132697 by: Aquarion
132700 by: Aquarion
132701 by: Aquarion
writing a newsletter program in php?
132695 by: Mark C
132705 by: Manuel Lemos
132739 by: Justin French
Re: MySQL 4.0 + PHP 4
132696 by: Georg Richter
132713 by: 1LT John W. Holmes
inserting date
132699 by: Diana Castillo
Reading Directory in reverse
132703 by: Bob Irwin
132704 by: Jim Lucas
NEED HELP URGENTLY
132707 by: Dale
132708 by: Timothy Hitchens \(HiTCHO\)
132711 by: John Wells
132712 by: Leif K-Brooks
132716 by: 1LT John W. Holmes
Rather complex regular expression for the preg_match_all function
132709 by: Andreas Sheriff
a simple getenv question....
132710 by: Bruce Douglas
132714 by: Jim Lucas
132715 by: Timothy Hitchens \(HiTCHO\)
132718 by: Bruce Douglas
132719 by: Timothy Hitchens \(HiTCHO\)
132720 by: Bruce Douglas
Jasper Reports and PHP
132721 by: John Wells
Re: How to implement this by php Session
132723 by: 1LT John W. Holmes
132729 by: Henry
pear timezone class newbie help
132724 by: Gijs Hubben
THANK YOU FOR THE HELP
132725 by: Dale
Saving files
132726 by: Sabina Alejandr Schneider
132727 by: 1LT John W. Holmes
htpasswd
132728 by: Kris
132758 by: Evan Nemerson
continue after break
132730 by: Reymond
132741 by: 1LT John W. Holmes
132742 by: Dan Lowe
132745 by: Reymond
132746 by: Dan Lowe
132748 by: Leif K-Brooks
POST vs GET method
132731 by: Bob Lockie
132740 by: 1LT John W. Holmes
? in URLS.
132732 by: Simon Angell
132734 by: John Nichel
SMTP, mail() and piping directly into Sendmail, which is better?
132733 by: Jonathan Chum
132744 by: Jonathan Chum
132747 by: Manuel Lemos
Generating a range of IP address
132735 by: rdkurth.starband.net
132750 by: Tom Rogers
chown()
132736 by: Urb LeJeune
132751 by: Evan Nemerson
total file size
132737 by: Victor
132752 by: Evan Nemerson
Re: PHP & Sessions generates Segment Faults
132738 by: Justin French
Re: Mass Mailing
132743 by: Jonathan Chum
132757 by: Evan Nemerson
Re: Why PHP doesn't work with Apache2?
132749 by: Jean-Christian Imbeault
132753 by: Rasmus Lerdorf
132755 by: Jean-Christian Imbeault
132756 by: Rasmus Lerdorf
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Peter Hutnick said:
>> Yeah...that's really what I'm wondering. If I have my own code, but
>> make function calls and the like to script libraries licensed under
>> the GPL, does it mean my code will have to be GPL'd as well?
>
> In a word, yes.
Even if the script libraries are themselves just PHP scripts...not any
binary code being linked into the interpreter? I'm still unclear here.
>> Say, for instance, that I use a GPL'd library that provides a class
>> called myGPLClass. If I create instances of myGPLClass in my own
>> scripts, does that make my code in violation of the GPL?
>
> No. Use is not restricted in any way by the GPL. In fact, you needn't
> even /agree/ to the GPL in order to use GPLed software in any way you'd
> like, only to (re)distribute it.
Hmmm....now I think I understand what you mean, but if I consider it in
the context of my question and with your above statement, it seems
contradictory. I don't think it's that you're misunderstanding me...I
think it's me misunderstanding you ;-).
Let me lay it out:
Say you create a set of class libraries, called PeterLib, and release it
under the GPL. I download these libraries...like what you've done...and
decide to use them in my development. Your library makes available a
class called FooBar that I really like, and I decide to make use of it in
a number of my own files.
So, one of the core files in my application contains:
<?
require_once("/PeterLib/FooBar.inc");
$myObj = new FooBar();
$myObj->getFoo();
$myObj->printBar();
?>
Now, futher assume that I want to sell my application under my own
company's license and I label all my files as such, but still retain your
GPL license it the PeterLib files. I rush to market and have an
overwhelming amount of customers in the first month.
Four issues:
1. Have I violated the GPL by distributing your code with my "propietary",
non-open source app? I'm still distributing source, but my specific files
(including a few that call PeterLib classes) are not GPL'd.
2. If I decided to only distribute my own source for money under my own
propietary license, but told my customers that in order for my application
to function correctly, they'd need to download PeterLib. Is this a
violation?
3. If the above are considered violations, I assume only using libraries
licensed under licenses like the LGPL or PHP would make it safe for me to
redistribute with my proprietary app?
4. How do the above change if/when I decide to encode my self-written
files with Zend Encoder?
Thanks very much for all your input. Very helpful. I really appreciate it.
John
attached mail follows:
John,
I am not an expert of copyright law and licenses, but this
URL might help you answer some of your questions:
http://www.gnu.org/licenses/gpl-faq.html
Specifically, look at the questions under the heading,
"Combining work with code released under the GPL", as they
seem to be exactly what you are asking.
Chris
attached mail follows:
Chris,
Sheesh. I'd read it about 5 times but revisited just now. Somehow I
missed the key phrase "which are themselves interpreted.".
Here's the full relevant excerpt:
"Another similar and very common case is to provide libraries with the
interpreter which are themselves interpreted. For instance, Perl comes
with many Perl modules, and a Java implementation comes with many Java
classes. These libraries and the programs that call them are always
dynamically linked together.
A consequence is that if you choose to use GPL'd Perl modules or Java
classes in your program, you must release the program in a GPL-compatible
way, regardless of the license used in the Perl or Java interpreter that
the combined Perl or Java program will run on. "
That answers my question. If following the scenario I described
previously, my code would have to be GPL'd as well.
Thanks!
John
attached mail follows:
John Wells said:
> Peter Hutnick said:
>>> Yeah...that's really what I'm wondering. If I have my own code, but
>>> make function calls and the like to script libraries licensed under
>>> the GPL, does it mean my code will have to be GPL'd as well?
>>
>> In a word, yes.
>
> Even if the script libraries are themselves just PHP scripts...not any
> binary code being linked into the interpreter? I'm still unclear here.
Makes no difference. If you think about it, the GPL applies equally to
binary programs and the source code that produces them . . . so an
interpreted language is like the first part without the second.
>>> Say, for instance, that I use a GPL'd library that provides a class
>>> called myGPLClass. If I create instances of myGPLClass in my own
>>> scripts, does that make my code in violation of the GPL?
>>
>> No. Use is not restricted in any way by the GPL. In fact, you
>> needn't even /agree/ to the GPL in order to use GPLed software in any
>> way you'd like, only to (re)distribute it.
>
> Hmmm....now I think I understand what you mean, but if I consider it in
> the context of my question and with your above statement, it seems
> contradictory. I don't think it's that you're misunderstanding me...I
> think it's me misunderstanding you ;-).
Perhaps I read "use" more literally than you meant it. You can USE a
GPLed lib any way you want. If you want to DISTRIBUTE a program (to
include a script) that uses a GPLed library you must do so under the terms
of the GPL.
If that isn't completely clear, read on.
> Let me lay it out:
>
> Say you create a set of class libraries, called PeterLib, and release it
> under the GPL. I download these libraries...like what you've done...and
> decide to use them in my development. Your library makes available a
> class called FooBar that I really like, and I decide to make use of it
> in a number of my own files.
>
> So, one of the core files in my application contains:
>
> <?
> require_once("/PeterLib/FooBar.inc");
>
> $myObj = new FooBar();
>
> $myObj->getFoo();
>
> $myObj->printBar();
>
> ?>
You may do that.
> Now, futher assume that I want to sell my application under my own
> company's license and I label all my files as such, but still retain
> your GPL license it the PeterLib files. I rush to market and have an
> overwhelming amount of customers in the first month.
>
> Four issues:
> 1. Have I violated the GPL by distributing your code with my
> "propietary", non-open source app? I'm still distributing source, but
> my specific files (including a few that call PeterLib classes) are not
> GPL'd.
Maybe. It depends on what "my own company's" license says. Specifically,
if it is a "GPL compatible" license, then no. For a list of
known-compatible licenses see
http://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses.
In practice when you say "my own company's license" you probably mean a
proprietary license. That would be a violation.
> 2. If I decided to only distribute my own source for money under my own
> propietary license, but told my customers that in order for my
> application to function correctly, they'd need to download PeterLib. Is
> this a violation?
I don't think that there is any way to be absolutely sure about that
without being sued. If you win, no. If you lose, yes ;-)
It /sounds/ like a loophole, since 1. you don't agree to the GPL to write
your program and 2. you don't distribute the GPLed code.
I think in all likelihood you would lose. Your program would be seen as a
derivative work.
> 3. If the above are considered violations, I assume only using
> libraries licensed under licenses like the LGPL or PHP would make it
> safe for me to redistribute with my proprietary app?
Right. This (should be)/is a conscious decision that is made by the
library's developer. If they want to let you link at will they use the
LGPL, if they want to extend the copyleft to linking programs they use the
GPL.
> 4. How do the above change if/when I decide to encode my self-written
> files with Zend Encoder?
This is an obfuscation utility? If so, the GPL excludes obfuscated source
code as "qualifying" as source code for the purpose of license compliance.
"Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange"
I.e. you can't give someone a printout of source code or an image of the
source code, you can't provide it on 1/4 inch tape or a stack of punch
cards, and you can't run the code through an "optimizer" or obfuscater
first.
> Thanks very much for all your input. Very helpful. I really appreciate
> it.
Glad to help.
-Peter
attached mail follows:
--- Jan Grafström <jan
lillemanshus.com> wrote:
> I want php to print " \tab"
echo " \\tab";
Chris
attached mail follows:
At 20:19 22-1-03, you wrote:
>Hi,
>
>I want php to print " \tab"
>but when I do, I only get "ab" as output.
>How do I keep the \t?
Jan, between "double quotes", several things are translated
this becomes
\t a tab
\r a carriage return
\n a newline
\" "
\\ \
There are more, see the documentation.
So to type \tab
use
' \tab ' (note that these are 'single quotes')
or
" \\tab "
attached mail follows:
You need to escape the '/' with a '/', as it is a special character.
So, anytime you run into an issue where it looks like PHP is trying to
interpret something you just want it to print. The best first guess is to
try and escape it.
Just Thought I would offer a little more explaination.
> --- Jan Grafström <jan
lillemanshus.com> wrote:
> > I want php to print " \tab"
>
> echo " \\tab";
>
> Chris
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> I want php to print " \tab"
> but when I do, I only get "ab" as output.
> How do I keep the \t?
\t is a tab character. If you looked in your source code, you'd see a
tab there. Use "\\tab"
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Hi,
Can anyone tell me what may be wrong with my email configuration? I
am using Microsoft Outlook with a Microsoft Exchange Server. My PHP programs
can no longer send emails. They were able to before, seems like it stopped
about a month ago. I don't believe I have changed anything. And it's not
only PHP, I'm also having trouble with other programming languages where I
did not before.
PHP4.0
attached mail follows:
I'm not sure how you are creating your array, but your resulting array
would look something like this:
Array
(
[name1]=>namevalue1
[a1]=>Array
(
[k1]=>value1
[k2]=>value2
)
[name2]=>namevalue2
[a2]=>Array
(...
You end up with a two dimensional array (avoiding the columns term) that
contains a name value and a values array for each entry.
On Wednesday, January 22, 2003, at 01:22 PM, David T-G wrote:
> Can you show me how? Currently I have
>
> Array
> (
> [a1] => Array
> (
> [k1] => value1
> [k2] => value2
> )
> [a2] => Array
> (
> [k1] => value1
> [k2] => value2
> )
> )
>
> and now I'll want to add a 'name' thingie (I daren't call it a
> column :-)
> so that I can change it at will ... but where and how do I add it?
>
>
-- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577
attached mail follows:
Not getting any responses so should I will plow through it, just wanted to try one more time.
-----Original Message-----
From: Edward Peloke [mailto:epeloke
echoman.com]
Sent: Wednesday, January 22, 2003 10:20 AM
To: php-general
lists.php.net
Subject: RE: [PHP] Is this just not possible?? ..create new odbc
connection..please help
yep, I am trying to come up with a way to get data out of an access db on the users machine and load it into the mysql db on the server. The only thing I can think of is have the user upload their db, php then creates a datasource, pumps over the data, deletes the db and datasource. My only problem with this method is if the db is large it may take them a while to upload it. Any other suggestions are greatly welcomed. I want it to be a 'one click' for the users so I don't want to ask them to export it to another format before uploading.
Thanks, Eddie
-----Original Message-----
From: Jason k Larson [mailto:jlarson
candlefire.org]
Sent: Wednesday, January 22, 2003 9:47 AM
To: Edward Peloke
Cc: php-general
lists.php.net
Subject: Re: [PHP] Is this just not possible?? ..create new odbc
connection..please help
Are you wanting to have PHP dynamically create ODBC datasources instead of creating them via the typical Control Panel method?
If so, and if possible, would be tricky, but I'll bet it can be done.
Regards, Jason k Larson
Edward Peloke wrote:
> Thanks Jason,
>
> I know how to connect to an odbc datasource but will this function also
> allow me to create one?
>
> Thanks,
> Eddie
>
> -----Original Message-----
> From: Jason k Larson [mailto:jlarson
candlefire.org]
> Sent: Wednesday, January 22, 2003 9:38 AM
> To: Edward Peloke
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Is this just not possible?? ..create new odbc
> connection..please help
>
>
> http://www.php.net/manual/en/function.odbc-connect.php
>
> Edward Peloke wrote:
>
>>Haven't had a single response so I am not sure if this isn't possible or
>>just really easy and something I should already know.
>>
>>Thanks,
>>Eddie
-- 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
attached mail follows:
Sure, you could do it any way you want. One way or another you need to get it into a variable, so how you get the template there doesn't really have any affect on your replace function.
I'm using the file based template so it's easy for users to modify. I "read" the template file into the output buffer, then store the buffer into a variable and clear the buffer: ob_start(); include("templateFile.tpl"); $tpl_content = ob_get_contents(); ob_end_clean();
The template is now stored in the $tpl_content variable. You could just as easily pull the template from a database. For the template file I place "data tags" in it that I do a search and replace on. Some common "tags" I use: {::PageTitle::}, {::MainData::},{::NavBar::}
You should try to use str_replace instead of ereg_replace since it's faster. Both support arrays for the search and replace part, so you can use one line of code to do 30, 40 or whatever replaces. I create an array of my data tags and another array of the matching data, then do: str_replace($tagArray,$dataArray,$formTemplate);
I can then provide a user who knows HTML a list of data tags (the contract) that they can place in a template anyway they want. The whole idea is to separate your data from your code from you presentation.
Hope that helps.
On Wednesday, January 22, 2003, at 01:06 PM, Jim Lucas wrote:
> In general, how do most template parsers work? > > do they read the file into a variable and do something > to the effect of preg_replace() to element that is found? > > and if so, could you replace the step of reading the file > into a variable with getting the template data out of a database? > > WARNING... more questions to come... > > Jim >
-- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577
attached mail follows:
Hi there, I've been using PHP for about 2 years now and absolutely love it! Our company uses it as our main development language, so far though, there is one thing that has been annoying me for a while now.. the following line of code will not work: $object->function1($parameter)->function2(); I receive a parse error when i try to call another function off of the object that function1 returns. I know this is possible in java: object.function1(parameter).function2(); VB: object.function1(paremeter).function2 and i'm sure C++, although i'm not too familiar with that language. My question is, will or is there any support for this kind of call in PHP? or is there another way that i should be doing it? as for now, here is my work around: $tmp =& $object->function1($parameter); $tmp->function2(); Thank you in advance! -Chris
-----------------------------------
_ _ _ _
|'|(_)|_)(_)|_(_)`-,
* * *
------------------------------------
Chris McCluskey Web Applications Engineer
Modulus, LLC
1720 Willow Creek Circle, Suite 520
Eugene, OR 97402
Email: chris
modulusgroup.com
Voice: +1 (541) 434-1024
Web..: http://www.modulusgroup.com <http://www.modulusgroup.com/>
============================================
The contents of this transmission may be
confidential in nature and should be
directed only to the person to whom it is
addressed. Do not read, copy, or disseminate
this material unless you are the intended
recipient. If this transmission reached you
in error, please forward the e-mail to the
sender to advise, then destroy the
transmission you received. Thank you.
attached mail follows:
Hi Chris,
Zend Engine 2.0 supports this syntax, and will be included with PHP 5. You can read all about zend 2 and its other improvements at http://www.zend.com
Greg
-- phpDocumentor http://www.phpdoc.org"Chris McCluskey" <chris
modulusgroup.com> wrote in message news:92BC9A90F2D7FD41AD97761F7E522C28064F8C
nx-enterprise.modulusgroup.com.. . Hi there, I've been using PHP for about 2 years now and absolutely love it! Our company uses it as our main development language, so far though, there is one thing that has been annoying me for a while now.. the following line of code will not work:
$object->function1($parameter)->function2();
I receive a parse error when i try to call another function off of the object that function1 returns. I know this is possible in java:
object.function1(parameter).function2();
VB:
object.function1(paremeter).function2
and i'm sure C++, although i'm not too familiar with that language.
My question is, will or is there any support for this kind of call in PHP? or is there another way that i should be doing it? as for now, here is my work around:
$tmp =& $object->function1($parameter); $tmp->function2();
Thank you in advance!
-Chris
----------------------------------- _ _ _ _ |'|(_)|_)(_)|_(_)`-, * * * ------------------------------------ Chris McCluskey Web Applications Engineer Modulus, LLC 1720 Willow Creek Circle, Suite 520 Eugene, OR 97402 Email: chris
modulusgroup.com Voice: +1 (541) 434-1024 Web..: http://www.modulusgroup.com <http://www.modulusgroup.com/> ====================== The contents of this transmission may be confidential in nature and should be directed only to the person to whom it is addressed. Do not read, copy, or disseminate this material unless you are the intended recipient. If this transmission reached you in error, please forward the e-mail to the sender to advise, then destroy the transmission you received. Thank you.
attached mail follows:
Is anyone using PHP to create custom error pages in IIS. I want to modify the 403 error page to do a redirect to HTTPS if it was requested with HTTP. I had someone try it, but they said it didn't work. I'm at work now and don't have a box to try it on until I get home. Does anyone have this working out there, so I know whether or not to spend my time on it?? Any pointers? Thanks for any info.
---John Holmes...
attached mail follows:
Have you tried http://www.iis-resource.com, they have some good resources.
>From: "1LT John W. Holmes" <holmes072000
charter.net>
>Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
>To: <php-general
lists.php.net>
>Subject: [PHP] Custom Error pages in IIS
>Date: Wed, 22 Jan 2003 15:08:58 -0500
>
>Is anyone using PHP to create custom error pages in IIS. I want to modify
>the 403 error page to do a redirect to HTTPS if it was requested with HTTP.
>I had someone try it, but they said it didn't work. I'm at work now and
>don't have a box to try it on until I get home. Does anyone have this
>working out there, so I know whether or not to spend my time on it?? Any
>pointers? Thanks for any info.
>
>---John Holmes...
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
attached mail follows:
No biggie, but you forgot an 's' on the address:
http://www.iis-resources.com, in case anyone was having trouble getting there.
Thank you for the link, though.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
> -----Original Message-----
> From: Didier McGillis [mailto:codesmoker
hotmail.com]
> Sent: Wednesday, January 22, 2003 4:42 PM
> To: holmes072000
charter.net; php-general
lists.php.net
> Subject: Re: [PHP] Custom Error pages in IIS
>
> Have you tried http://www.iis-resource.com, they have some good
resources.
>
>
>
>
>
>
> >From: "1LT John W. Holmes" <holmes072000
charter.net>
> >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> >To: <php-general
lists.php.net>
> >Subject: [PHP] Custom Error pages in IIS
> >Date: Wed, 22 Jan 2003 15:08:58 -0500
> >
> >Is anyone using PHP to create custom error pages in IIS. I want to
modify
> >the 403 error page to do a redirect to HTTPS if it was requested with
> HTTP.
> >I had someone try it, but they said it didn't work. I'm at work now
and
> >don't have a box to try it on until I get home. Does anyone have this
> >working out there, so I know whether or not to spend my time on it??
Any
> >pointers? Thanks for any info.
> >
> >---John Holmes...
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Everyone,
I'm stumped by this, even after searching the archives and the web, although I admit the solution likely is something very obvious.
I've written a function to build a string of "breadcrumb" links for a web site directory similar to Yahoo, etc. It queries a categories table recursively until it reaches the root category, building a string of categories from the current category all the way back up to root. The function seems to work fine if I output directly from it using echo, but if I instead try to return the string to the global scope and then echo it, I get nothing. The line where I use echo/return is indicated below.
Thanks,
Andy
function breadcrumbs($category_id=0,$mode='linked'){
global $id_array,$name_array;
static $counter = 0;
if ($category_id == 0) {
//once we're down to the root, build a return string
if ($mode == 'linked') {
$output = '<A HREF="' . $_SERVER['PHP_SELF'] . '">HOME</A>';
} else {
$output = 'HOME';
}
while($counter > 0){
if ($mode == 'linked') {
$output .= ' > <A HREF="' . $_SERVER['PHP_SELF'] . '?category_id=' . array_pop($id_array) . '">' . array_pop($name_array) . '</A>';
} else {
$output .= ' > ' . array_pop($name_array);
}
$counter--;
}
return $output; /*<--------HERE: IF I SUBSTITUTE "ECHO" FOR "RETURN", EVERYTHING WORKS; BUT WITH "RETURN", IT DOESN'T WORK*/
} else {
$sql = 'SELECT category_id, parent_cat, category_name FROM web_categories WHERE category_id = ' . $category_id;
$result = safe_query($sql);
while($query_data = mysql_fetch_assoc($result)){
$id_array[$counter] = $query_data['category_id'];
$name_array[$counter] = $query_data['category_name'];
//now, move one step up and make the current category the previous parent
$category_id = $query_data['parent_cat'];
$counter++;
breadcrumbs($category_id,$mode);
}
}
}
$show = breadcrumbs(9);
echo $show;
attached mail follows:
I think it will work if you return true, and just modify the global variable (not try to output it).
Then output it (or capture it to begin with ($total_count = OneHundred();) after the function is called.
You could also pass the variable, rather than making it global (OneHundred("0") initially, and OneHundred($count) from within the function).
For instance:
<?php
function OneHundred(){ global $count;
if($count < 100){ $count++; OneHundred(); } return true; }
OneHundred();
echo $count;
?>
Hope that helps, Brian
> -----Original Message-----
> From: Andy Crain [mailto:apcrain
fuse.net]
> Sent: Wednesday, January 22, 2003 1:23 PM
> To: php-general
lists.php.net
> Subject: [PHP] Returning a value from a recursive function
>
>
> Everyone,
>
> I'm stumped by this, even after searching the archives and the web,
> although I admit the solution likely is something very obvious.
>
>
>
> I've written a function to build a string of "breadcrumb" links for a
> web site directory similar to Yahoo, etc. It queries a
> categories table
> recursively until it reaches the root category, building a string of
> categories from the current category all the way back up to root. The
> function seems to work fine if I output directly from it
> using echo, but
> if I instead try to return the string to the global scope and
> then echo
> it, I get nothing. The line where I use echo/return is
> indicated below.
>
> Thanks,
>
> Andy
>
>
>
> function breadcrumbs($category_id=0,$mode='linked'){
>
> global $id_array,$name_array;
>
>
>
> static $counter = 0;
>
>
>
> if ($category_id == 0) {
>
> //once we're down to the root, build a return string
>
> if ($mode == 'linked') {
>
> $output = '<A HREF="' . $_SERVER['PHP_SELF'] . '">HOME</A>';
>
> } else {
>
> $output = 'HOME';
>
> }
>
> while($counter > 0){
>
> if ($mode == 'linked') {
>
> $output .= ' > <A HREF="' . $_SERVER['PHP_SELF'] .
> '?category_id=' . array_pop($id_array) . '">' .
> array_pop($name_array)
> . '</A>';
>
> } else {
>
> $output .= ' > ' . array_pop($name_array);
>
> }
>
> $counter--;
>
> }
>
> return $output; /*<--------HERE: IF I SUBSTITUTE "ECHO" FOR
> "RETURN", EVERYTHING WORKS; BUT WITH "RETURN", IT DOESN'T WORK*/
>
> } else {
>
> $sql = 'SELECT category_id, parent_cat, category_name FROM
> web_categories WHERE category_id = ' . $category_id;
>
> $result = safe_query($sql);
>
> while($query_data = mysql_fetch_assoc($result)){
>
> $id_array[$counter] = $query_data['category_id'];
>
> $name_array[$counter] = $query_data['category_name'];
>
> //now, move one step up and make the current category the
> previous parent
>
> $category_id = $query_data['parent_cat'];
>
> $counter++;
>
> breadcrumbs($category_id,$mode);
>
> }
>
> }
>
> }
>
>
>
> $show = breadcrumbs(9);
>
> echo $show;
>
>
attached mail follows:
Thanks very much, Brian. Your response helped me find the answer. On the recursive call to breadcrumbs(), the function wasn't actually returning anything to itself. I replaced "breadcrumbs()" with "return breadcrumbs()" and everything now works.
> -----Original Message-----
> From: Brian T. Allen [mailto:brian
gzmarketing.com]
> Sent: Wednesday, January 22, 2003 4:47 PM
> To: 'Andy Crain'; php-general
lists.php.net
> Subject: RE: [PHP] Returning a value from a recursive function
>
> I think it will work if you return true, and just modify the global
> variable (not try to output it).
>
> Then output it (or capture it to begin with ($total_count =
> OneHundred();) after the function is called.
>
> You could also pass the variable, rather than making it global
> (OneHundred("0") initially, and OneHundred($count) from within the
> function).
>
> For instance:
>
> <?php
>
> function OneHundred(){
> global $count;
>
> if($count < 100){
> $count++;
> OneHundred();
> }
>
> return true;
> }
>
> OneHundred();
>
> echo $count;
>
> ?>
>
>
> Hope that helps,
> Brian
>
> > -----Original Message-----
> > From: Andy Crain [mailto:apcrain
fuse.net]
> > Sent: Wednesday, January 22, 2003 1:23 PM
> > To: php-general
lists.php.net
> > Subject: [PHP] Returning a value from a recursive function
> >
> >
> > Everyone,
> >
> > I'm stumped by this, even after searching the archives and the web,
> > although I admit the solution likely is something very obvious.
> >
> >
> >
> > I've written a function to build a string of "breadcrumb" links for
a
> > web site directory similar to Yahoo, etc. It queries a
> > categories table
> > recursively until it reaches the root category, building a string of
> > categories from the current category all the way back up to root.
The
> > function seems to work fine if I output directly from it
> > using echo, but
> > if I instead try to return the string to the global scope and
> > then echo
> > it, I get nothing. The line where I use echo/return is
> > indicated below.
> >
> > Thanks,
> >
> > Andy
> >
> >
> >
> > function breadcrumbs($category_id=0,$mode='linked'){
> >
> > global $id_array,$name_array;
> >
> >
> >
> > static $counter = 0;
> >
> >
> >
> > if ($category_id == 0) {
> >
> > //once we're down to the root, build a return string
> >
> > if ($mode == 'linked') {
> >
> > $output = '<A HREF="' . $_SERVER['PHP_SELF'] .
'">HOME</A>';
> >
> > } else {
> >
> > $output = 'HOME';
> >
> > }
> >
> > while($counter > 0){
> >
> > if ($mode == 'linked') {
> >
> > $output .= ' > <A HREF="' . $_SERVER['PHP_SELF'] .
> > '?category_id=' . array_pop($id_array) . '">' .
> > array_pop($name_array)
> > . '</A>';
> >
> > } else {
> >
> > $output .= ' > ' . array_pop($name_array);
> >
> > }
> >
> > $counter--;
> >
> > }
> >
> > return $output; /*<--------HERE: IF I SUBSTITUTE "ECHO" FOR
> > "RETURN", EVERYTHING WORKS; BUT WITH "RETURN", IT DOESN'T WORK*/
> >
> > } else {
> >
> > $sql = 'SELECT category_id, parent_cat, category_name FROM
> > web_categories WHERE category_id = ' . $category_id;
> >
> > $result = safe_query($sql);
> >
> > while($query_data = mysql_fetch_assoc($result)){
> >
> > $id_array[$counter] = $query_data['category_id'];
> >
> > $name_array[$counter] = $query_data['category_name'];
> >
> > //now, move one step up and make the current category the
> > previous parent
> >
> > $category_id = $query_data['parent_cat'];
> >
> > $counter++;
> >
> > breadcrumbs($category_id,$mode);
> >
> > }
> >
> > }
> >
> > }
> >
> >
> >
> > $show = breadcrumbs(9);
> >
> > echo $show;
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello,
I have the code below, but it doesn't work. I see the message "It is an array" but nothing else. What can be the problem? How can I get the actual browser language?
I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on.
Thanks!
<?php global $HTTP_ACCEPT_LANGUAGE; $arr_lang = preg_split('/(\s*,\s*)/', $HTTP_ACCEPT_LANGUAGE); if (is_array($arr_lang)) { echo "It is an array"; $lang_first = strtolower((trim(strval($arr_lang[0])))); echo $lang_first; $lang_first = substr($lang_first, 0, 2); $lang = $lang_first; echo $lang; } ?>
attached mail follows:
When I run, $r = get_browser(); and take a look at the css value, I get 2. I would have figured that it could only be 0 (not supported) or 1 (supported). What are the possible values for get_browser()'s css, and what do those values mean?
attached mail follows:
Okay, if I understand everything correctly, something like this may work, if you can get around the issue of your file sizes being so large, and you can deal with the amount of memory this is going to eat up, and you realize that Perl is probably better suited to the job...
//read numbers $numbers = file("in.txt");
//read all lines from log file $fp = fopen("file.log","r"); $log_file = fread($fp,filesize("file.log"));
//match lines of log_file that start with 'code' //and match number preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches);
//put matches into an array such as // $array[code] = number $x=0; foreach($mathes[1] as $code) { $number = $matches[2][$x++]; $log_file_array[$code] = $number; }
//compute intersection of log file array //and numbers array $intersect = array_intersect($log_file_array,$numbers);
//flip the log array, so you now have //an array full of the lines in the log //file that matches a number in the in.txt file $answer = array_flip($intersect);
Hope that works... I can't test it. There are many ways you can do this...
--John Holmes...
----- Original Message -----
From: "Didier McGillis" <codesmoker
hotmail.com>
To: <holmes072000
charter.net>
Sent: Tuesday, January 21, 2003 5:49 PM
Subject: Re: [PHP] HELP HELP on a file parser
> Sorry should have done this.
>
> in.txt (there will be 470 of these #'s) - it uses these numbers to check
> against the chek.txt file
> 455784
> 455785
> 455786
> 455787
> 455788
>
> check.txt - after it checks this file where number=389487 a number from
> in.txt, if it does it writes that to another file
> not on q/n2 24 Sat Nov 12 00:27:34 2002
> 3 129 code=001;number=389487;name=Blah L
> McBlah;type=5;big_number=888888888;time=09;min=2004;
>
>
> found.txt gets written to either in this format
> not on q/n2 24 Sat Nov 12 00:27:34 2002
> 3 129 code=001;number=389487;name=Blah L
> McBlah;type=5;big_number=888888888;time=09;min=2004;
> or this format
> code=001;number=389487;name=Blah L
> McBlah;type=5;big_number=888888888;time=09;min=2004
>
> hope that helps.
>
>
> >From: "1LT John W. Holmes" <holmes072000
charter.net>
> >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> >To: "Didier McGillis" <codesmoker
hotmail.com>,
<php-general
lists.php.net>
> >Subject: Re: [PHP] HELP HELP on a file parser
> >Date: Tue, 21 Jan 2003 17:33:36 -0500
> >
> > > I need some help, I think this is probably really simple and I was
> >wondering
> > > if anyone had some code I could use to help me write this.
> > >
> > > I need a page to parse a text file with a list of numbers, and then
take
> > > those numbers and parse another file with over 7MB of information and
to
> > > look for those numbers and then to pull out the matches. Now the file
> >that
> > > its looking through each record that has a number in it is in a
specific
> > > format with a beginnning and an end.
> >
> >Can you give a short example of each file and what you want to match in
> >each?
> >
> >---John Holmes...
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
attached mail follows:
Fixed a couple of things in the code. Pretty good for psudo code. :)
But I get this error when running.
Warning: Argument #1 to array_intersect() is not an array in /home/httpd/vhosts/mccullough-net.com/httpdocs/GH/parse2.php on line 27
Warning: Wrong datatype in array_flip() call in /home/httpd/vhosts/mccullough-net.com/httpdocs/GH/parse2.php on line 32
code below. any thoughts on what might be choking it.
<? //read numbers $numbers = file("bad.txt");
//read all lines from log file $fp = fopen("file2.log","r"); $log_file = fread($fp,filesize("file2.log"));
$results = fopen ("results.txt", "w");
//match lines of log_file that start with 'code' //and match number preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches);
//put matches into an array such as // $array[code] = number $x=0; foreach($matches[1] as $code) { $number = $matches[2][$x++]; $log_file_array[$code] = $number; }
//compute intersection of log file array //and numbers array $intersect = array_intersect($log_file_array[$code],$numbers);
//flip the log array, so you now have //an array full of the lines in the log //file that matches a number in the in.txt file $answer = array_flip($intersect); fwrite ($results, $answer);
>From: "1LT John W. Holmes" <holmes072000
charter.net>
>Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
>To: "Didier McGillis" <codesmoker
hotmail.com>
>CC: <php-general
lists.php.net>
>Subject: Re: [PHP] HELP HELP on a file parser
>Date: Wed, 22 Jan 2003 16:07:17 -0500
>
>Okay, if I understand everything correctly, something like this may work,
>if
>you can get around the issue of your file sizes being so large, and you can
>deal with the amount of memory this is going to eat up, and you realize
>that
>Perl is probably better suited to the job...
>
>//read numbers
>$numbers = file("in.txt");
>
>//read all lines from log file
>$fp = fopen("file.log","r");
>$log_file = fread($fp,filesize("file.log"));
>
>//match lines of log_file that start with 'code'
>//and match number
>preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches);
>
>//put matches into an array such as
>// $array[code] = number
>$x=0;
>foreach($mathes[1] as $code)
>{
> $number = $matches[2][$x++];
> $log_file_array[$code] = $number;
>}
>
>//compute intersection of log file array
>//and numbers array
>$intersect = array_intersect($log_file_array,$numbers);
>
>//flip the log array, so you now have
>//an array full of the lines in the log
>//file that matches a number in the in.txt file
>$answer = array_flip($intersect);
>
>Hope that works... I can't test it. There are many ways you can do this...
>
>--John Holmes...
>----- Original Message -----
>From: "Didier McGillis" <codesmoker
hotmail.com>
>To: <holmes072000
charter.net>
>Sent: Tuesday, January 21, 2003 5:49 PM
>Subject: Re: [PHP] HELP HELP on a file parser
>
>
> > Sorry should have done this.
> >
> > in.txt (there will be 470 of these #'s) - it uses these numbers to check
> > against the chek.txt file
> > 455784
> > 455785
> > 455786
> > 455787
> > 455788
> >
> > check.txt - after it checks this file where number=389487 a number from
> > in.txt, if it does it writes that to another file
> > not on q/n2 24 Sat Nov 12 00:27:34 2002
> > 3 129 code=001;number=389487;name=Blah L
> > McBlah;type=5;big_number=888888888;time=09;min=2004;
> >
> >
> > found.txt gets written to either in this format
> > not on q/n2 24 Sat Nov 12 00:27:34 2002
> > 3 129 code=001;number=389487;name=Blah L
> > McBlah;type=5;big_number=888888888;time=09;min=2004;
> > or this format
> > code=001;number=389487;name=Blah L
> > McBlah;type=5;big_number=888888888;time=09;min=2004
> >
> > hope that helps.
> >
> >
> > >From: "1LT John W. Holmes" <holmes072000
charter.net>
> > >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> > >To: "Didier McGillis" <codesmoker
hotmail.com>,
><php-general
lists.php.net>
> > >Subject: Re: [PHP] HELP HELP on a file parser
> > >Date: Tue, 21 Jan 2003 17:33:36 -0500
> > >
> > > > I need some help, I think this is probably really simple and I was
> > >wondering
> > > > if anyone had some code I could use to help me write this.
> > > >
> > > > I need a page to parse a text file with a list of numbers, and then
>take
> > > > those numbers and parse another file with over 7MB of information
>and
>to
> > > > look for those numbers and then to pull out the matches. Now the
>file
> > >that
> > > > its looking through each record that has a number in it is in a
>specific
> > > > format with a beginnning and an end.
> > >
> > >Can you give a short example of each file and what you want to match in
> > >each?
> > >
> > >---John Holmes...
> > >
> > >
> > >--
> > >PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > _________________________________________________________________
> > STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
_________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
attached mail follows:
$intersect = array_intersect($log_file_array[$code],$numbers);
should be
$intersect = array_intersect($log_file_array,$numbers);
---John Holmes...
----- Original Message -----
From: "Didier McGillis" <codesmoker
hotmail.com>
To: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 4:23 PM
Subject: Re: [PHP] HELP HELP on a file parser
> Fixed a couple of things in the code. Pretty good for psudo code. :)
>
> But I get this error when running.
>
> Warning: Argument #1 to array_intersect() is not an array in
> /home/httpd/vhosts/mccullough-net.com/httpdocs/GH/parse2.php on line 27
>
> Warning: Wrong datatype in array_flip() call in
> /home/httpd/vhosts/mccullough-net.com/httpdocs/GH/parse2.php on line 32
>
> code below. any thoughts on what might be choking it.
>
> <?
> //read numbers
> $numbers = file("bad.txt");
>
> //read all lines from log file
> $fp = fopen("file2.log","r");
> $log_file = fread($fp,filesize("file2.log"));
>
> $results = fopen ("results.txt", "w");
>
> //match lines of log_file that start with 'code'
> //and match number
> preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches);
>
> //put matches into an array such as
> // $array[code] = number
> $x=0;
> foreach($matches[1] as $code)
> {
> $number = $matches[2][$x++];
> $log_file_array[$code] = $number;
> }
>
> //compute intersection of log file array
> //and numbers array
> $intersect = array_intersect($log_file_array[$code],$numbers);
>
> //flip the log array, so you now have
> //an array full of the lines in the log
> //file that matches a number in the in.txt file
> $answer = array_flip($intersect);
> fwrite ($results, $answer);
>
>
>
>
>
> >From: "1LT John W. Holmes" <holmes072000
charter.net>
> >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> >To: "Didier McGillis" <codesmoker
hotmail.com>
> >CC: <php-general
lists.php.net>
> >Subject: Re: [PHP] HELP HELP on a file parser
> >Date: Wed, 22 Jan 2003 16:07:17 -0500
> >
> >Okay, if I understand everything correctly, something like this may work,
> >if
> >you can get around the issue of your file sizes being so large, and you
can
> >deal with the amount of memory this is going to eat up, and you realize
> >that
> >Perl is probably better suited to the job...
> >
> >//read numbers
> >$numbers = file("in.txt");
> >
> >//read all lines from log file
> >$fp = fopen("file.log","r");
> >$log_file = fread($fp,filesize("file.log"));
> >
> >//match lines of log_file that start with 'code'
> >//and match number
> >preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches);
> >
> >//put matches into an array such as
> >// $array[code] = number
> >$x=0;
> >foreach($mathes[1] as $code)
> >{
> > $number = $matches[2][$x++];
> > $log_file_array[$code] = $number;
> >}
> >
> >//compute intersection of log file array
> >//and numbers array
> >$intersect = array_intersect($log_file_array,$numbers);
> >
> >//flip the log array, so you now have
> >//an array full of the lines in the log
> >//file that matches a number in the in.txt file
> >$answer = array_flip($intersect);
> >
> >Hope that works... I can't test it. There are many ways you can do
this...
> >
> >--John Holmes...
> >----- Original Message -----
> >From: "Didier McGillis" <codesmoker
hotmail.com>
> >To: <holmes072000
charter.net>
> >Sent: Tuesday, January 21, 2003 5:49 PM
> >Subject: Re: [PHP] HELP HELP on a file parser
> >
> >
> > > Sorry should have done this.
> > >
> > > in.txt (there will be 470 of these #'s) - it uses these numbers to
check
> > > against the chek.txt file
> > > 455784
> > > 455785
> > > 455786
> > > 455787
> > > 455788
> > >
> > > check.txt - after it checks this file where number=389487 a number
from
> > > in.txt, if it does it writes that to another file
> > > not on q/n2 24 Sat Nov 12 00:27:34 2002
> > > 3 129 code=001;number=389487;name=Blah L
> > > McBlah;type=5;big_number=888888888;time=09;min=2004;
> > >
> > >
> > > found.txt gets written to either in this format
> > > not on q/n2 24 Sat Nov 12 00:27:34 2002
> > > 3 129 code=001;number=389487;name=Blah L
> > > McBlah;type=5;big_number=888888888;time=09;min=2004;
> > > or this format
> > > code=001;number=389487;name=Blah L
> > > McBlah;type=5;big_number=888888888;time=09;min=2004
> > >
> > > hope that helps.
> > >
> > >
> > > >From: "1LT John W. Holmes" <holmes072000
charter.net>
> > > >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> > > >To: "Didier McGillis" <codesmoker
hotmail.com>,
> ><php-general
lists.php.net>
> > > >Subject: Re: [PHP] HELP HELP on a file parser
> > > >Date: Tue, 21 Jan 2003 17:33:36 -0500
> > > >
> > > > > I need some help, I think this is probably really simple and I was
> > > >wondering
> > > > > if anyone had some code I could use to help me write this.
> > > > >
> > > > > I need a page to parse a text file with a list of numbers, and
then
> >take
> > > > > those numbers and parse another file with over 7MB of information
> >and
> >to
> > > > > look for those numbers and then to pull out the matches. Now the
> >file
> > > >that
> > > > > its looking through each record that has a number in it is in a
> >specific
> > > > > format with a beginnning and an end.
> > > >
> > > >Can you give a short example of each file and what you want to match
in
> > > >each?
> > > >
> > > >---John Holmes...
> > > >
> > > >
> > > >--
> > > >PHP General Mailing List (http://www.php.net/)
> > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > > _________________________________________________________________
> > > STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> > > http://join.msn.com/?page=features/junkmail
> > >
>
>
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> $answer = array_flip($intersect); > fwrite ($results, $answer);
That won't work, either. It'll write "Array" to your file, probably.
You'll want this:
$answer = array_flip($intersect); $results_file = implode("\n",$answer); fwrite($results,$results_file);
---John Holmes...
----- Original Message -----
From: "Didier McGillis" <codesmoker
hotmail.com>
To: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 4:23 PM
Subject: Re: [PHP] HELP HELP on a file parser
> Fixed a couple of things in the code. Pretty good for psudo code. :) > > But I get this error when running. > > Warning: Argument #1 to array_intersect() is not an array in > /home/httpd/vhosts/mccullough-net.com/httpdocs/GH/parse2.php on line 27 > > Warning: Wrong datatype in array_flip() call in > /home/httpd/vhosts/mccullough-net.com/httpdocs/GH/parse2.php on line 32 > > code below. any thoughts on what might be choking it. > > <? > //read numbers > $numbers = file("bad.txt"); > > //read all lines from log file > $fp = fopen("file2.log","r"); > $log_file = fread($fp,filesize("file2.log")); > > $results = fopen ("results.txt", "w"); > > //match lines of log_file that start with 'code' > //and match number > preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches); > > //put matches into an array such as > // $array[code] = number > $x=0; > foreach($matches[1] as $code) > { > $number = $matches[2][$x++]; > $log_file_array[$code] = $number; > } > > //compute intersection of log file array > //and numbers array > $intersect = array_intersect($log_file_array[$code],$numbers); > > //flip the log array, so you now have > //an array full of the lines in the log > //file that matches a number in the in.txt file
>
>
>
>
>
> >From: "1LT John W. Holmes" <holmes072000
charter.net>
> >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> >To: "Didier McGillis" <codesmoker
hotmail.com>
> >CC: <php-general
lists.php.net>
> >Subject: Re: [PHP] HELP HELP on a file parser
> >Date: Wed, 22 Jan 2003 16:07:17 -0500
> >
> >Okay, if I understand everything correctly, something like this may work,
> >if
> >you can get around the issue of your file sizes being so large, and you
can
> >deal with the amount of memory this is going to eat up, and you realize
> >that
> >Perl is probably better suited to the job...
> >
> >//read numbers
> >$numbers = file("in.txt");
> >
> >//read all lines from log file
> >$fp = fopen("file.log","r");
> >$log_file = fread($fp,filesize("file.log"));
> >
> >//match lines of log_file that start with 'code'
> >//and match number
> >preg_match_all("/^(code.*number=([0-9]+).*)$/m",$log_file,$matches);
> >
> >//put matches into an array such as
> >// $array[code] = number
> >$x=0;
> >foreach($mathes[1] as $code)
> >{
> > $number = $matches[2][$x++];
> > $log_file_array[$code] = $number;
> >}
> >
> >//compute intersection of log file array
> >//and numbers array
> >$intersect = array_intersect($log_file_array,$numbers);
> >
> >//flip the log array, so you now have
> >//an array full of the lines in the log
> >//file that matches a number in the in.txt file
> >$answer = array_flip($intersect);
> >
> >Hope that works... I can't test it. There are many ways you can do
this...
> >
> >--John Holmes...
> >----- Original Message -----
> >From: "Didier McGillis" <codesmoker
hotmail.com>
> >To: <holmes072000
charter.net>
> >Sent: Tuesday, January 21, 2003 5:49 PM
> >Subject: Re: [PHP] HELP HELP on a file parser
> >
> >
> > > Sorry should have done this.
> > >
> > > in.txt (there will be 470 of these #'s) - it uses these numbers to
check
> > > against the chek.txt file
> > > 455784
> > > 455785
> > > 455786
> > > 455787
> > > 455788
> > >
> > > check.txt - after it checks this file where number=389487 a number
from
> > > in.txt, if it does it writes that to another file
> > > not on q/n2 24 Sat Nov 12 00:27:34 2002
> > > 3 129 code=001;number=389487;name=Blah L
> > > McBlah;type=5;big_number=888888888;time=09;min=2004;
> > >
> > >
> > > found.txt gets written to either in this format
> > > not on q/n2 24 Sat Nov 12 00:27:34 2002
> > > 3 129 code=001;number=389487;name=Blah L
> > > McBlah;type=5;big_number=888888888;time=09;min=2004;
> > > or this format
> > > code=001;number=389487;name=Blah L
> > > McBlah;type=5;big_number=888888888;time=09;min=2004
> > >
> > > hope that helps.
> > >
> > >
> > > >From: "1LT John W. Holmes" <holmes072000
charter.net>
> > > >Reply-To: "1LT John W. Holmes" <holmes072000
charter.net>
> > > >To: "Didier McGillis" <codesmoker
hotmail.com>,
> ><php-general
lists.php.net>
> > > >Subject: Re: [PHP] HELP HELP on a file parser
> > > >Date: Tue, 21 Jan 2003 17:33:36 -0500
> > > >
> > > > > I need some help, I think this is probably really simple and I was
> > > >wondering
> > > > > if anyone had some code I could use to help me write this.
> > > > >
> > > > > I need a page to parse a text file with a list of numbers, and
then
> >take
> > > > > those numbers and parse another file with over 7MB of information
> >and
> >to
> > > > > look for those numbers and then to pull out the matches. Now the
> >file
> > > >that
> > > > > its looking through each record that has a number in it is in a
> >specific
> > > > > format with a beginnning and an end.
> > > >
> > > >Can you give a short example of each file and what you want to match
in
> > > >each?
> > > >
> > > >---John Holmes...
> > > >
> > > >
> > > >--
> > > >PHP General Mailing List (http://www.php.net/)
> > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > > _________________________________________________________________
> > > STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> > > http://join.msn.com/?page=features/junkmail
> > >
>
>
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi! Is there a way to do the decryption of the encrypted data with the use of md5()??
attached mail follows:
> Hi! Is there a way to do the decryption of the encrypted data with the use > of md5()??
Nope. md5 is a one way function.
http://www.faqs.org/faqs/cryptography-faq/part07/
Brad
attached mail follows:
No. md5() is not an encryption, it's a hash.
----- Original Message -----
From: "Scott Fletcher" <scott
abcoa.com>
To: <>
Sent: Wednesday, January 22, 2003 3:47 PM
Subject: [PHP] Is there a way to undo the md5() encryption??
Hi! Is there a way to do the decryption of the encrypted data with the use of md5()??
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Darn!! There's no way to undo it. So, I can't use this method of encryption for my other project. In that case, I'll live.....
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20030122214206.71829.qmail
pb1.pair.com...
> Hi! Is there a way to do the decryption of the encrypted data with the
use
> of md5()??
>
>
attached mail follows:
I had it figured out!! Don't need to decrypt it. Instead, I can encrypt the account number by javascript. Grab the unencrypted account number. Put it into two variable, encrypt the first one with PHP and match it by Javascript. If accept then I use the 2nd variable to grab the data from the data and put it into the sessions. This will take care of the problem with my other project....
Cheers!!!!!
Thanks, Scott F.
"Brad Pauly" <brad
robinsontech.com> wrote in message
news:1043271786.1236.34.camel
earth...
> > Hi! Is there a way to do the decryption of the encrypted data with the
use
> > of md5()??
>
> Nope. md5 is a one way function.
>
> http://www.faqs.org/faqs/cryptography-faq/part07/
>
> Brad
>
attached mail follows:
Scott Fletcher said: > Darn!! There's no way to undo it. So, I can't use this method of > encryption for my other project. In that case, I'll live.....
Lemme guess? Was it going to be a revolutionary compression program that can compress any file to 128 bits?
In all seriousness, the output of MD5 is not encrypted, it is a digest. That, BTW, is what the D stands for.
-Peter
attached mail follows:
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20030122214206.71829.qmail
pb1.pair.com...
> Hi! Is there a way to do the decryption of the encrypted data with the
use
> of md5()??
nope, that's way it is called one-way function. But if you could, I assume it would be worth a big pile of money ;).
rush
-- http://www.templatetamer.org/> >
attached mail follows:
In article <3E2EAF18.9090908
optonline.net>, Scott Saraniero wrote:
> Hi,
>
> I'm using this line to send an e-mail with info:
>
> mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
>
> If I want to add mail recipients, or cc, or bcc, how would I do this?
add "cc: foo
bar.baz\n" etc. to your $mailheaders
-- Aquarion, http://www.aquarionics.com, aquarionsuespammers.org Happiness is good health and a bad memory. -- Ingrid Bergman
attached mail follows:
In article <3E2EAF18.9090908
optonline.net>, Scott Saraniero wrote:
> Hi,
>
> I'm using this line to send an e-mail with info:
>
> mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
>
> If I want to add mail recipients, or cc, or bcc, how would I do this?
add "cc: foo
bar.baz\n" etc. to your $mailheaders
-- Aquarion, http://www.aquarionics.com, aquarionsuespammers.org Happiness is good health and a bad memory. -- Ingrid Bergman
attached mail follows:
In article <3E2EAF18.9090908
optonline.net>, Scott Saraniero wrote:
> Hi,
>
> I'm using this line to send an e-mail with info:
>
> mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
>
> If I want to add mail recipients, or cc, or bcc, how would I do this?
add "cc: foo
bar.baz\n" etc. to your $mailheaders
-- Aquarion, http://www.aquarionics.com, aquarionsuespammers.org Happiness is good health and a bad memory. -- Ingrid Bergman
attached mail follows:
> > I'm using this line to send an e-mail with info:
> >
> > mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
> >
> > If I want to add mail recipients, or cc, or bcc, how would I do this?
>
> add "cc: foo
bar.baz\n" etc. to your $mailheaders
Use \r\n to separate headers, not just \n.
---John Holmes...
attached mail follows:
In article <3E2EAF18.9090908
optonline.net>, Scott Saraniero wrote:
> Hi,
>
> I'm using this line to send an e-mail with info:
>
> mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
>
> If I want to add mail recipients, or cc, or bcc, how would I do this?
add "cc: foo
bar.baz\n" etc. to your $mailheaders
-- Aquarion, http://www.aquarionics.com, aquarionsuespammers.org Happiness is good health and a bad memory. -- Ingrid Bergman
attached mail follows:
In article <3E2EAF18.9090908
optonline.net>, Scott Saraniero wrote:
> Hi,
>
> I'm using this line to send an e-mail with info:
>
> mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
>
> If I want to add mail recipients, or cc, or bcc, how would I do this?
add "cc: foo
bar.baz\n" etc. to your $mailheaders
-- Aquarion, http://www.aquarionics.com, aquarionsuespammers.org Happiness is good health and a bad memory. -- Ingrid Bergman
attached mail follows:
In article <3E2EAF18.9090908
optonline.net>, Scott Saraniero wrote:
> Hi,
>
> I'm using this line to send an e-mail with info:
>
> mail("abc
domain.com", "$Event Ticket Form", $msg, $mailheaders);
>
> If I want to add mail recipients, or cc, or bcc, how would I do this?
add "cc: foo
bar.baz\n" etc. to your $mailheaders
-- Aquarion, http://www.aquarionics.com, aquarionsuespammers.org Happiness is good health and a bad memory. -- Ingrid Bergman
attached mail follows:
Hi,
I'm new to php (ok new, try 3 days ;), althought, I'm finding it fun, I 'm trying to think of a project to do, to get me more into it.
And after having a discussion with a friend and also setting up several Mailman mailing lists for people that want to compose HTML mails and post them as newsletters, it got me thinking, would I be able to create a similar program to mailman in php?
So admins just login to the list. copy and past the html into a text box and php then renders it for a preview, then if they like it, they click send, this send queries the database and sends it to all the people list to receive mail on that list.
I would assume that the sending could be handed off somehow to sendmail/postfix?
The list front end would also hold list preferances as well, for subscribers and admins, basically I want to mimik Mailman, but in php and be able to render previews of mails first, basically it will be a newsletter program, rather than a mailing list one, which is where Mailman falls over.
Cheers
Mark
-- To steal ideas from one person is plagiarism; to steal from many is research.
attached mail follows:
Hello,
On 01/22/2003 08:15 PM, Mark C wrote: > I'm new to php (ok new, try 3 days ;), althought, I'm finding it fun, I > 'm trying to think of a project to do, to get me more into it. > > And after having a discussion with a friend and also setting up several > Mailman mailing lists for people that want to compose HTML mails and > post them as newsletters, it got me thinking, would I be able to create > a similar program to mailman in php? > > So admins just login to the list. copy and past the html into a text box > and php then renders it for a preview, then if they like it, they click > send, this send queries the database and sends it to all the people list > to receive mail on that list. > > I would assume that the sending could be handed off somehow to > sendmail/postfix?
Yes, but you are recommend to set sendmail with the appropriate queuing flags so it does not stall your PHP script while attempting to deliver to every subscribers and instead just queue the messages without delay.
In that case you may want to try this class for composing and sending messages, that has a sub-class for sending using sendmail program directly. It already comes with options that let you tell to just queue the messages without delay as needed.
http://www.phpclasses.org/mimemessage
> The list front end would also hold list preferances as well, for > subscribers and admins, > basically I want to mimik Mailman, but in php and be able to render > previews of mails first, basically it will be a newsletter program, > rather than a mailing list one, which is where Mailman falls over.
Yes, but keep in mind that besides composing and sending messages, you also have to take care of creating subscriber records, validating subscriber addresses, handling bounces, handling unsubscriptions, etc... and dedicating mailing list manager programs already do that.
--Regards, Manuel Lemos
attached mail follows:
Yes, this is a reasonable candidate for a PHP project, however:
1. why reinvent the wheel?
2. There are some serious issues with using PHP's mail() command:
a) large mailing lists will time out on individual emails
b) the alternative to a is to use Bcc. Your ISP will probably set the maximum to 100 emails in a Bcc, which throws that idea out the window
c) the alternative to a and b seems to be injecting emails directly into the mail que with sendmail, and all sorts of stuff I haven't looked into yet.
There is a class (not not a tutorial, a class in OOP way) on phpclasses.org which offers (what seems to be) every answer to the above issues, but I've never used it, and it's OOP nature may be a complex way to get into PHP.
There are literally 100's of threads about mailing lists in the archives.
Justin
on 23/01/03 9:15 AM, Mark C (gen-lists
blueyonder.co.uk) wrote:
> Hi, > > I'm new to php (ok new, try 3 days ;), althought, I'm finding it fun, I > 'm trying to think of a project to do, to get me more into it. > > And after having a discussion with a friend and also setting up several > Mailman mailing lists for people that want to compose HTML mails and > post them as newsletters, it got me thinking, would I be able to create > a similar program to mailman in php? > > So admins just login to the list. copy and past the html into a text box > and php then renders it for a preview, then if they like it, they click > send, this send queries the database and sends it to all the people list > to receive mail on that list. > > I would assume that the sending could be handed off somehow to > sendmail/postfix? > > The list front end would also hold list preferances as well, for > subscribers and admins, > basically I want to mimik Mailman, but in php and be able to render > previews of mails first, basically it will be a newsletter program, > rather than a mailing list one, which is where Mailman falls over. > > Cheers > > Mark >
attached mail follows:
On Wednesday 22 January 2003 18:52, 1LT John W. Holmes wrote:
> There's really no change from the PHP side. PHP just sends the data and > receives something back The only change in PHP is that mysql_connect() now > supports additional flags to connect over SSL.
Nope, I only forgot to remove a constant. SSL support will be available in PHP 5 (new mysql extension).
Regards
Georg
attached mail follows:
> On Wednesday 22 January 2003 18:52, 1LT John W. Holmes wrote: > > > There's really no change from the PHP side. PHP just sends the data and > > receives something back The only change in PHP is that mysql_connect() > now > > supports additional flags to connect over SSL. > > Nope, I only forgot to remove a constant. SSL support will be available in > PHP 5 (new mysql extension). > > Regards > > Georg
Ah, man... Now you made my article in the last issue of PHP|Architect incorrect! :)
Oh well, I guess we'll have to wait.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
When I insert a date into Mysql it has to be in year/month/day format or else it wont go in right. how do I convert my date variable which is in month /day /year format into year/month/day format?
-- Productos de salud: http://www.nvtechnologies.com/hgh
attached mail follows:
Hi Guys,
Does anyone happen to know why the below code reads the directory in reverse alphabetical order? Not a major problem - easy enough to whack it in an array and sort it, but annoying nonetheless.
$default_dir = "../screenshots";
if (!($dp = opendir($default_dir))) die("cannot open $default_dir"); while($file = readdir($dp)) if($file != '.' && $file != '..') echo"<a href='opendir.php?opendir=$file'>$file</a><BR>"; closedir($dp);
Best Regards Bob Irwin Server Admin & Web Programmer Planet Netcom
attached mail follows:
is it on a unix system?
if so, do an ls on the system and you will see that the files are listed in that order.
it is the order in which they were copied to the directory.
try going through a loop before you run your main loop, create an array() then sort that with some sorting functions and you'll have it.
Jim
----- Original Message -----
From: "Bob Irwin" <bob
staff.pnc.com.au>
To: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 3:03 PM
Subject: [PHP] Reading Directory in reverse
> Hi Guys, > > Does anyone happen to know why the below code reads the directory in reverse > alphabetical order? Not a major problem - easy enough to whack it in an > array and sort it, but annoying nonetheless. > > > $default_dir = "../screenshots"; > > if (!($dp = opendir($default_dir))) die("cannot open $default_dir"); > while($file = readdir($dp)) > if($file != '.' && $file != '..') echo"<a > href='opendir.php?opendir=$file'>$file</a><BR>"; > closedir($dp); > > Best Regards > Bob Irwin > Server Admin & Web Programmer > Planet Netcom > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
I SETUP THE PHP PARSE ENGINE ON ABOUT A YEAR AGO ON ONE OF MY WEB SERVERS AND EVERYTHING WORKED JUST FINE. I, HOWEVER, RECENTLY ACQUIRED A NEW SERVER AND TRIED TO SETUP PHP AGAIN ON IIS 5.0 ON A WIN 2K SERVER PLATFORM. EVERYTHING SEEMS TO BE WORKING CORRECTLY, BUT FOR SOME REASONS WHEN I TRY TO ACCESS ANY VARIABLES PASSED FROM A HTML FORM, I ALWAYS GET AN ERROR.
FOR EXAMPLE IF I HAVE A FORM THAT PASSES THE VARIABLE $ACTION I GET THE FOLLOW ERROR WHEN I TRY TO ACCESS THE SAME VARIABLE IN PHP PAGE:
Notice: Undefined variable: action in C:\...\otelzoo.com\cust_care.php on line 9
I HAVE REINSTALLED THE PHP PARSER THREE TIMES NOW AND I HAVE HAD NO LUCK IN GETTING RID OF THIS PROBLEM. I KNOW MOST PEOPLE WILL JUMP TO THE CONCLUSION THAT THERE IS A SIMPLE ERROR IN THE ACTUAL SOURCE CODE ITSELF, BUT I PROMISE YOU THAT I HAVE BEEN PROGRAMMING IN THIS LANGUAGE FOR AT LEAST TWO YEARS AND I AM 100% SURE THAT I AM PASSING THE VARIABLE CORRECTLY.
PLEASE HELP.
THANK YOU. - DALE
attached mail follows:
Global Variables are turned off!!! check php.ini!!
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Dale [mailto:DaleHersh
hotmail.com]
> Sent: Thursday, 23 January 2003 10:02 AM
> To: php-general
lists.php.net
> Subject: [PHP] NEED HELP URGENTLY
>
>
> I SETUP THE PHP PARSE ENGINE ON ABOUT A YEAR AGO ON ONE OF MY
> WEB SERVERS AND EVERYTHING WORKED JUST FINE. I, HOWEVER,
> RECENTLY ACQUIRED A NEW SERVER AND TRIED TO SETUP PHP AGAIN
> ON IIS 5.0 ON A WIN 2K SERVER PLATFORM. EVERYTHING SEEMS TO
> BE WORKING CORRECTLY, BUT FOR SOME REASONS WHEN I TRY TO
> ACCESS ANY VARIABLES PASSED FROM A HTML FORM, I ALWAYS GET AN ERROR.
>
> FOR EXAMPLE IF I HAVE A FORM THAT PASSES THE VARIABLE $ACTION
> I GET THE FOLLOW ERROR WHEN I TRY TO ACCESS THE SAME VARIABLE
> IN PHP PAGE:
>
> Notice: Undefined variable: action in
> C:\...\otelzoo.com\cust_care.php on line 9
>
> I HAVE REINSTALLED THE PHP PARSER THREE TIMES NOW AND I HAVE
> HAD NO LUCK IN GETTING RID OF THIS PROBLEM. I KNOW MOST
> PEOPLE WILL JUMP TO THE CONCLUSION THAT THERE IS A SIMPLE
> ERROR IN THE ACTUAL SOURCE CODE ITSELF, BUT I PROMISE YOU
> THAT I HAVE BEEN PROGRAMMING IN THIS LANGUAGE FOR AT LEAST
> TWO YEARS AND I AM 100% SURE THAT I AM PASSING THE VARIABLE CORRECTLY.
>
> PLEASE HELP.
>
> THANK YOU.
> - DALE
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
AND PLEASE STOP YELLING!!!!!!!!
HiTCHO said:
> Global Variables are turned off!!! check php.ini!!
>
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: tim
hitcho.com.au
>
>> -----Original Message-----
>> From: Dale [mailto:DaleHersh
hotmail.com]
>> Sent: Thursday, 23 January 2003 10:02 AM
>> To: php-general
lists.php.net
>> Subject: [PHP] NEED HELP URGENTLY
>>
>>
>> I SETUP THE PHP PARSE ENGINE ON ABOUT A YEAR AGO ON ONE OF MY
>> WEB SERVERS AND EVERYTHING WORKED JUST FINE. I, HOWEVER,
>> RECENTLY ACQUIRED A NEW SERVER AND TRIED TO SETUP PHP AGAIN
>> ON IIS 5.0 ON A WIN 2K SERVER PLATFORM. EVERYTHING SEEMS TO
>> BE WORKING CORRECTLY, BUT FOR SOME REASONS WHEN I TRY TO
>> ACCESS ANY VARIABLES PASSED FROM A HTML FORM, I ALWAYS GET AN ERROR.
>>
>> FOR EXAMPLE IF I HAVE A FORM THAT PASSES THE VARIABLE $ACTION
>> I GET THE FOLLOW ERROR WHEN I TRY TO ACCESS THE SAME VARIABLE
>> IN PHP PAGE:
>>
>> Notice: Undefined variable: action in
>> C:\...\otelzoo.com\cust_care.php on line 9
>>
>> I HAVE REINSTALLED THE PHP PARSER THREE TIMES NOW AND I HAVE
>> HAD NO LUCK IN GETTING RID OF THIS PROBLEM. I KNOW MOST
>> PEOPLE WILL JUMP TO THE CONCLUSION THAT THERE IS A SIMPLE
>> ERROR IN THE ACTUAL SOURCE CODE ITSELF, BUT I PROMISE YOU
>> THAT I HAVE BEEN PROGRAMMING IN THIS LANGUAGE FOR AT LEAST
>> TWO YEARS AND I AM 100% SURE THAT I AM PASSING THE VARIABLE CORRECTLY.
>>
>> PLEASE HELP.
>>
>> THANK YOU.
>> - DALE
>>
>>
>>
>>
>> --
>> 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
attached mail follows:
First of all, you don't need to type in all caps like that. I thought this was the Nigerian Scam for a minute there! :-) Anyway, in PHP 4.2+, the php.ini setting register_globals is off by default. You'll need to either turn it on, or start using the newer $_POST superglobal array. For more information, take a look at http://www.php.net/manual/en/security.registerglobals.php.
Dale wrote:
>I SETUP THE PHP PARSE ENGINE ON ABOUT A YEAR AGO ON ONE OF MY WEB SERVERS >AND EVERYTHING WORKED JUST FINE. I, HOWEVER, RECENTLY ACQUIRED A NEW SERVER >AND TRIED TO SETUP PHP AGAIN ON IIS 5.0 ON A WIN 2K SERVER PLATFORM. >EVERYTHING SEEMS TO BE WORKING CORRECTLY, BUT FOR SOME REASONS WHEN I TRY TO >ACCESS ANY VARIABLES PASSED FROM A HTML FORM, I ALWAYS GET AN ERROR. > >FOR EXAMPLE IF I HAVE A FORM THAT PASSES THE VARIABLE $ACTION I GET THE >FOLLOW ERROR WHEN I TRY TO ACCESS THE SAME VARIABLE IN PHP PAGE: > >Notice: Undefined variable: action in C:\...\otelzoo.com\cust_care.php on >line 9 > >I HAVE REINSTALLED THE PHP PARSER THREE TIMES NOW AND I HAVE HAD NO LUCK IN >GETTING RID OF THIS PROBLEM. I KNOW MOST PEOPLE WILL JUMP TO THE CONCLUSION >THAT THERE IS A SIMPLE ERROR IN THE ACTUAL SOURCE CODE ITSELF, BUT I PROMISE >YOU THAT I HAVE BEEN PROGRAMMING IN THIS LANGUAGE FOR AT LEAST TWO YEARS AND >I AM 100% SURE THAT I AM PASSING THE VARIABLE CORRECTLY. > >PLEASE HELP. > >THANK YOU. >- DALE > > > > > >
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
attached mail follows:
And then read some articles or news on the language you've been "programming in for two years"
---John Holmes...
> -----Original Message-----
> From: Timothy Hitchens (HiTCHO) [mailto:hitcho
php.net]
> Sent: Wednesday, January 22, 2003 6:58 PM
> To: 'Dale'; php-general
lists.php.net
> Subject: RE: [PHP] NEED HELP URGENTLY
>
> Global Variables are turned off!!! check php.ini!!
>
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: tim
hitcho.com.au
>
> > -----Original Message-----
> > From: Dale [mailto:DaleHersh
hotmail.com]
> > Sent: Thursday, 23 January 2003 10:02 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] NEED HELP URGENTLY
> >
> >
> > I SETUP THE PHP PARSE ENGINE ON ABOUT A YEAR AGO ON ONE OF MY
> > WEB SERVERS AND EVERYTHING WORKED JUST FINE. I, HOWEVER,
> > RECENTLY ACQUIRED A NEW SERVER AND TRIED TO SETUP PHP AGAIN
> > ON IIS 5.0 ON A WIN 2K SERVER PLATFORM. EVERYTHING SEEMS TO
> > BE WORKING CORRECTLY, BUT FOR SOME REASONS WHEN I TRY TO
> > ACCESS ANY VARIABLES PASSED FROM A HTML FORM, I ALWAYS GET AN ERROR.
> >
> > FOR EXAMPLE IF I HAVE A FORM THAT PASSES THE VARIABLE $ACTION
> > I GET THE FOLLOW ERROR WHEN I TRY TO ACCESS THE SAME VARIABLE
> > IN PHP PAGE:
> >
> > Notice: Undefined variable: action in
> > C:\...\otelzoo.com\cust_care.php on line 9
> >
> > I HAVE REINSTALLED THE PHP PARSER THREE TIMES NOW AND I HAVE
> > HAD NO LUCK IN GETTING RID OF THIS PROBLEM. I KNOW MOST
> > PEOPLE WILL JUMP TO THE CONCLUSION THAT THERE IS A SIMPLE
> > ERROR IN THE ACTUAL SOURCE CODE ITSELF, BUT I PROMISE YOU
> > THAT I HAVE BEEN PROGRAMMING IN THIS LANGUAGE FOR AT LEAST
> > TWO YEARS AND I AM 100% SURE THAT I AM PASSING THE VARIABLE
CORRECTLY.
> >
> > PLEASE HELP.
> >
> > THANK YOU.
> > - DALE
> >
> >
> >
> >
> > --
> > 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
attached mail follows:
Hi,
I'm trying to construct a regular expression to find HTML open tags without closing tags up to another of the same HTML open tag or a closing tag of a different type that's no enclosed in the implied closing tag optional HTML tag (for example <p> doesn't require a closing tag. The closing tag is implied and so is its body).
For example, the HTML snippet:
<html><head><title>Test HTML</title></head> <body> <p><font>This tag is ok<br></font></p> <font><p>I want to find this p tag<br> and up to the next opening p tag<br> <b>test<br></b></font> <p>I want to find this one too </body>
I don't want to find <p> tags with a complete structure. ex: <p>This is a <p> tag with a complete structure</p>
Instead, I want to find the <p> tag with no closing tag, up to the next <p> tag or a closing tag of any type that doesn't have an opening tag after the initial <p> found (not including this orphaned closing tag)
Andreas Sheriff
attached mail follows:
Hi...
A simple question... In the following code:
<?
$ip = getenv("REMOTE_ADDR");
echo " ip = ".$ip;
echo " ip = " . getenv("REMOTE_ADDR");
echo " ip = " . getenv('REMOTE_ADDR');
echo " ip = ". $REMOTE_ADDR; <------
?>
I can only seem to get the last line to display the correct value. It's as if I can't seem to get/return any of the SERVER environment variables using the getenv() function....
I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
I've checked through the PHP.INI file, but couldn't seem to find why this might be occuring. Any help/assistance would be appreciated.....
thanks
bruce
bedouglas
earthlink.net
attached mail follows:
just copied your code and it worked fine for me.
system: Apache 1.3.26 PHP 4.2.2
I would look into apache 2.0 and the env vars that are available from it.
----- Original Message -----
From: "Bruce Douglas" <bedouglas
earthlink.net>
To: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 3:57 PM
Subject: [PHP] a simple getenv question....
> Hi...
>
> A simple question... In the following code:
>
> <?
>
> $ip = getenv("REMOTE_ADDR");
>
> echo " ip = ".$ip;
>
> echo " ip = " . getenv("REMOTE_ADDR");
>
> echo " ip = " . getenv('REMOTE_ADDR');
>
> echo " ip = ". $REMOTE_ADDR; <------
>
> ?>
>
> I can only seem to get the last line to display the correct value. It's as
> if I can't seem to get/return any of the SERVER environment variables
using
> the getenv() function....
>
> I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
>
> I've checked through the PHP.INI file, but couldn't seem to find why this
> might be occuring. Any help/assistance would be appreciated.....
>
> thanks
>
> bruce
> bedouglas
earthlink.net
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
The simplest way to start looking would be phpinfo() page for starters.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Jim Lucas [mailto:phplist
zonedzero.net]
> Sent: Thursday, 23 January 2003 10:15 AM
> To: Bruce Douglas; php-general
lists.php.net
> Subject: Re: [PHP] a simple getenv question....
>
>
> just copied your code and it worked fine for me.
>
> system: Apache 1.3.26
> PHP 4.2.2
>
> I would look into apache 2.0 and the env vars that are
> available from it.
>
>
> ----- Original Message -----
> From: "Bruce Douglas" <bedouglas
earthlink.net>
> To: <php-general
lists.php.net>
> Sent: Wednesday, January 22, 2003 3:57 PM
> Subject: [PHP] a simple getenv question....
>
>
> > Hi...
> >
> > A simple question... In the following code:
> >
> > <?
> >
> > $ip = getenv("REMOTE_ADDR");
> >
> > echo " ip = ".$ip;
> >
> > echo " ip = " . getenv("REMOTE_ADDR");
> >
> > echo " ip = " . getenv('REMOTE_ADDR');
> >
> > echo " ip = ". $REMOTE_ADDR; <------
> >
> > ?>
> >
> > I can only seem to get the last line to display the correct value.
> > It's as if I can't seem to get/return any of the SERVER environment
> > variables
> using
> > the getenv() function....
> >
> > I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
> >
> > I've checked through the PHP.INI file, but couldn't seem to
> find why
> > this might be occuring. Any help/assistance would be
> appreciated.....
> >
> > thanks
> >
> > bruce
> > bedouglas
earthlink.net
> >
> >
> >
> > --
> > 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
>
attached mail follows:
phpinfo() returns everything as expected.. but not having the code .. i don't know what internal method it uses to access the information...
but thanks...
-bruce
-----Original Message-----
From: Timothy Hitchens (HiTCHO) [mailto:hitcho
php.net]
Sent: Wednesday, January 22, 2003 4:18 PM
To: 'Jim Lucas'; 'Bruce Douglas'; php-general
lists.php.net
Subject: RE: [PHP] a simple getenv question....
The simplest way to start looking would be phpinfo() page for starters.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Jim Lucas [mailto:phplist
zonedzero.net]
> Sent: Thursday, 23 January 2003 10:15 AM
> To: Bruce Douglas; php-general
lists.php.net
> Subject: Re: [PHP] a simple getenv question....
>
>
> just copied your code and it worked fine for me.
>
> system: Apache 1.3.26
> PHP 4.2.2
>
> I would look into apache 2.0 and the env vars that are
> available from it.
>
>
> ----- Original Message -----
> From: "Bruce Douglas" <bedouglas
earthlink.net>
> To: <php-general
lists.php.net>
> Sent: Wednesday, January 22, 2003 3:57 PM
> Subject: [PHP] a simple getenv question....
>
>
> > Hi...
> >
> > A simple question... In the following code:
> >
> > <?
> >
> > $ip = getenv("REMOTE_ADDR");
> >
> > echo " ip = ".$ip;
> >
> > echo " ip = " . getenv("REMOTE_ADDR");
> >
> > echo " ip = " . getenv('REMOTE_ADDR');
> >
> > echo " ip = ". $REMOTE_ADDR; <------
> >
> > ?>
> >
> > I can only seem to get the last line to display the correct value.
> > It's as if I can't seem to get/return any of the SERVER environment
> > variables
> using
> > the getenv() function....
> >
> > I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
> >
> > I've checked through the PHP.INI file, but couldn't seem to
> find why
> > this might be occuring. Any help/assistance would be
> appreciated.....
> >
> > thanks
> >
> > bruce
> > bedouglas
earthlink.net
> >
> >
> >
> > --
> > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Do this:
<?php
print_r($_SERVER);
?>
If what you want is here this just use: $_SERVER['REMOTE_ADDR'] etc
You will need to have a look at the source of the output as the rendered view will look a little strange.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Bruce Douglas [mailto:bedouglas
earthlink.net]
> Sent: Thursday, 23 January 2003 10:33 AM
> To: php-general
lists.php.net
> Subject: RE: [PHP] a simple getenv question....
>
>
> phpinfo() returns everything as expected.. but not having the
> code .. i don't know what internal method it uses to access
> the information...
>
> but thanks...
>
> -bruce
>
>
> -----Original Message-----
> From: Timothy Hitchens (HiTCHO) [mailto:hitcho
php.net]
> Sent: Wednesday, January 22, 2003 4:18 PM
> To: 'Jim Lucas'; 'Bruce Douglas'; php-general
lists.php.net
> Subject: RE: [PHP] a simple getenv question....
>
>
> The simplest way to start looking would be phpinfo() page for
> starters.
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: tim
hitcho.com.au
>
> > -----Original Message-----
> > From: Jim Lucas [mailto:phplist
zonedzero.net]
> > Sent: Thursday, 23 January 2003 10:15 AM
> > To: Bruce Douglas; php-general
lists.php.net
> > Subject: Re: [PHP] a simple getenv question....
> >
> >
> > just copied your code and it worked fine for me.
> >
> > system: Apache 1.3.26
> > PHP 4.2.2
> >
> > I would look into apache 2.0 and the env vars that are
> available from
> > it.
> >
> >
> > ----- Original Message -----
> > From: "Bruce Douglas" <bedouglas
earthlink.net>
> > To: <php-general
lists.php.net>
> > Sent: Wednesday, January 22, 2003 3:57 PM
> > Subject: [PHP] a simple getenv question....
> >
> >
> > > Hi...
> > >
> > > A simple question... In the following code:
> > >
> > > <?
> > >
> > > $ip = getenv("REMOTE_ADDR");
> > >
> > > echo " ip = ".$ip;
> > >
> > > echo " ip = " . getenv("REMOTE_ADDR");
> > >
> > > echo " ip = " . getenv('REMOTE_ADDR');
> > >
> > > echo " ip = ". $REMOTE_ADDR; <------
> > >
> > > ?>
> > >
> > > I can only seem to get the last line to display the
> correct value.
> > > It's as if I can't seem to get/return any of the SERVER
> environment
> > > variables
> > using
> > > the getenv() function....
> > >
> > > I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
> > >
> > > I've checked through the PHP.INI file, but couldn't seem to
> > find why
> > > this might be occuring. Any help/assistance would be
> > appreciated.....
> > >
> > > thanks
> > >
> > > bruce
> > > bedouglas
earthlink.net
> > >
> > >
> > >
> > > --
> > > 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 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
>
attached mail follows:
Timothy,
Thanks for your input.. but I was trying to get a better understanding as to why the getenv() function was apparently not returning the SERVER environment vars.....
thanks
-bruce
-----Original Message-----
From: Timothy Hitchens (HiTCHO) [mailto:hitcho
php.net]
Sent: Wednesday, January 22, 2003 4:39 PM
To: 'Bruce Douglas'; php-general
lists.php.net
Subject: RE: [PHP] a simple getenv question....
Do this:
<?php
print_r($_SERVER);
?>
If what you want is here this just use: $_SERVER['REMOTE_ADDR'] etc
You will need to have a look at the source of the output as the rendered view will look a little strange.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Bruce Douglas [mailto:bedouglas
earthlink.net]
> Sent: Thursday, 23 January 2003 10:33 AM
> To: php-general
lists.php.net
> Subject: RE: [PHP] a simple getenv question....
>
>
> phpinfo() returns everything as expected.. but not having the
> code .. i don't know what internal method it uses to access
> the information...
>
> but thanks...
>
> -bruce
>
>
> -----Original Message-----
> From: Timothy Hitchens (HiTCHO) [mailto:hitcho
php.net]
> Sent: Wednesday, January 22, 2003 4:18 PM
> To: 'Jim Lucas'; 'Bruce Douglas'; php-general
lists.php.net
> Subject: RE: [PHP] a simple getenv question....
>
>
> The simplest way to start looking would be phpinfo() page for
> starters.
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: tim
hitcho.com.au
>
> > -----Original Message-----
> > From: Jim Lucas [mailto:phplist
zonedzero.net]
> > Sent: Thursday, 23 January 2003 10:15 AM
> > To: Bruce Douglas; php-general
lists.php.net
> > Subject: Re: [PHP] a simple getenv question....
> >
> >
> > just copied your code and it worked fine for me.
> >
> > system: Apache 1.3.26
> > PHP 4.2.2
> >
> > I would look into apache 2.0 and the env vars that are
> available from
> > it.
> >
> >
> > ----- Original Message -----
> > From: "Bruce Douglas" <bedouglas
earthlink.net>
> > To: <php-general
lists.php.net>
> > Sent: Wednesday, January 22, 2003 3:57 PM
> > Subject: [PHP] a simple getenv question....
> >
> >
> > > Hi...
> > >
> > > A simple question... In the following code:
> > >
> > > <?
> > >
> > > $ip = getenv("REMOTE_ADDR");
> > >
> > > echo " ip = ".$ip;
> > >
> > > echo " ip = " . getenv("REMOTE_ADDR");
> > >
> > > echo " ip = " . getenv('REMOTE_ADDR');
> > >
> > > echo " ip = ". $REMOTE_ADDR; <------
> > >
> > > ?>
> > >
> > > I can only seem to get the last line to display the
> correct value.
> > > It's as if I can't seem to get/return any of the SERVER
> environment
> > > variables
> > using
> > > the getenv() function....
> > >
> > > I'm using Apache 2.0.40, PHP 4.2.2 on Linux RedHat 8.0.
> > >
> > > I've checked through the PHP.INI file, but couldn't seem to
> > find why
> > > this might be occuring. Any help/assistance would be
> > appreciated.....
> > >
> > > thanks
> > >
> > > bruce
> > > bedouglas
earthlink.net
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/